From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B8CA7385800F; Wed, 9 Nov 2022 02:28:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B8CA7385800F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667960905; bh=/ZX/gIXk59lwEpEybEDCn2i0SsZZsw6adqmh9HwGKKk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=HXh7M/l4F9q8R0rBvrB7wguq/Ys2l1s16DFwSN9rcHkQ33fA07iXPlfD8sMNq1XCv aSMIsXJa/O3ap4/+r2gjcU6c0AxojwJVSzNWtO09OH+Sl25nvhvtcvaFPuwSy4rcP9 9xc/Cka3eViF2QxQ5iVU/fnj4HU/LkFlZ/wTQS+U= From: "tromey at sourceware dot org" To: gdb-prs@sourceware.org Subject: [Bug symtab/26061] Wrong debug info for argc at -O2 Date: Wed, 09 Nov 2022 02:28:24 +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: tromey at sourceware dot org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: NOTABUG 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_status resolution 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=3D26061 Tom Tromey changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |NOTABUG --- Comment #5 from Tom Tromey --- I can reproduce this with the attached a.out and with git master gdb. Here's an informative transcript: (gdb) info addr argc Symbol "argc" is multi-location: Range 0x401040-0x401061: a variable in $rdi Range 0x401061-0x401069: a complex DWARF expression: 0: DW_OP_GNU_entry_value 2: DW_OP_reg5 [$rdi] 3: DW_OP_stack_value . (gdb) p $pc $4 =3D (void (*)()) 0x401040
(gdb) p argc $5 =3D 1 (gdb) step 6 in small.c (gdb) p $pc $6 =3D (void (*)()) 0x40105d (gdb) p argc $7 =3D -7062 (gdb) p $rdi $8 =3D 140737488348266 (gdb) p/x $rdi $9 =3D 0x7fffffffe46a (gdb) p/x argc $10 =3D 0xffffe46a Here you can see that the debuginfo claims that 'argc' is held in '$rdi' for this PC range. However, this isn't true -- rdi changes to some other value even though PC is still in that range. Based on this I think this is a compiler bug and not a gdb bug. There's nothing gdb can do to correct this kind of problem. I'm going to close this. --=20 You are receiving this mail because: You are on the CC list for the bug.=