[gdb/testsuite] Fix gdb.base/watchpoint-reuse-slot.exp with gcc-8
authorTom de Vries <tdevries@suse.de>
Wed, 6 May 2020 12:27:36 +0000 (14:27 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 6 May 2020 12:27:36 +0000 (14:27 +0200)
When running test-case gdb.base/watchpoint-reuse-slot.exp with gcc-8 instead
of gcc-7, we have:
...
 (gdb) PASS: $conf: watch *(buf.byte + 0 + 0)@1
 stepi^M
-0x00000000004004b9      34        for (i = 0; i < 100000; i++);^M
+34        for (i = 0; i < 100000; i++);^M
-(gdb) PASS: $conf: stepi advanced
+(gdb) FAIL: $conf: stepi advanced
...
where $conf is "gdb.base/watchpoint-reuse-slot.exp: hw-watch: always-inserted
off: watch x watch: : width 1, iter 0: base + 0".

This is due to the fact that gcc-8 generates more precise line info, making
the instruction at 0x4004b9 a "recommended breakpoint location", such that gdb
no longer prints the instruction address.

Fix this by getting the instruction address by printing $pc.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-05-06  Tom de Vries  <tdevries@suse.de>

* gdb.base/watchpoint-reuse-slot.exp (stepi): Print $pc to get current
address.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp

index fde713527d6f34799543d804232e1f8a265c37cb..d808217ad571a91885b9d10b88b4a3aae6aa7dea 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-06  Tom de Vries  <tdevries@suse.de>
+
+       * gdb.base/watchpoint-reuse-slot.exp (stepi): Print $pc to get current
+       address.
+
 2020-05-06  Tom de Vries  <tdevries@suse.de>
 
        * gdb.base/watchpoint-reuse-slot.exp: Fix incorrect assignment.
index 83b970380ca497805f226a53704937de59b18017..3d3d3c479d5d7d8710f939bce30cf0c2675da204 100644 (file)
@@ -66,8 +66,8 @@ proc stepi {} {
     set srcline "  for (i = 0; i < 100000; i++); /* stepi line */"
     set test "stepi advanced"
     gdb_test_multiple "stepi" $test {
-       -re "($hex).*[string_to_regexp $srcline]\r\n$gdb_prompt $" {
-           set addr $expect_out(1,string)
+       -re -wrap "[string_to_regexp $srcline]" {
+           set addr [get_valueof "/x" "\$pc" "0"]
            if {$addr != $cur_addr} {
                pass $test
            } else {
This page took 0.042248 seconds and 4 git commands to generate.