public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Fix gdb.base/async.exp with gcc-8
@ 2020-05-04 6:40 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2020-05-04 6:40 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6015a0674901be2c3fd24867e1a610d2abf8c1a0
commit 6015a0674901be2c3fd24867e1a610d2abf8c1a0
Author: Tom de Vries <tdevries@suse.de>
Date: Mon May 4 08:40:38 2020 +0200
[gdb/testsuite] Fix gdb.base/async.exp with gcc-8
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.
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".
Diff:
---
gdb/testsuite/ChangeLog | 5 ++++
gdb/testsuite/gdb.base/async.exp | 54 +++++++++++++++++++++++++++++++++++-----
2 files changed, 53 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 2984996641f..409f44ca9d0 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-04 Tom de Vries <tdevries@suse.de>
+
+ * gdb.base/async.exp: Check whether instruction addresses are a
+ "recommended breakpoint location".
+
2020-05-03 Tom Tromey <tom@tromey.com>
* gdb.base/sepdebug.exp: Remove "catch" test.
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"]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-05-04 6:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-04 6:40 [binutils-gdb] [gdb/testsuite] Fix gdb.base/async.exp with gcc-8 Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).