summaryrefslogtreecommitdiff
path: root/gdb/i386-tdep.c
diff options
context:
space:
mode:
authorkvbhat <kvbhat>2012-12-04 07:43:19 +0000
committerkvbhat <kvbhat>2012-12-04 07:43:19 +0000
commit5475d3e4cc7666146ee3af19a21270910c1f167f (patch)
treed6a4424806ea3ebc34eb5d4b9daaaf55b872b3dc /gdb/i386-tdep.c
parentff6541e5e2c73a8606198b0290bfc1764d287e30 (diff)
downloadgdb-5475d3e4cc7666146ee3af19a21270910c1f167f.tar.gz
Fix for incorrect breakpoint set in case of clang compiled binary
Diffstat (limited to 'gdb/i386-tdep.c')
-rw-r--r--gdb/i386-tdep.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index f0056bea56f..52b5c7004ff 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1582,7 +1582,23 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
CORE_ADDR pc;
gdb_byte op;
int i;
+ CORE_ADDR func_addr;
+ if (find_pc_partial_function (start_pc, NULL, &func_addr, NULL))
+ {
+ CORE_ADDR post_prologue_pc
+ = skip_prologue_using_sal (gdbarch, func_addr);
+ struct symtab *s = find_pc_symtab (func_addr);
+
+ /* Clang always emits a line note before the prologue and another
+ one after. We trust clang to emit usable line notes. */
+ if (post_prologue_pc
+ && (s != NULL
+ && s->producer != NULL
+ && strncmp (s->producer, "clang ", sizeof ("clang ") - 1) == 0))
+ return max (start_pc, post_prologue_pc);
+ }
+
cache.locals = -1;
pc = i386_analyze_prologue (gdbarch, start_pc, 0xffffffff, &cache);
if (cache.locals < 0)