[fpc-devel] A little something I've been working on...
mailinglists at geldenhuys.co.uk
mailinglists at geldenhuys.co.uk
Sat Feb 21 19:26:14 CET 2026
On 2026-02-21 17:36, Martin Frb via fpc-devel wrote:
> My earlier point on "stack resolution" wasn't fully answered though.
> How to you encode: How to find the address of the parent stack frame?
You raise a valid point. My current implementation relies on frame
pointers (RBP chain) being present -- [RBP] gives the parent frame,
[RBP+8] gives the return address. This works reliably for FPC-compiled
x86/x86_64 code because FPC generates frame pointers for all functions
by default, and you only lose them with explicit -Oo optimisations,
which are uncommon in debug builds. However, I am aware this will not
work for all architectures. I only have access to x86/x86_64 systems
at this time.
Also, it does break in the cases you describe: frame pointer omission,
function prologue before the frame is set up, or callstacks passing
through external C code compiled without frame pointers. DWARF handles
this with .debug_frame / .eh_frame unwind tables that describe frame
resolution rules at every instruction boundary.
OPDF does not have an equivalent today -- but it is not a design
constraint. The format is extensible, and unwind information (a
recUnwindInfo record mapping address ranges to frame resolution rules)
can be added when the need arises.
At this point I'm focused on debugging FPC-compiled code rather
than mixed-language stacks.
Regards,
- Graeme -
More information about the fpc-devel
mailing list