From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4FDBB385840C; Wed, 6 Sep 2023 10:23:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4FDBB385840C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1693995813; bh=IZj4m2y3z9GPNK9gT59zUPEMLQBGi6+6gXvIP9EjMVY=; h=From:To:Subject:Date:From; b=R+LfxZwHNducGmvNP/FHR9Aa4wgmcvxoQ6oXYzM1uGU2gYrzW4+grmaKungFY1PiW 1/yo9MxQTfYVVJj/ef3CpG9Okd39jGnYDSKpbFiMbHxxiQvAJZ2tevRpzjBIm5gOwk AuUD0qWHv90V3mgXu//f6NGIUqlCQJRD2jSC7eRY= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug symtab/30826] New: [gdb/symtab] Review PU presence in objfile->compunits () Date: Wed, 06 Sep 2023 10:23:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: 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 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30826 Bug ID: 30826 Summary: [gdb/symtab] Review PU presence in objfile->compunits () Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: symtab Assignee: unassigned at sourceware dot org Reporter: vries at gcc dot gnu.org Target Milestone: --- [ First discussed here ( https://sourceware.org/pipermail/gdb-patches/2023-September/202161.html ) ] The PUs are part of the linked list objfile->compunits (), and I've recently committed a few fixes that skip PUs when walking the linked list: ... $ git log --pretty=3Dcommit HEAD^^..HEAD commit e061219f5d6 ("[gdb/symtab] Fix too many symbols in gdbpy_lookup_static_symbols") commit 7023b8d86c6 ("[gdb/symtab] Handle PU in iterate_over_some_symtabs") ... The question is whether we can just drop the PUs from the linked list. [ On a related note, I've been wondered about adding a sorted vector alongs= ide objfile->compunits (), which is sorted according to file offset, to address= the "insertion-order is search-order" problem. If we would add such a vector, = and do all searches on it instead of the linked list, then rather than deleting= PUs from the linked list, we could not add them to the vector, which is slightly easier. ] Testing a WIP patch (see the gdb-patches thread mentioned above) revealed regressions in gdb.cp/m-static.exp, where lookup_symbol_in_objfile_symtabs walks the linked list but doesn't walk the corresponding includes for each = CU. However, it could be argued that the current way of visiting PUs is more efficient. It guarantees that PUs are visited only once, and if we visit a= ll includes for each CU, then a PU might be visited twice. Note how the efficient approach differs depending on whether we lookup one match or all matches: - if we lookup one match, we want to not skip PUs, but skip includes, and - if we lookup all matches, we want to skip PUs, but not skip includes. In the former case, when finding the match in a PU, it's virtually a match = in the top-level canonical includer CU (the one you get when walking the user chain to the top). In the latter case, a PU can be visited more than once, which is potentially inefficient. This could be addressed with caching, perhaps this is already done. --=20 You are receiving this mail because: You are on the CC list for the bug.=