diff options
author | Tom de Vries <tdevries@suse.de> | 2020-05-06 11:50:52 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2020-05-06 11:50:52 +0200 |
commit | 0fc2a808cbf5302016535367191bb8cd0900f332 (patch) | |
tree | 1c680126b39af32a69a863813805622414b00057 /gdb/testsuite | |
parent | 873dd4273f9742e8e2f36868cd49dc83b6f199f5 (diff) | |
download | binutils-gdb-0fc2a808cbf5302016535367191bb8cd0900f332.tar.gz |
[gdb/testsuite] Fix gdb.base/shlib-call.exp with gcc-8
When running test-case gdb.base/shlib-call.exp with gcc-8 instead of gcc-7, we
have:
...
(gdb) step^M
-main () at /data/gdb_versions/devel/src/gdb/testsuite/gdb.base/shmain.c:42^M
-42 g = mainshr1(g);^M
-(gdb) PASS: gdb.base/shlib-call.exp: step out of shr2 epilogue to main
+main () at /data/gdb_versions/devel/src/gdb/testsuite/gdb.base/shmain.c:41^M
+41 g = shr2(g);^M
+(gdb) FAIL: gdb.base/shlib-call.exp: step out of shr2 epilogue to main
...
This is due to the fact that gcc-8 generates more precise line info, making
the instruction after the call to shr2 at 0x4008f1:
...
4008e4: 8b 05 aa 07 20 00 mov 0x2007aa(%rip),%eax # 601094 <g>
4008ea: 89 c7 mov %eax,%edi
4008ec: e8 1f fe ff ff callq 400710 <shr2@plt>
4008f1: 89 05 9d 07 20 00 mov %eax,0x20079d(%rip) # 601094 <g>
...
a "recommended breakpoint location":
...
[0x00000287] Special opcode 187: advance Address by 13 to 0x4008f1 and \
Line by 0 to 41
...
so when stepping out of shr2, gdb steps back onto line 41, the line containing
the call to shr2.
Fix this by detecting this situation and adding an extra step to reach
line 42.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-05-06 Tom de Vries <tdevries@suse.de>
* gdb.base/shlib-call.exp: Add extra step to reach shmain.c:42, if
necessary.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/shlib-call.exp | 11 |
2 files changed, 13 insertions, 3 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index d04ce49ade9..b2f90912502 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2020-05-06 Tom de Vries <tdevries@suse.de> + * gdb.base/shlib-call.exp: Add extra step to reach shmain.c:42, if + necessary. + +2020-05-06 Tom de Vries <tdevries@suse.de> + * lib/unbuffer_output.c (gdb_unbuffer_output): Change return type to void. diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp index 806fc15157a..97e04cdbb5e 100644 --- a/gdb/testsuite/gdb.base/shlib-call.exp +++ b/gdb/testsuite/gdb.base/shlib-call.exp @@ -142,9 +142,14 @@ gdb_test_multiple "step" "step out of shr2 to main" { } -re ".*\\\}.*$gdb_prompt $" { pass "step out of shr2 to main (stopped in shr2 epilogue)" - gdb_test "step" \ - "main \\(\\) at.*g = mainshr1\\(g\\);" \ - "step out of shr2 epilogue to main" + gdb_test_multiple "step" "step out of shr2 epilogue to main" { + -re -wrap "main \\(\\) at.*g = mainshr1\\(g\\);" { + pass $gdb_test_name + } + -re -wrap "main \\(\\) at.*g = shr2\\(g\\);" { + gdb_test "step" "g = mainshr1\\(g\\);" $gdb_test_name + } + } } } |