From: Tom Tromey <tom@tromey.com>
To: K via Gdb <gdb@sourceware.org>
Cc: K <cq.personal@gmail.com>
Subject: Re: GDB-JIT: why would my 'unwind' not be invoked on crash?
Date: Tue, 11 Nov 2025 14:26:01 -0700 [thread overview]
Message-ID: <87ikfgxnva.fsf@tromey.com> (raw)
In-Reply-To: <CACTzTFCC64w0HdOxgExRuqN+372N2dRAEe_nG4ri11hJiT-2rA@mail.gmail.com> (K. via Gdb's message of "Tue, 11 Nov 2025 22:43:45 +0100")
>>>>> K via Gdb <gdb@sourceware.org> writes:
> I implemented this for the x86-64 build of my ocaml program and it works
> fine.
> I'm now working on a aarch64 version - the symtable/line and serde code is
> the same, and I'm looking to complete the unwind functionality by
> disovering how to obtain the PC (not in a general register). However, after
> arranging for a segfault
> the unwind function is not being invoked at first and I get 2 backtrace
> listings
> with appropriate function name and line numbers, and only then does gdb
> decide to call my unwind function and it does so with garbage data.
> This is understandable to the extent gdb doesn't know the ocaml stack usage.
> But if that's true, why would it proceed to generate 2 lines of backtrace
> before
> consulting my unwinder to gather the correct data?
> My expectation is it would consult my unwinder immediately.
Could you say more about what exactly you're doing?
Like are you writing an unwinder in gdb? Or writing one in Python?
If so, what prompted this as opposed to using the existing unwinders?
Like, does your compiler not generate DWARF unwind information? (If not
why not, etc.)
Anyway, there's no easy way to answer your question. Unwinding in gdb
is complicated. You could try to enable frame debugging ("set debug
frame 1") and see it says anything interesting. I think it at least
mentions which unwinders it tries.
Personally I guess if I was in your spot, I'd end up debugging the
unwinding code in gdb. If I had to guess, your unwinder is ending up
after one of the built-in ones, and one of those thinks it knows how to
unwind the frame... which could even be kind of true, one of the
difficulties in writing one is knowing when it ought to give up.
Tom
next prev parent reply other threads:[~2025-11-11 21:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-11 21:43 K via Gdb
2025-11-11 21:26 ` Tom Tromey [this message]
2025-11-12 2:00 ` K via Gdb
2025-11-12 15:50 ` Simon Marchi via Gdb
2025-11-14 6:33 ` K via Gdb
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=87ikfgxnva.fsf@tromey.com \
--to=tom@tromey.com \
--cc=cq.personal@gmail.com \
--cc=gdb@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