[0/4] Test-case gdb.base/unwind-on-each-insn.exp improvements

Message ID 20230119104618.15503-1-tdevries@suse.de
Headers
Series Test-case gdb.base/unwind-on-each-insn.exp improvements |

Message

Tom de Vries Jan. 19, 2023, 10:46 a.m. UTC
  While analyzing PR record/29721 "[gdb, record, aarch64] FAIL:
gdb.reverse/solib-precsave.exp: reverse-next third shr1", I came to realize
that I was a looking at the aarch64 variant of x86_64 PR record/16678 (as
indeed suggested by Bruno in the PR).

The test-case gdb.base/unwind-on-each-insn.exp was added in the commit to fix
PR record/16678, to detect similar problems on other architectures, but it
passes on aarch64 and doesn't detect record/29721, because the function that
is checked is too simple on aarch64:
...
    00000000004005fc <foo>:
      4005fc:       d503201f        nop
      400600:       d65f03c0        ret
...

This series first simplifies, and then improves test-case
gdb.base/unwind-on-each-insn.exp to detect PR record/16678, or more precisely,
the two spinoff PRs I filed that have reproducers that do not involve reverse
execution:
- PR30010 - [gdb/tdep, aarch64] Incorrect frame address for last insn
  (non-leaf case)
- PR30011 - [gdb/tdep, aarch64] Incorrect frame address for last insn
  (leaf case)

In short, we have following patches:
- [gdb/testsuite] Simplify gdb.base/unwind-on-each-insn.exp
  Remove unnecessary and fragile complication of analyzing disassembly.
- [gdb/testsuite] Improve gdb.base/unwind-on-each-insn.exp
  Detect PR30011.
- [gdb/tdep, aarch64] Fix frame address of last insn in leaf function
  Fix for PR30011.
- [gdb/testsuite] Analyze non-leaf fn in gdb.base/unwind-on-each-insn.exp
  Detect PR30010.

Improving the test-case also detected a problem on powerpc64le, filed as PR
tdep/30021 - "[gdb/tdep, powerpc64le] previous frame inner to this frame
(corrupt stack?)".

Due to unavailability I haven't tested the last patch on powerpc64le-linux.

While doing this investigation I also ran into PR tdep/30019 -
"[gdb/tdep, i386] frame address at first insn in main is zero", but the
test-case doesn't trigger this.  I've not tried adding this.

Finally, I'm considering moving the test-case to gdb.arch, but I haven't
included a patch for this.

Tom de Vries (4):
  [gdb/testsuite] Simplify gdb.base/unwind-on-each-insn.exp
  [gdb/testsuite] Improve gdb.base/unwind-on-each-insn.exp
  [gdb/tdep, aarch64] Fix frame address of last insn in leaf function
  [gdb/testsuite] Analyze non-leaf fn in
    gdb.base/unwind-on-each-insn.exp

 gdb/aarch64-tdep.c                            |   6 +-
 .../gdb.base/unwind-on-each-insn-foo.c        |   8 +-
 gdb/testsuite/gdb.base/unwind-on-each-insn.c  |   6 +-
 .../gdb.base/unwind-on-each-insn.exp          | 167 ++++++++----------
 4 files changed, 89 insertions(+), 98 deletions(-)


base-commit: b8d21eb0cd10d6127e77cc437d82e949adb0c454
  

Comments

Tom de Vries Jan. 25, 2023, 12:32 p.m. UTC | #1
On 1/19/23 11:46, Tom de Vries via Gdb-patches wrote:
> Improving the test-case also detected a problem on powerpc64le, filed as PR
> tdep/30021 - "[gdb/tdep, powerpc64le] previous frame inner to this frame
> (corrupt stack?)".
> 
> Due to unavailability I haven't tested the last patch on powerpc64le-linux.

I've done that now, and ran into yet another problem on 
powerpc64le-linux: PR tdep/30049.  I've mentioned it in the commit log.

I've pushed the remaining two patches.

Thanks,
- Tom