gdb: Fix toplevel types with -fdebug-types-section
authorMark Williams <mark@myosotissp.com>
Tue, 28 Apr 2020 14:12:45 +0000 (16:12 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 28 Apr 2020 14:12:45 +0000 (16:12 +0200)
commit770479f223ecd1920dd3cc683b05b24af25c4613
treeaeae1890889747e08b165d86c2230886a47298d7
parent1b95cdb76caca1b7a9ecf9324acf23139f11f7d1
gdb: Fix toplevel types with -fdebug-types-section

When debugging a program compiled with -fdebug-types-section,
only the first top-level type in each file is visible to gdb.

The problem was caused by moving the assignment to list_in_scope
from process_full_comp_unit and process_full_type_unit to
start_symtab.  This was fine for process_full_comp_unit, because
symtabs and comp units are one-to-one.  But there can be many type
units per symtab (one for each type), and we only call start_symtab
for the first one.  This adds the necessary assignments on the paths
where start_symtab is not called.

gdb/Changelog:

2020-04-28 Mark Williams <mark@myosotissp.com>

PR gdb/24480
* dwarf2read.c: Add missing assingments to list_in_scope when
start_symtab was already called.

gdb/testsuite/Changelog:

2020-04-28 Mark Williams <mark@myosotissp.com>

PR gdb/24480
* dw4-toplevel-types.exp: Test for top level types.
* dw4-toplevel-types.cc: Test for top level types.
gdb/dwarf2/read.c
gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.cc [new file with mode: 0644]
gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp [new file with mode: 0644]