From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B5D633858CDA; Tue, 9 Apr 2024 06:59:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B5D633858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1712645957; bh=P5+Ob4ufRYJEhJ4rUtVh7Vet9MrIppp+kJ+d3O1r+dg=; h=From:To:Subject:Date:From; b=KLqCP6A77hO3fqvrHeDZ15Zt9aNV3txmHiYebB4YurWbOROMvD6EUyOTPY+DdCWov c4NLAwUhjHfcxVPuxgPc6eqKCngBDmKQjfQDvq6FHS8v24Ed9oG+ZukZbDTlb4xvvl DvobaNs/38F7hs/wjAc3Gioo94iQUKSfEwy0Y4xk= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug symtab/31622] New: [gdb/symtab] find_epilogue_using_linetable fails to find entry in function with two linetables Date: Tue, 09 Apr 2024 06:59:17 +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=3D31622 Bug ID: 31622 Summary: [gdb/symtab] find_epilogue_using_linetable fails to find entry in function with two linetables 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: --- Bernd Edlinger reported the following problem and fix in find_epilogue_using_linetable ( https://sourceware.org/pipermail/gdb-patches/2024-April/207928.html ). This came up in a discussion for a patch for PR31268, but it's an independe= nt issue. Consider the following test-case: ... $ cat hello.c=20 #include int main() { printf("hello "); #include "world.inc" /*** End of hello.c ***/ $ cat world.inc=20 printf("world\n"); return 0; } /*** End of world.inc ***/ $ gcc -g -o hello hello.c ... The corresponding disassembly for main is: ... 0000000000400557
: 400557: 55 push %rbp 400558: 48 89 e5 mov %rsp,%rbp 40055b: bf 24 06 40 00 mov $0x400624,%edi 400560: b8 00 00 00 00 mov $0x0,%eax 400565: e8 f6 fe ff ff call 400460 40056a: bf 2b 06 40 00 mov $0x40062b,%edi 40056f: e8 dc fe ff ff call 400450 400574: b8 00 00 00 00 mov $0x0,%eax 400579: 5d pop %rbp 40057a: c3 ret ... And the corresponding line table is: ... hello.c: File name Line number Starting address View Stmt hello.c 3 0x400557 x hello.c 4 0x40055b x ./world.inc:[++] world.inc 1 0x40056a x world.inc 2 0x400574 x world.inc 3 0x400579 x world.inc - 0x40057b ... Now, say we have an epilogue_begin marker at 0x400579 in world.inc. We won't find it using find_epilogue_using_linetable, because it does: ... const struct symtab_and_line sal =3D find_pc_line (start_pc, 0); ... which gets us the line table for hello.c. Proposed patch: ... - const struct symtab_and_line sal =3D find_pc_line (start_pc, 0); + const struct symtab_and_line sal =3D find_pc_line (end_pc - 1, 0); ... which gets us the linetable for world.inc instead. --=20 You are receiving this mail because: You are on the CC list for the bug.=