aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2023-09-06 10:14:50 +0200
committerTom de Vries <tdevries@suse.de>2023-09-06 10:14:50 +0200
commit7023b8d86c6f2403a4d7337e0b55fa9290181a06 (patch)
treee86e429fd7492698d80b298b770a8d85fd88f264 /gdb
parent83066cb9c7dc2d16adf22649251392d04a7c8d83 (diff)
downloadgdb-7023b8d86c6f2403a4d7337e0b55fa9290181a06.zip
gdb-7023b8d86c6f2403a4d7337e0b55fa9290181a06.tar.gz
gdb-7023b8d86c6f2403a4d7337e0b55fa9290181a06.tar.bz2
[gdb/symtab] Handle PU in iterate_over_some_symtabs
When running test-case gdb.base/setshow.exp with target board cc-with-dwz I run into: ... (gdb) info line 1^M Line 1 of "setshow.c" is at address 0x400527 <main> but contains no code.^M Line 1 of "setshow.c" is at address 0x400527 <main> but contains no code.^M (gdb) FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1 ... while the expected output is: ... Line 1 of "setshow.c" is at address 0x400527 <main> but contains no code. ��setshow.c:1:0:beg:0x400527 ... The second line of the expected output is missing due to the first line of the expected output being repeated, so the problem is that the "Line 1" line is printed twice. This happens because the PU imported by the CU reuses the filetab of the CU, and both the CU and PU are visited by iterate_over_some_symtabs. Fix this by skipping PUs in iterate_over_some_symtabs. Tested on x86_64-linux, target boards unix, cc-with-dwz and cc-with-dwz-m. Approved-By: Tom Tromey <tom@tromey.com> PR symtab/30797 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30797
Diffstat (limited to 'gdb')
-rw-r--r--gdb/symtab.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index d8ce2bf..22c8b42 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -575,6 +575,10 @@ iterate_over_some_symtabs (const char *name,
for (cust = first; cust != NULL && cust != after_last; cust = cust->next)
{
+ /* Skip included compunits. */
+ if (cust->user != nullptr)
+ continue;
+
for (symtab *s : cust->filetabs ())
{
if (compare_filenames_for_search (s->filename, name))