From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 813383860017; Tue, 28 Apr 2020 12:18:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 813383860017 From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug symtab/25886] [debug-types] FAIL: gdb.base/enumval.exp: p ZERO Date: Tue, 28 Apr 2020 12:18:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: symtab X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 12:18:17 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D25886 --- Comment #1 from Tom de Vries --- The problem becomes clear in new_symbol, where we're creating the symbol, a= nd then hit this bit: ... case DW_TAG_enumerator: attr =3D dwarf2_attr (die, DW_AT_const_value, cu); if (attr !=3D nullptr) { dwarf2_const_value (attr, sym, cu); } { /* NOTE: carlton/2003-11-10: See comment above in the=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 DW_TAG_class_type, etc. block. */ list_to_add =3D (cu->list_in_scope =3D=3D cu->get_builder ()->get_file_sy= mbols () && cu->language =3D=3D language_cplus ? cu->get_builder ()->get_global_symbols () : cu->list_in_scope); } break; ... Because cu->list_in_scope is NULL, also list_to_add becomes NULL, and we ne= ver add the symbol to a symtab. The root cause for cu->list_in_scope =3D=3D NULL comes from how the .debug_= types section is handled: ... Contents of the .debug_types section: Compilation Unit @ offset 0x0: Length: 0x35 (32-bit) Version: 4 Abbrev Offset: 0x64 Pointer Size: 8 Signature: 0x1af8140871c0d393 Type Offset: 0x1d <0><17>: Abbrev Number: 1 (DW_TAG_type_unit) <18> DW_AT_language : 12 (ANSI C99) <19> DW_AT_stmt_list : 0xe9 <1><1d>: Abbrev Number: 2 (DW_TAG_enumeration_type) <1e> DW_AT_encoding : 7 (unsigned) <1f> DW_AT_byte_size : 4 <20> DW_AT_type : <0x31> <24> DW_AT_decl_file : 1 <25> DW_AT_decl_line : 20 <26> DW_AT_sibling : <0x31> <2><2a>: Abbrev Number: 3 (DW_TAG_enumerator) <2b> DW_AT_name : (indirect string, offset: 0x208): ZERO <2f> DW_AT_const_value : 0 <2><30>: Abbrev Number: 0 <1><31>: Abbrev Number: 4 (DW_TAG_base_type) <32> DW_AT_byte_size : 4 <33> DW_AT_encoding : 7 (unsigned) <34> DW_AT_name : (indirect string, offset: 0x58): unsigned int <1><38>: Abbrev Number: 0 Compilation Unit @ offset 0x39: Length: 0x47 (32-bit) Version: 4 Abbrev Offset: 0x64 Pointer Size: 8 Signature: 0x42f8c3f86b4c459f Type Offset: 0x1d <0><50>: Abbrev Number: 1 (DW_TAG_type_unit) <51> DW_AT_language : 12 (ANSI C99) <52> DW_AT_stmt_list : 0xe9 <1><56>: Abbrev Number: 5 (DW_TAG_enumeration_type) <57> DW_AT_name : e <59> DW_AT_encoding : 7 (unsigned) <5a> DW_AT_byte_size : 8 <5b> DW_AT_type : <0x7c> <5f> DW_AT_decl_file : 1 <60> DW_AT_decl_line : 18 <61> DW_AT_sibling : <0x7c> <2><65>: Abbrev Number: 6 (DW_TAG_enumerator) <66> DW_AT_name : I <68> DW_AT_const_value : 0 <2><69>: Abbrev Number: 7 (DW_TAG_enumerator) <6a> DW_AT_name : J <6c> DW_AT_const_value : 0xffffffff <2><70>: Abbrev Number: 8 (DW_TAG_enumerator) <71> DW_AT_name : K <73> DW_AT_const_value : 0xf000000000000000 <2><7b>: Abbrev Number: 0 <1><7c>: Abbrev Number: 4 (DW_TAG_base_type) <7d> DW_AT_byte_size : 8 <7e> DW_AT_encoding : 7 (unsigned) <7f> DW_AT_name : (indirect string, offset: 0x53): long unsign= ed int <1><83>: Abbrev Number: 0 ... In case we only print ZERO, dwarf2_cu::setup_type_unit_groups is called for CU@0x0, which calls start_symtab, which sets cu->list_in_scope to non-NULL. In case we first print e, then: - first dwarf2_cu::setup_type_unit_groups is called for CU@0x39, which calls start_symtab, which sets cu->list_in_scope to non-NULL, and - then dwarf2_cu::setup_type_unit_groups is called for CU@0x0, which doesn't call start_symtab because first_time =3D=3D 0, and cu->list_in_scope rema= ins NULL. This patch fixes it: ... diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 82564edd7b2..fde2b595040 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -10972,6 +10972,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die) COMPUNIT_DIRNAME (cust), compunit_language (cust), 0, cust)); + list_in_scope =3D get_builder ()->get_file_symbols (); auto &file_names =3D line_header->file_names (); for (i =3D 0; i < file_names.size (); ++i) ... --=20 You are receiving this mail because: You are on the CC list for the bug.=