From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 273A33858D39; Sat, 20 Jan 2024 16:19:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 273A33858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1705767580; bh=r5wmA/Sg8Fv+eu/JGgGnzKaHh6XVJK47jGvsTOqcETI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=FC1FbokPsw8ynAkh8FukWa189C4TQ5RYJRABXN+9bRQl5AnBhWny/IyUNjmAQAvCv a7D6if0R5XogaW1kw/AGcuHdx6NPvSDggXrU29coc6sNpLWQslmLmH+m9WExRyeYsU ecafrofceXvLblA3JIiaPQB4y6HTGMmiggxkHhDk= From: "ssbssa at sourceware dot org" To: gdb-prs@sourceware.org Subject: [Bug gdb/30315] GDB not showing variable that is supposed to be there Date: Sat, 20 Jan 2024 16:19:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 13.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ssbssa at sourceware dot 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: cc 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=3D30315 Hannes Domani changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ssbssa at sourceware dot o= rg --- Comment #2 from Hannes Domani --- I've debugged it to this location of read_lexical_block_scope in dwarf2/rea= d.c: ``` case PC_BOUNDS_NOT_PRESENT: /* DW_TAG_lexical_block has no attributes, process its children as if there was no wrapping by that DW_TAG_lexical_block. GCC does no longer produces such DWARF since GCC r224161. */ ``` The inner { int i; } block is optimized away, and apparently gcc produces this kind of block here in this case. Which means gdb moves up the i variable to the for{} block, and that's why it's found by print. As a test I've just put a return in this case block, then gdb found the correct i also in this location: ``` (gdb) n 12 b =3D 0; (gdb) p i $2 =3D 4 (gdb) info addr i Symbol "i" is multi-location: Base address 0x140001609 Range 0x13f2e1609-0x13f2e1609: the constant 0 Range 0x13f2e1609-0x13f2e1609: the constant 1 Range 0x13f2e1609-0x13f2e1609: the constant 2 Range 0x13f2e1609-0x13f2e1609: the constant 3 Range 0x13f2e1609-0x13f2e161c: the constant 4 ``` I'm not sure what the correct solution here is. --=20 You are receiving this mail because: You are on the CC list for the bug.=