diff options
author | Karthik Bhat <kvbhat@sourceware.org> | 2012-11-21 07:39:02 +0000 |
---|---|---|
committer | Karthik Bhat <kvbhat@sourceware.org> | 2012-11-21 07:39:02 +0000 |
commit | 4e879fc2fd0322fb016aa80af907c052b326430a (patch) | |
tree | e06013558b60d8b107bb0502ddfa3fcf54fc18de | |
parent | 85ddcc7021c2709e1b2846277d9af37fe0c6ee80 (diff) | |
download | gdb-4e879fc2fd0322fb016aa80af907c052b326430a.zip gdb-4e879fc2fd0322fb016aa80af907c052b326430a.tar.gz gdb-4e879fc2fd0322fb016aa80af907c052b326430a.tar.bz2 |
Fix for incorrect breakpoint set in case of clang compiled binary
-rw-r--r-- | gdb/i386-tdep.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index f0056be..5e12cb5 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -1582,8 +1582,30 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) CORE_ADDR pc; gdb_byte op; int i; - cache.locals = -1; + CORE_ADDR func_addr; + struct symtab *s = find_pc_symtab (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); + + /* GCC always emits a line note before the prologue and another + one after, even if the two are at the same address or on the + same line. Take advantage of this so that we do not need to + know every instruction that might appear in the prologue. We + will have producer information for most binaries; if it is + missing (e.g. for -gstabs), assuming the GNU tools. */ + if (post_prologue_pc + && (s == NULL + || s->producer == NULL + || strncmp (s->producer, "GNU ", sizeof ("GNU ") - 1) == 0 + || strncmp (s->producer, "clang ", sizeof ("clang ") - 1) == 0)) + return max (start_pc, post_prologue_pc); + } + + pc = i386_analyze_prologue (gdbarch, start_pc, 0xffffffff, &cache); if (cache.locals < 0) return start_pc; |