[gdb/testsuite] Speed up MACRO_AT_* calls
authorTom de Vries <tdevries@suse.de>
Mon, 22 Nov 2021 08:14:15 +0000 (09:14 +0100)
committerTom de Vries <tdevries@suse.de>
Mon, 22 Nov 2021 08:14:15 +0000 (09:14 +0100)
commitfc6a93854b3c9520259926891c3a5c559d3545d1
tree4a951f6f82077c6c568c0d9575fbb8f7eb6a1e86
parentb4ab41207051793d280aeba47abe8e6ed3ac5861
[gdb/testsuite] Speed up MACRO_AT_* calls

Currently, for each MACRO_AT_range or MACRO_AT_func in dwarf assembly the
following is done:
- $srcdir/$subdir/$srcfile is compiled to an executable using
  flags "debug"
- a new gdb instance is started
- the new executable is loaded.

This is inefficient, because the executable is identical within the same
Dwarf::assemble call.

Share the gdb instance in the same Dwarf::assemble invocation, which speeds
up a make check with RUNTESTFLAGS like this to catch all dwarf assembly
test-cases:
...
rtf=$(echo $(cd src/gdb/testsuite; find gdb.* -type f -name "*.exp" \
      | xargs grep -l Dwarf::assemble))
...
from:
...
real    1m39.916s
user    1m25.668s
sys     0m21.377s
...
to:
...
real    1m29.512s
user    1m17.316s
sys     0m19.100s
...

Tested on x86_64-linux.
gdb/testsuite/lib/dwarf.exp