[gdb/testsuite] Fix stepi test-cases with unix/-m32/-fPIE/-pie
authorTom de Vries <tdevries@suse.de>
Tue, 2 Nov 2021 08:27:48 +0000 (09:27 +0100)
committerTom de Vries <tdevries@suse.de>
Tue, 2 Nov 2021 08:27:48 +0000 (09:27 +0100)
commitc47860a4bad058631c433490c1e3ec672d613553
tree6c63ce5298a793b220175d58ccb509ec3d007ecb
parent317db249c7a361aa6e723fefc09116fd9cd75978
[gdb/testsuite] Fix stepi test-cases with unix/-m32/-fPIE/-pie

When running test-case gdb.base/step-indirect-call-thunk.exp with target board
unix/-m32/-fPIE/-pie, I run into:
...
(gdb) stepi^M
0x5655552e      22      {                /* inc.1 */^M
(gdb) stepi^M
0x56555530      22      {                /* inc.1 */^M
(gdb) stepi^M
0x565555f7 in __x86.get_pc_thunk.ax ()^M
(gdb) FAIL: gdb.base/step-indirect-call-thunk.exp: stepi into return thunk
...

In contrast, with unix/-m32 we have instead:
...
(gdb) stepi^M
0x08048407      22      {                /* inc.1 */^M
(gdb) stepi^M
23        return x + 1;  /* inc.2 */^M
(gdb) stepi^M
0x0804840c      23        return x + 1;  /* inc.2 */^M
(gdb) stepi^M
24      }                /* inc.3 */^M
(gdb) stepi^M
0x08048410      24      }                /* inc.3 */^M
(gdb) stepi^M
0x0804848f in __x86_return_thunk ()^M
(gdb) PASS: gdb.base/step-indirect-call-thunk.exp: stepi into return thunk
...

The test-case doesn't expect to run into __x86.get_pc_thunk.ax, which is a
PIC helper function for x86_64-linux.

Fix this by insn-stepping through it.

Likewise in a few other test-cases.

Tested on x86_64-linux.
gdb/testsuite/gdb.base/step-indirect-call-thunk.exp
gdb/testsuite/gdb.base/step-test.exp
gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp
gdb/testsuite/gdb.reverse/step-precsave.exp
gdb/testsuite/gdb.reverse/step-reverse.exp