[gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp for aarch64
authorTom de Vries <tdevries@suse.de>
Fri, 16 Sep 2022 14:34:13 +0000 (16:34 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 16 Sep 2022 14:34:13 +0000 (16:34 +0200)
commit77e6e213e0c8e77c53d123244ac75d6a825bda86
tree360de99126e60e805c376aed8bb5185d11cbd31f
parentfaf01aee1d03aef5b6f95fd0db358bf5e70578f9
[gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp for aarch64

[ Another attempt at fixing the problem described in commit cd919f5533c
("[gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp"). ]

When running the test-case gdb.dwarf2/dw2-dir-file-name.exp with
aarch64-linux, we run into:
...
(gdb) continue^M
Continuing.^M
^M
Breakpoint 2, compdir_missing__ldir_missing__file_basename () at \
  tmp-dw2-dir-file-name.c:999^M
(gdb) FAIL: gdb.dwarf2/dw2-dir-file-name.exp: \
  compdir_missing__ldir_missing__file_basename: continue to breakpoint: \
  compdir_missing__ldir_missing__file_basename
...

The breakpoint set at compdir_missing__ldir_missing__file_basename_label,
address 0x400608 starts at a line entry:
...
CU: tmp-dw2-dir-file-name.c:
File name                    Line number    Starting address    View    Stmt
tmp-dw2-dir-file-name.c              999            0x400608               x
tmp-dw2-dir-file-name.c             1000            0x40062c               x
tmp-dw2-dir-file-name.c                -            0x40062c
...
and therefore the breakpoint is printed without instruction address.

In contrast, for x86_64-linux, we have the breakpoint printed with instruction
address:
...
(gdb) continue^M
Continuing.^M
^M
Breakpoint 2, 0x004004c1 in compdir_missing__ldir_missing__file_basename () \
  at tmp-dw2-dir-file-name.c:999^M
(gdb) PASS: gdb.dwarf2/dw2-dir-file-name.exp: \
  compdir_missing__ldir_missing__file_basename: continue to breakpoint: \
  compdir_missing__ldir_missing__file_basename
...

The breakpoint set at compdir_missing__ldir_missing__file_basename_label,
address 0x004004c1 doesn't start at a line entry:
...
CU: tmp-dw2-dir-file-name.c:
File name                    Line number    Starting address    View    Stmt
tmp-dw2-dir-file-name.c              999            0x4004bd               x
tmp-dw2-dir-file-name.c             1000            0x4004d3               x
tmp-dw2-dir-file-name.c                -            0x4004d3
...

Fix this by:
- unifying behaviour between the archs by adding an explicit line number entry
  for the address compdir_missing__ldir_missing__file_basename_label, making
  the FAIL reproducible on x86_64-linux.
- expecting the breakpoint to be printed without instruction address.

Tested on x86_64-linux and aarch64-linux.
gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp