public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.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 [thread overview] Message-ID: <bug-29043-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=29043 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: ... │ 0x5655552d <bar> push %ebp │ │ 0x5655552e <bar+1> mov %esp,%ebp │ │ 0x56555530 <bar+3> call 0x5655557e <__x86.get_pc_thunk.ax> │ │ 0x56555535 <bar+8> add $0x1acb,%eax │ │B+> 0x5655553a <bar+13> push $0x1 │ │ 0x5655553c <bar+15> call 0x5655551d <foo> ... 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=2: cdw=32: lv=2: ldw=32: continue 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=2: cdw=32: lv=2: ldw=32: next to foo (2) ... because the breakpoint ends up before the call to get_pc_thunk: ... │ 0x5655553d <bar> push %ebp │ │ 0x5655553e <bar+1> mov %esp,%ebp │ │B+> 0x56555540 <bar+3> call 0x5655558e <__x86.get_pc_thunk.ax> │ │ 0x56555545 <bar+8> add $0x1abb,%eax │ │ 0x5655554a <bar+13> push $0x1 │ │ 0x5655554c <bar+15> call 0x5655552d <foo> ... 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 rely on the port's prologue skipper, which apparently doesn't handle get_pc_thunk. 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. -- You are receiving this mail because: You are on the CC list for the bug.
reply other threads:[~2022-04-11 5:38 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-29043-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).