GDB-JIT: why would my 'unwind' not be invoked on crash?

K via Gdb <[email protected]> Tue, 11 Nov 2025 22:43:45 +0100
Newsgroups gmane.comp.gdb.devel
Message-ID <CACTzTFCC64w0HdOxgExRuqN+372N2dRAEe_nG4ri11hJiT-2rA@mail.gmail.com>
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.

By the way, there is no frame pointing register used in the ocaml compiler
I'm using.

Any insights appreciated!