From: KARTHIKVENKATESH BHAT <kv.bhat@samsung.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Fix for incorect breakpoint set in case of clang compiled binary
Date: Mon, 19 Nov 2012 08:07:00 -0000 [thread overview]
Message-ID: <10412685.433941353312405484.JavaMail.weblogic@epml02> (raw)
Dear All,
I wanted to add a patch in i386-tdep.c . Similar to what is done in other architectures such as ARM,
instead of actually going through the complete prologue if we can use the symbol table information to resolve prologue end.
Index: gdb/i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.362
diff -u -p -r1.362 i386-tdep.c
--- gdb/i386-tdep.c 12 Nov 2012 21:59:06 -0000 1.362
+++ gdb/i386-tdep.c 19 Nov 2012 07:56:45 -0000
@@ -1582,8 +1582,30 @@ i386_skip_prologue (struct gdbarch *gdba
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);
+ }
+
Please let me know your i/p if we can push this onto mainstream.
Thanks
Karthik
next reply other threads:[~2012-11-19 8:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-19 8:07 KARTHIKVENKATESH BHAT [this message]
2012-11-19 14:43 ` H.J. Lu
2012-11-19 15:50 ` Tom Tromey
2012-11-20 4:58 KARTHIKVENKATESH BHAT
2012-11-21 13:11 ` Pedro Alves
2012-11-21 13:20 ` Mark Kettenis
2012-11-21 14:11 ` Pedro Alves
2012-11-21 15:39 KARTHIKVENKATESH BHAT
2012-11-21 15:53 ` Pedro Alves
2012-11-27 11:14 ` Mark Kettenis
2012-11-27 13:47 KARTHIKVENKATESH BHAT
2012-11-27 15:59 ` Tom Tromey
2012-12-04 6:09 KARTHIKVENKATESH BHAT
[not found] ` <201212040709.qB479ppK023958@glazunov.sibelius.xs4all.nl>
2012-12-04 23:29 ` Doug Evans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10412685.433941353312405484.JavaMail.weblogic@epml02 \
--to=kv.bhat@samsung.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox