From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5687F39450E7; Fri, 27 Mar 2020 09:55:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5687F39450E7 From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug ada/25736] New: psym_map_matching_symbols finds symbol in partial symtab, but not in full symtab Date: Fri, 27 Mar 2020 09:55:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: ada X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: minor 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Fri, 27 Mar 2020 09:55:02 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D25736 Bug ID: 25736 Summary: psym_map_matching_symbols finds symbol in partial symtab, but not in full symtab Product: gdb Version: HEAD Status: NEW Severity: minor Priority: P2 Component: ada Assignee: unassigned at sourceware dot org Reporter: vries at gcc dot gnu.org Target Milestone: --- The function psym_map_matching_symbols looks like this: ... for (partial_symtab *ps : require_partial_symbols (objfile, true)) { QUIT; if (ps->readin_p () || match_partial_symbol (objfile, ps, global, name, domain, ordered_compare)) { struct compunit_symtab *cust =3D psymtab_to_symtab (objfile, ps); const struct block *block; if (cust =3D=3D NULL) continue; block =3D BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), block_k= ind); if (!iterate_over_symbols_terminated (block, name, domain, callback)) return; } } ... So if a symtab is not already expanded, it tries to find the symbol in the partial symtab, and if so, expands the partial symtab into the full symtab = and tries to find the symbol there. I wrote an assert to check that if psym_map_matching_symbols finds a symbol= in a partial symbol table, and expands it, it should find a matching symbol in= the expanded symbol table. [ Likewise, we could also write an assert that if psym_map_matching_symbols does not find a symbol in a partial symbol table, it should also not find o= ne in the full symbol table. ] In a full test run, I ran only into: ... FAIL: gdb.ada/bp_inlined_func.exp: set breakpoint at read_small (GDB intern= al error) ... Which can be reproduced using: ... $ gdb \ -batch \ outputs/gdb.ada/bp_inlined_func/foo \ -ex 'b main' \ -ex r \ -ex 'b read_small' ... Inspecting the assert shows that the partial/full symtabs are related to foo.adb: ... (gdb) p ps.filename $7 =3D 0x1a87c90 "/data/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/bp_inlined= _func/foo.adb" (gdb) p cust.name $8 =3D 0x1b2ebe0 "foo.adb" ... and inspecting the partial symbols gives us: ... (gdb) call maintenance_print_psymbols (0, 0) Partial symtab for source file /data/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/bp_inlined_= func/foo.adb (object 0x1a94660) Read from object file /data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/bp_inlined_fun= c/foo (0x13103b0) Full symtab was read (at 0x1b2eb70) Symbols cover text addresses 0x402066-0x4020a2 Address map supported - yes. Depends on 0 other partial symtabs. Global partial symbols: `_ada_foo' `foo', function, 0x402066 `b__read_small' `b.read_small', function, 0x40206f ... while inspecting the full symbols gives us: ... Symtab for file /data/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/bp_inlined_= func/foo.adb at 0x1b2ebf0 Compilation directory is /data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/bp_inlined_func Read from object file /data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/bp_inlined_fun= c/foo (0x13103b0) Language: ada Line table: line 18 at 0x402066 (stmt) line 20 at 0x40206a (stmt) line 0 at 0x40206f (stmt) line 22 at 0x40209a (stmt) line 23 at 0x40209f (stmt) line 0 at 0x4020a2 (stmt) Blockvector: block #000, object at 0x1b2f000, 1 syms/buckets in 0x402066..0x4020a2 procedure foo; block object 0x1b2ef40, 0x402066..0x4020a2 block #001, object at 0x1b2efa0 under 0x1b2f000, 0 syms/buckets in 0x402066..0x4020a2 block #002, object at 0x1b2ef40 under 0x1b2efa0, 0 syms/buckets in 0x402066..0x4020a2, function _ada_foo, foo block #003, object at 0x1b2ee90 under 0x1b2ef40, 1 syms/buckets in 0x40206f..0x40209a, function b__read_small, b.read_small procedure b.read_small; block object 0x1b2ee90, 0x40206f..0x40209a ... I'm not sure yet if my assert is wrong, and this is expected behaviour, or something needs to be fixed. Filing for further investigation later. --=20 You are receiving this mail because: You are on the CC list for the bug.=