aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorKarthik Bhat <kvbhat@sourceware.org>2012-12-04 07:43:19 +0000
committerKarthik Bhat <kvbhat@sourceware.org>2012-12-04 07:43:19 +0000
commit56bf0743058aa1fff07b32ba50c1e9bfaf9e2bcc (patch)
treedd8402e7de50e55b64fd6e3c6df76ee1a48994f6 /gdb
parente9eb0d14a798062137f3e8d436adf7bff079ce6e (diff)
downloadgdb-56bf0743058aa1fff07b32ba50c1e9bfaf9e2bcc.zip
gdb-56bf0743058aa1fff07b32ba50c1e9bfaf9e2bcc.tar.gz
gdb-56bf0743058aa1fff07b32ba50c1e9bfaf9e2bcc.tar.bz2
Fix for incorrect breakpoint set in case of clang compiled binary
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/amd64-tdep.c16
-rw-r--r--gdb/i386-tdep.c16
3 files changed, 39 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ae82862..41d9891 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2012-12-04 Karthik Bhat <kv.bhat@samsung.com>
+
+ * i386-tdep.c (i386_skip_prologue): Using symbol table
+ to find the end of prologue for clang compiled binaries.
+ * amd64-tdep.c (amd64_skip_prologue): Using symbol table
+ to find the end of prologue for clang compiled binaries.
+
2012-12-03 Doug Evans <dje@google.com>
* dwarf2read.c (struct dwarf2_per_objfile): Clarify comment.
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 2edaecf..fec74d5 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2252,6 +2252,22 @@ amd64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
{
struct amd64_frame_cache cache;
CORE_ADDR pc;
+ 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);
+ }
amd64_init_frame_cache (&cache);
pc = amd64_analyze_prologue (gdbarch, start_pc, 0xffffffffffffffffLL,
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index f0056be..52b5c70 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)