[gdb/testsuite] Fix gdb.fortran/call-no-debug.exp symbol search
authorTom de Vries <tdevries@suse.de>
Wed, 1 Sep 2021 09:38:02 +0000 (11:38 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 1 Sep 2021 09:38:02 +0000 (11:38 +0200)
commit351b63eca95239f9576d1659452e8dab3337773f
treecde84649b45135182160880fee19215f67ba2708
parent5b766b015cb3c212560823d28186a459e0b70287
[gdb/testsuite] Fix gdb.fortran/call-no-debug.exp symbol search

On openSUSE Tumbleweed I ran into:
...
(gdb) ptype outstring_func.part^M
No symbol "outstring_func" in current context.^M
(gdb) FAIL: gdb.fortran/call-no-debug.exp: ptype outstring_func.part
...
while on openSUSE Leap 15.2 I have instead:
...
(gdb) ptype string_func_^M
type = <unknown return type> ()^M
(gdb) PASS: gdb.fortran/call-no-debug.exp: ptype string_func_
...

The difference is caused by the result for "info function string_func", which
is this for the latter:
...
(gdb) info function string_func^M
All functions matching regular expression "string_func":^M
^M
Non-debugging symbols:^M
0x000000000040089c  string_func_^M
...
but this for the former:
...
(gdb) info function string_func^M
All functions matching regular expression "string_func":^M
^M
Non-debugging symbols:^M
0x00000000004012bb  string_func_^M
0x00007ffff7bac5b0  outstring_func.part^M
0x00007ffff7bb1a00  outstring_func.part^M
...

The extra symbols are part of glibc:
...
$ nm /lib64/libc.so.6 | grep string_func
00000000000695b0 t outstring_func.part.0
000000000006ea00 t outstring_func.part.0
...

If glibc debug info is installed, we get instead:
...
(gdb) info function string_func^M
All functions matching regular expression "string_func":^M
^M
File /usr/src/debug/glibc-2.33-9.1.x86_64/stdio-common/vfprintf-internal.c:^M
236:    static int outstring_func(int, size_t, const unsigned int *, FILE *);^M
^M
File vfprintf-internal.c:^M
236:    static int outstring_func(int, size_t, const unsigned char *, FILE *);^M
^M
Non-debugging symbols:^M
0x00000000004012bb  string_func_^M
...
and the FAIL doesn't trigger.

Fix this by calling "info function string_func" before starting the exec, such
that only symbols of the exec are taken into account.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2021-09-01  Tom de Vries  <tdevries@suse.de>

* gdb.fortran/call-no-debug.exp: Avoid shared lib symbols for
find_mangled_name calls.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.fortran/call-no-debug.exp
This page took 0.025465 seconds and 4 git commands to generate.