public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "amonakov at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug backtrace/30929] New: 'frame function' fails when call is the last instruction
Date: Sun, 01 Oct 2023 15:51:45 +0000	[thread overview]
Message-ID: <bug-30929-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=30929

            Bug ID: 30929
           Summary: 'frame function' fails when call is the last
                    instruction
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: backtrace
          Assignee: unassigned at sourceware dot org
          Reporter: amonakov at gmail dot com
  Target Milestone: ---

int main()
{
        __builtin_abort();
}

gcc -g test.c

gdb ./a.out

(gdb) start
Temporary breakpoint 1 at 0x40113a: file t.c, line 3.

Temporary breakpoint 1, main () at t.c:3
3               __builtin_abort();
(gdb) f f main
#0  main () at t.c:3
3               __builtin_abort();
(gdb) c
Continuing.

Program received signal SIGABRT, Aborted.
0x00007ffff7e4d47c in __pthread_kill_implementation () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff7e4d47c in __pthread_kill_implementation () from
/lib64/libc.so.6
#1  0x00007ffff7dfae16 in raise () from /lib64/libc.so.6
#2  0x00007ffff7de389c in abort () from /lib64/libc.so.6
#3  0x000000000040113f in main () at t.c:3
(gdb) f f main
No frame for function "main".


Compiling to an intermediate assembly file and adding a nop after 'call abort'
is sufficient to make it work. Apparently 'frame function' doesn't work in the
corner case when return address is exactly past the end of a function (the last
instruction was a call).

In practice this breaks the following snippet:

catch signal SIGABRT
commands
f f __assert_fail
up
end

which is supposed to automatically select the frame of the failing assert.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2023-10-01 15:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-01 15:51 amonakov at gmail dot com [this message]
2023-10-01 16:40 ` [Bug backtrace/30929] " tromey at sourceware dot org
2023-10-01 17:13 ` amonakov at gmail dot com
2023-10-06 12:33 ` tromey at sourceware dot org
2024-01-10 20:10 ` tromey at sourceware dot org

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-30929-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: link
Be 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).