gdb/testsuite/dwarf: don't automatically add directory and file entry for DWARF 5
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 7 Apr 2022 01:51:56 +0000 (21:51 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 18 Apr 2022 20:57:36 +0000 (16:57 -0400)
commit9a0de6abdd1af5a4eaafb44d7cda6ad60a4b6485
tree52810ac00682d177b415b2f4a7524dc4894ced70
parent56325e2ba62af99ff47c38679951115cbf5c6ba0
gdb/testsuite/dwarf: don't automatically add directory and file entry for DWARF 5

To support DWARF 5 in the DWARF assembler line tables, we currently copy
the first user-provided directory and the first user-provided files and
make them elements at indices 0 in the directory and file name tables.
That was a sufficient behavior at the time (see commit 44fda089397a
("[gdb/testsuite] Support .debug_line v5 in dwarf assembler")), but in
the following patches, I would need to have finer grained control on
what is generated exactly.  For example, I'd like to generate a DWARF 5 line
table with just a single file and a single directory.

Get rid of this behavior, and implement what is suggested in
44fda089397a: make include_dir return the directory index that can be
used to refer to that directory entry (based on the DWARF version), and
use it afterwards.

Adjust dw2-lines.exp and dw2-prologue-end.exp accordingly.  Their produced
DWARF5 binaries will change a bit, in that they will now have a single
directory and file, where they had two before.  But it doesn't change
the expected GDB behavior.

Change-Id: I5459b16ac9b7f28c34c9693c35c9afd2ebb3aa3b
gdb/testsuite/gdb.dwarf2/dw2-lines.exp
gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp
gdb/testsuite/lib/dwarf.exp