From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C163B385782D; Mon, 11 Apr 2022 05:38:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C163B385782D From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug tdep/29043] New: [gdb, i386, pie] Prologue skipper does not skip get_pc_thunk Date: Mon, 11 Apr 2022 05:38:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: tdep 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 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: Mon, 11 Apr 2022 05:38:01 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29043 Bug ID: 29043 Summary: [gdb, i386, pie] Prologue skipper does not skip get_pc_thunk Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: tdep Assignee: unassigned at sourceware dot org Reporter: vries at gcc dot gnu.org Target Milestone: --- Consider function bar in test-case gdb/testsuite/gdb.dwarf2/dw2-lines.c: ... void bar (void) { asm ("bar_label: .globl bar_label"); foo (1); asm ("bar_label_2: .globl bar_label_2"); foo (2); asm ("bar_label_3: .globl bar_label_3"); foo (3); asm ("bar_label_4: .globl bar_label_4"); foo (4); asm ("bar_label_5: .globl bar_label_5"); } ... When compiled for m32/pie: ... $ gcc src/gdb/testsuite/gdb.dwarf2/dw2-lines.c -g -m32 -fPIE -pie ... and setting a breakpoint at bar: ... =E2=94=82 0x5655552d push %ebp=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20 =E2=94=82 =E2=94=82 0x5655552e mov %esp,%ebp=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 =E2=94=82 =E2=94=82 0x56555530 call 0x5655557e <__x86.get_pc_thunk.= ax>=20=20=20=20=20=20=20=20=20 =E2=94=82 =E2=94=82 0x56555535 add $0x1acb,%eax=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 =E2=94=82 =E2=94=82B+> 0x5655553a push $0x1=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20 =E2=94=82 =E2=94=82 0x5655553c call 0x5655551d =20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 ... we see that it ends up after the get_pc_thunk, so apparently, with regular debug info available, this is considered part of the prologue. But when running the test-case, so with synthetic debug info, we run into a FAIL: ... Breakpoint 2, 0x56555540 in bar ()^M (gdb) PASS: gdb.dwarf2/dw2-lines.exp: cv=3D2: cdw=3D32: lv=3D2: ldw=3D32: c= ontinue to breakpoint: foo \(1\) next^M Single stepping until exit from function bar,^M which has no line number information.^M 0x56555587 in main ()^M (gdb) FAIL: gdb.dwarf2/dw2-lines.exp: cv=3D2: cdw=3D32: lv=3D2: ldw=3D32: n= ext to foo (2) ... because the breakpoint ends up before the call to get_pc_thunk: ... =E2=94=82 0x5655553d push %ebp=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20 =E2=94=82 =E2=94=82 0x5655553e mov %esp,%ebp=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 =E2=94=82 =E2=94=82B+> 0x56555540 call 0x5655558e <__x86.get_pc_thunk.= ax>=20=20=20=20=20=20=20=20=20 =E2=94=82 =E2=94=82 0x56555545 add $0x1abb,%eax=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 =E2=94=82 =E2=94=82 0x5655554a push $0x1=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20 =E2=94=82 =E2=94=82 0x5655554c call 0x5655552d =20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 ... which is in a part that the synthetic debug info doesn't provide line number information for, hence the FAIL. AFAIU, the synthetic debug info is incomplete and therefore gdb needs to re= ly on the port's prologue skipper, which apparently doesn't handle get_pc_thun= k. The test-case itself is not meant to test this behaviour, and can be fixed = by setting a breakpoint on bar_label instead of bar. --=20 You are receiving this mail because: You are on the CC list for the bug.=