From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix gdb.base/async.exp with gcc-8
Date: Mon, 4 May 2020 08:41:41 +0200 [thread overview]
Message-ID: <20200504064139.GA27900@delia> (raw)
Hi,
When running test-case gdb.base/async.exp with gcc-8, we run into:
...
FAIL: gdb.base/async.exp: stepi&
...
The problem is that with gcc-8, the instruction address is no longer printed:
...
stepi&
-(gdb) 0x00000000004004b2 9 x = 5; x = 5; x = 5;
+(gdb) 9 x = 5; x = 5; x = 5;
completed.
-PASS: gdb.base/async.exp: stepi&
+FAIL: gdb.base/async.exp: stepi&
...
This is due to the fact that gcc-8 contains more precise line info, making the
address being stepped to a "recommended breakpoint location", and consequently
gdb doesn't print the address prefix anymore.
Given that:
- we step through statements on the same line, and
- there's no addres prefix anymore,
this gives the impression of lack of progress, which could be improved upon,
filed as enhancement PR25911 - "Show column when stepping through line".
Fix the FAIL by checking in the test-case whether addresses are at
"recommended breakpoint location" or not.
Tested on x86_64-linux.
Committed to trunk.
Thanks,
- Tom
[gdb/testsuite] Fix gdb.base/async.exp with gcc-8
gdb/testsuite/ChangeLog:
2020-05-04 Tom de Vries <tdevries@suse.de>
* gdb.base/async.exp: Check whether instruction addresses are a
"recommended breakpoint location".
---
gdb/testsuite/gdb.base/async.exp | 54 +++++++++++++++++++++++++++++++++++-----
1 file changed, 48 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/gdb.base/async.exp b/gdb/testsuite/gdb.base/async.exp
index bc46f4b5128..bf124ca56a9 100644
--- a/gdb/testsuite/gdb.base/async.exp
+++ b/gdb/testsuite/gdb.base/async.exp
@@ -79,7 +79,16 @@ test_background "step&" "" ".*y = foo \\(\\).*" "step& #1"
test_background "step&" "" " foo \\(\\) at .*async.c.*x = 5.*" "step& #2"
-test_background "stepi&" "" ".*$hex.*x = 5.*"
+set is_stmt [list]
+gdb_test_multiple "maint info line-table async.c" "" {
+ -re "\r\n$decimal\[ \t\]+$decimal\[ \t\]+($hex)\[ \t\]+Y\[^\r\n\]*" {
+ lappend is_stmt $expect_out(1,string)
+ exp_continue
+ }
+ -re -wrap "" {
+ pass $gdb_test_name
+ }
+}
# Get the next instruction address.
set next_insn_addr ""
@@ -90,13 +99,46 @@ gdb_test_multiple {x/2i $pc} "$test" {
pass "$test"
}
}
+set next_insn_is_stmt \
+ [expr [lsearch -regexp $is_stmt 0x0*$next_insn_addr] != -1]
+
+if { $next_insn_is_stmt } {
+ set prefix ""
+} else {
+ # The current PC is printed out.
+ set prefix "0x0*$next_insn_addr.*"
+}
+test_background "stepi&" "" ".*$prefix x = 5; .*"
-# We nexti into the same source line. The current PC is printed out.
-test_background "nexti&" "" ".* 0x0*$next_insn_addr.* x = 5; .*"
-
-# PC is in the middle of a source line, so the PC address is displayed.
+# Get the next instruction address.
+set next_insn_addr ""
+set test "get next insn"
+gdb_test_multiple {x/2i $pc} "$test" {
+ -re "=> $hex .* 0x(\[0-9a-f\]*) .*$gdb_prompt $" {
+ set next_insn_addr $expect_out(1,string)
+ pass "$test"
+ }
+}
+set next_insn_is_stmt \
+ [expr [lsearch -regexp $is_stmt 0x0*$next_insn_addr] != -1]
+
+if { $next_insn_is_stmt } {
+ set prefix ""
+} else {
+ # The current PC is printed out.
+ set prefix "0x0*$next_insn_addr.*"
+}
+# We nexti into the same source line.
+test_background "nexti&" "" ".*$prefix x = 5; .*"
+
+if { $next_insn_is_stmt } {
+ set prefix ""
+} else {
+ # PC is in the middle of a source line, so the PC address is displayed.
+ set prefix "0x0*$next_insn_addr in "
+}
test_background "finish&" \
- "Run till exit from #0 $hex in foo \\(\\) at.*async.c.*\r\n" \
+ "Run till exit from #0 ${prefix}foo \\(\\) at.*async.c.*\r\n" \
".*$hex in main \\(\\) at.*async.c.*y = foo \\(\\).*Value returned is.*= 8.*"
set jump_here [gdb_get_line_number "jump here"]
reply other threads:[~2020-05-04 6:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200504064139.GA27900@delia \
--to=tdevries@suse.de \
--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