diff options
author | Tom de Vries <tdevries@suse.de> | 2023-09-06 11:00:01 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-09-06 11:00:01 +0200 |
commit | e061219f5d600af5b33418553f192e0cb9fc9ca9 (patch) | |
tree | 0b0fb546d564702cb1b85d697a9d73cc883a323d /gdb/testsuite/gdb.python/python.c | |
parent | 7023b8d86c6f2403a4d7337e0b55fa9290181a06 (diff) | |
download | binutils-e061219f5d600af5b33418553f192e0cb9fc9ca9.zip binutils-e061219f5d600af5b33418553f192e0cb9fc9ca9.tar.gz binutils-e061219f5d600af5b33418553f192e0cb9fc9ca9.tar.bz2 |
[gdb/symtab] Fix too many symbols in gdbpy_lookup_static_symbols
When running test-case gdb.python/py-symbol.exp with target board
cc-with-dwz-m, we run into:
...
(gdb) python print (len (gdb.lookup_static_symbols ('rr')))^M
4^M
(gdb) FAIL: gdb.python/py-symbol.exp: \
print (len (gdb.lookup_static_symbols ('rr')))
...
while with target board unix we have instead:
...
(gdb) python print (len (gdb.lookup_static_symbols ('rr')))^M
2^M
(gdb) PASS: gdb.python/py-symbol.exp: \
print (len (gdb.lookup_static_symbols ('rr')))
...
The problem is that the loop in gdbpy_lookup_static_symbols loops over compunits
representing both CUs and PUs:
...
for (compunit_symtab *cust : objfile->compunits ())
...
When doing a lookup on a PU, the user link is followed until we end up at a CU,
and the lookup is done in that CU.
In other words, when doing a lookup in the loop for a PU we duplicate the
lookup for a CU that is already handled by the loop.
Fix this by skipping PUs in the loop in gdb.lookup_static_symbols.
Tested on x86_64-linux.
PR symtab/25261
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=25261
Diffstat (limited to 'gdb/testsuite/gdb.python/python.c')
0 files changed, 0 insertions, 0 deletions