[gdb/testsuite] Fix mi-sym-info.exp matching FAILs
authorTom de Vries <tdevries@suse.de>
Thu, 12 Mar 2020 23:41:44 +0000 (00:41 +0100)
committerTom de Vries <tdevries@suse.de>
Thu, 12 Mar 2020 23:41:44 +0000 (00:41 +0100)
commit49ba92c0a6765ee7dc3a773c1a044680d29cee0e
tree489985e74493150c1dbd9487c20b5bc46e6f0a5e
parent301b21e0dfee41c7a93f41089428d5d03fee685b
[gdb/testsuite] Fix mi-sym-info.exp matching FAILs

When running gdb.mi/mi-sym-info.exp on openSUSE Leap 15.1, I get:
...
FAIL: gdb.mi/mi-sym-info.exp: List all functions matching type void \
  (unexpected output)
FAIL: gdb.mi/mi-sym-info.exp: -symbol-info-variables --max-results 3 \
  (unexpected output)
FAIL: gdb.mi/mi-sym-info.exp: -symbol-info-types --max-results 4 \
  (unexpected output)
...

The executable contains debug info from files other than the source files:
...
$ readelf -wi mi-sym-info | grep "DW_AT_name.*\.[cS]$" | awk '{print $8}'
../sysdeps/x86_64/start.S
init.c
../sysdeps/x86_64/crti.S
src/gdb/testsuite/gdb.mi/mi-sym-info-1.c
src/gdb/testsuite/gdb.mi/mi-sym-info-2.c
elf-init.c
../sysdeps/x86_64/crtn.S
...

The test does not expect this extra info, resulting in matching failures.

Fix this by restricting the failing commands using --name.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-03-13  Tom de Vries  <tdevries@suse.de>

* gdb.mi/mi-sym-info-2.c (another_char_t, another_short_t): New typedef.
(var1, var2): New variable.
* gdb.mi/mi-sym-info.exp: Add --name to various commands to restrict
matching symbols.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.mi/mi-sym-info-2.c
gdb/testsuite/gdb.mi/mi-sym-info.exp