From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7CA72383E822; Thu, 9 Jun 2022 17:09:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7CA72383E822 From: "yangyibiao at nju dot edu.cn" To: gdb-prs@sourceware.org Subject: [Bug symtab/29236] New: wrong mapping between address and source line Date: Thu, 09 Jun 2022 17:09:04 +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: yangyibiao at nju dot edu.cn X-Bugzilla-Status: UNCONFIRMED 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: Thu, 09 Jun 2022 17:09:04 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29236 Bug ID: 29236 Summary: wrong mapping between address and source line Product: gdb Version: HEAD Status: UNCONFIRMED Severity: normal Priority: P2 Component: symtab Assignee: unassigned at sourceware dot org Reporter: yangyibiao at nju dot edu.cn Target Milestone: --- $ gcc --version gcc (GCC) 13.0.0 20220608 (experimental) $ gdb --version GNU gdb (GDB) 13.0.50.20220608-git $ cat small.c char *pa; char *pb; void access (volatile char *ptr) { *ptr =3D 'x'; } int main (int argc, char **argv) { char a, b; pa =3D &a; pb =3D &b; access (pa); access (pb); return 0; } $ gcc -O2 -g small.c; gdb -q a.out Reading symbols from a.out... (gdb) b main Breakpoint 1 at 0x401020: file small.c, line 10. (gdb) r Starting program: /root/a.out Breakpoint 1, main (argc=3D1, argv=3D0x7fffffffe4f8) at small.c:10 10 pa =3D &a; (gdb) s 13 access (pa); (gdb) bt -frame-info location-and-address #0 0x0000000000401025 in main (argc=3D1, argv=3D0x7fffffffe4f8) at small.c= :13 (gdb) maint info line-table objfile: /root/a.out ((struct objfile *) 0x20d7c60) compunit_symtab: small.c ((struct compunit_symtab *) 0x216ac40) symtab: /root/small.c ((struct symtab *) 0x216acc0) linetable: ((struct linetable *) 0x21cb060): INDEX LINE ADDRESS IS-STMT PROLOGUE-END 0 7 0x0000000000401020 Y 1 8 0x0000000000401020 Y 2 10 0x0000000000401020 Y 3 10 0x0000000000401020 4 4 0x0000000000401025 5 10 0x000000000040102a 6 11 0x0000000000401031 Y 7 11 0x0000000000401031 8 13 0x000000000040103d Y 9 4 0x000000000040103d Y 10 4 0x000000000040103d Y 11 4 0x000000000040103d 12 14 0x000000000040103d Y 13 4 0x000000000040103d Y 14 4 0x000000000040103d Y 15 17 0x000000000040103d 16 4 0x000000000040103f 17 4 0x0000000000401044 18 16 0x0000000000401044 Y 19 17 0x0000000000401044 20 END 0x0000000000401045 Y 21 4 0x0000000000401140 Y 22 4 0x0000000000401140 Y 23 4 0x0000000000401140 24 4 0x0000000000401143 25 END 0x0000000000401144 Y (gdb) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D As we can find from the line-table, line 4 is only maps to the address = of 0x0000000000401025 and the "IS-STMT" for line 13 is "Y"(yes).=20 =3D However, the backtrace reports that this address of 0x0000000000401025 = is at line 13 as "#0 0x0000000000401025 in main (argc=3D1, argv=3D0x7fffffffe4f8= ) at small.c:13".=20 =3D I was wondering that this might be a gdb issue.=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --=20 You are receiving this mail because: You are on the CC list for the bug.=