From: Alan Hayward <Alan.Hayward@arm.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: nd <nd@arm.com>, Alan Hayward <Alan.Hayward@arm.com>
Subject: [PATCH 2/2] Check for line notes on GCC as well as Clang
Date: Wed, 24 Oct 2018 09:04:00 -0000 [thread overview]
Message-ID: <20181024090427.22721-2-alan.hayward@arm.com> (raw)
In-Reply-To: <20181024090427.22721-1-alan.hayward@arm.com>
i386 and amd64 only skip the prologue using line notes if the compiler is
Clang. Also allow this for GCC.
With this change we can revert ovldbreak.exp back to only allowing line 49
as the breakpoint for main.
Fixes over 50 tests on Ubuntu x86_64.
Note: Many other targets do NOT have any Clang/GNU check - they allow any
valid result from skip_prologue_using_sal. Maybe that is the better fix
here. However, I was erring on the side of caution.
gdb/ChangeLog:
2018-10-24 Alan Hayward <alan.hayward@arm.com>
* amd64-tdep.c (amd64_skip_prologue): Add GNU check.
* i386-tdep.c (i386_skip_prologue): Likewise.
gdb/testsuite/ChangeLog:
2018-10-24 Alan Hayward <alan.hayward@arm.com>
* gdb.cp/ovldbreak.exp: Only allow line 49 for main breakpoint.
---
gdb/amd64-tdep.c | 7 ++++---
gdb/i386-tdep.c | 7 ++++---
gdb/testsuite/gdb.cp/ovldbreak.exp | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 088542d72b..cda462b5d8 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2474,12 +2474,13 @@ amd64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
= skip_prologue_using_sal (gdbarch, func_addr);
struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr);
- /* Clang always emits a line note before the prologue and another
- one after. We trust clang to emit usable line notes. */
+ /* Clang/GCC always emits a line note before the prologue and another
+ one after. We trust Clang/GCC to emit usable line notes. */
if (post_prologue_pc
&& (cust != NULL
&& COMPUNIT_PRODUCER (cust) != NULL
- && startswith (COMPUNIT_PRODUCER (cust), "clang ")))
+ && (startswith (COMPUNIT_PRODUCER (cust), "clang ")
+ || startswith (COMPUNIT_PRODUCER (cust), "GNU "))))
return std::max (start_pc, post_prologue_pc);
}
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index a6994aaf12..73e1c6c420 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1844,12 +1844,13 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
= skip_prologue_using_sal (gdbarch, func_addr);
struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr);
- /* Clang always emits a line note before the prologue and another
- one after. We trust clang to emit usable line notes. */
+ /* Clang/GCC always emits a line note before the prologue and another
+ one after. We trust Clang/GCC to emit usable line notes. */
if (post_prologue_pc
&& (cust != NULL
&& COMPUNIT_PRODUCER (cust) != NULL
- && startswith (COMPUNIT_PRODUCER (cust), "clang ")))
+ && (startswith (COMPUNIT_PRODUCER (cust), "clang ")
+ || startswith (COMPUNIT_PRODUCER (cust), "GNU "))))
return std::max (start_pc, post_prologue_pc);
}
diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp
index f3f329d293..a2f5620ca8 100644
--- a/gdb/testsuite/gdb.cp/ovldbreak.exp
+++ b/gdb/testsuite/gdb.cp/ovldbreak.exp
@@ -209,7 +209,7 @@ for {set idx 0} {$idx < [llength $overloads]} {incr idx} {
# Verify the breakpoints.
set bptable "Num\[\t \]+Type\[\t \]+Disp Enb Address\[\t \]+What.*\[\r\n]+"
-append bptable "\[0-9\]+\[\t \]+breakpoint\[\t \]+keep\[\t \]y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:4\[89\]\[\r\n\]+"
+append bptable "\[0-9\]+\[\t \]+breakpoint\[\t \]+keep\[\t \]y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:49\[\r\n\]+"
append bptable "\[\t \]+breakpoint already hit 1 time\[\r\n\]+."
foreach ovld $overloads {
append bptable [format "\[0-9\]+\[\t \]+breakpoint\[\t \]+keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(%s\\) at.*$srcfile:%d\[\r\n\]+" $ovld \
--
2.17.1 (Apple Git-112)
next prev parent reply other threads:[~2018-10-24 9:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-24 9:04 [PATCH 1/2] Allow function prologues to have multiple repeating lines Alan Hayward
2018-10-24 9:04 ` Alan Hayward [this message]
2018-11-05 4:16 ` [PATCH 2/2] Check for line notes on GCC as well as Clang Simon Marchi
2018-10-31 16:26 ` [PING][PATCH 1/2] Allow function prologues to have multiple repeating lines Alan Hayward
2018-11-05 3:50 ` [PATCH " Simon Marchi
2018-11-05 16:04 ` Alan Hayward
2018-11-30 20:10 ` Tom Tromey
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=20181024090427.22721-2-alan.hayward@arm.com \
--to=alan.hayward@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=nd@arm.com \
/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