]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/testsuite: fix readnow detection
authorAndrew Burgess <aburgess@redhat.com>
Thu, 8 Dec 2022 11:33:50 +0000 (11:33 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Wed, 14 Dec 2022 10:22:44 +0000 (10:22 +0000)
commit9399ac888300bddd1c3382f44c85b0c59e4063b2
tree5f72ed1b9e1668596235b4aaec4779b17b6b7329
parent207cc92d92c863298c530498e2dbf71a2b5fd8ae
gdb/testsuite: fix readnow detection

The following commit broke the readnow detection in the testsuite:

  commit dfaa040b440084dd73ebd359326752d5f44fc02c
  Date:   Mon Mar 29 18:31:31 2021 -0600

      Remove some "OBJF_READNOW" code from dwarf2_debug_names_index

The testsuite checks if GDB was started with the -readnow flag by
using the 'maintenance print objfiles' command, and looking for the
string 'faked for "readnow"' in the output.  This is implemented in
two helper procs `readnow` (gdb.exp) and `mi_readnow` (mi-support.exp).

The following tests all currently depend on this detection:

  gdb.base/maint.exp
  gdb.cp/nsalias.exp
  gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp
  gdb.dwarf2/dw2-stack-boundary.exp
  gdb.dwarf2/dw2-zero-range.exp
  gdb.dwarf2/gdb-index-nodebug.exp
  gdb.mi/mi-info-sources.exp
  gdb.python/py-symbol.exp
  gdb.rust/traits.exp

The following test also includes detection of 'readnow', but does the
detection itself by checking $::GDBFLAGS for the readnow flag:

  gdb.opt/break-on-_exit.exp

The above commit removed from GDB the code that produced the 'faked
for "readnow"' string, as a consequence the testsuite can no longer
correctly spot when readnow is in use, and many of the above tests
will fail (at least partially).

When looking at the above tests, I noticed that gdb.rust/traits.exp
does call `readnow`, but doesn't actually use the result, so I've
removed the readnow call, this simplifies the next part of this patch
as gdb.rust/traits.exp was the only place an extra regexp was passed
to the readnow call.

Next I have rewritten `readnow` to check the $GDBFLAGS for the
-readnow flag, and removed the `maintenance print objfiles` check.  At
least for all the tests above, when using the readnow board, this is
good enough to get everything passing again.

For the `mi_readnow` proc, I changed this to just call `readnow` from
gdb.exp, I left the mi_readnow name in place - in the future it might
be the case that we want to do some different checks here.

Finally, I updated gdb.opt/break-on-_exit.exp to call the `readnow`
proc.

With these changes, all of the tests listed above now pass correctly
when using the readnow board.
gdb/testsuite/gdb.opt/break-on-_exit.exp
gdb/testsuite/gdb.rust/traits.exp
gdb/testsuite/lib/gdb.exp
gdb/testsuite/lib/mi-support.exp