From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D85983858412; Sun, 13 Aug 2023 12:08:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D85983858412 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1691928501; bh=2IMIKFJd8/KiUiG7b7J7AKrDl5Qb6p/lh18TBLZ2qEA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UkgfZ5DIUZxWvnM/xZ2A9SF1rguWX1S9/La0nYWrro4bn9TExZ/eok8M8ORi3aIhv g6eJbaENZXZ/re5Yq/aVYew9LDD+Huowu+nSzMMO3WGnkyYExZT0coqb1RfaiMe3nv 4YTz8DGBxy9dx5KICGk1Zdl/zNhAKEFHj/Ouhg6g= From: "cvs-commit at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug symtab/30720] [gdb/symtab, gdb-index] FAIL: gdb.python/py-symbol.exp: print (len (gdb.lookup_static_symbols ('rr'))) Date: Sun, 13 Aug 2023 12:08:20 +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: cvs-commit 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 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30720 --- Comment #2 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by Tom de Vries : https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Daef36dee93bf= 194cb0b976a4ae49a79a736a188d commit aef36dee93bf194cb0b976a4ae49a79a736a188d Author: Tom de Vries Date: Sun Aug 13 14:08:06 2023 +0200 [gdb/symtab] Don't deduplicate variables in gdb-index When running test-case gdb.python/py-symbol.exp with target board cc-with-gdb-index, we run into: ... (gdb) python print (len (gdb.lookup_static_symbols ('rr')))^M 1^M (gdb) FAIL: gdb.python/py-symbol.exp: print (len (gdb.lookup_static_sym= bols ('rr'))) ... [ Note that the test-case contains rr in both py-symtab.c: ... static int __attribute__ ((used)) rr =3D 42; /* line of rr */ ... and py-symtab-2.c: ... static int __attribute__ ((used)) rr =3D 99; /* line of other rr */ ... ] This passes with gdb-12-branch, and fails with gdb-13-branch. AFAIU the current code in symtab_index_entry::minimize makes the assump= tion that it's fine to store only one copy of rr in the gdb-index, because "print rr" will only ever print one, and always the same. But that fails to recognize that gdb supports gdb.lookup_static_symbols, which returns a list of variables rather than the first one. In other words, the current approach breaks feature parity between cook= ed index and gdb-index. Note btw that also debug-names has both instances: ... [ 5] #00597969 rr: <4> DW_TAG_variable DW_IDX_compile_unit=3D3 DW_IDX_GNU_internal= =3D1 <4> DW_TAG_variable DW_IDX_compile_unit=3D4 DW_IDX_GNU_internal= =3D1 ... Fix this in symtab_index_entry::minimize, by not deduplicating variable= s. Tested on x86_64-linux, with target boards unix and cc-with-gdb-index. Reviewed-by: Kevin Buettner PR symtab/30720 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30720 --=20 You are receiving this mail because: You are on the CC list for the bug.=