Skip to content

x86: support stack unwinding on Windows

amyspark requested to merge amyspark/orc:pr-implement-backtracing-windows into main

Hi,

This PR addresses a longstanding nagging point when debugging a crash in JIT code under Windows: unless you have logging enabled, there was simply no way to chain the stacktrace bfrom JIT to C-land, leaving a debugger alone in the literal no-man's land.

To do so, I implemented the frame pointer unwinding handler required by https://learn.microsoft.com/en-us/cpp/build/exception-handling-x64 . When the frame pointer is required, this changes RBP to be an invalid register, and supplies Windows with a per-chunk (or per-page; see !178) thunk that will protect each program. This thunk does not do anything at present, just tells the OS to keep walking the stack. This ensures that Windows knows about Orc functions' prologue and is able to unwind it.

Let me know what you think.

Merge request reports

Loading