29.4 Custom Debug Info

Generating debug information in platform-native file formats (like ELF or COFF) may be an overkill for JIT compilers; especially if all the debug info is used for is displaying a meaningful backtrace. The issue can be resolved by having the JIT writers decide on a debug info format and also provide a reader that parses the debug info generated by the JIT compiler. This section gives a brief overview on writing such a parser. More specific details can be found in the source file gdb/jit-reader.in, which is also installed as a header at includedir/gdb/jit-reader.h for easy inclusion.

The reader is implemented as a shared object (so this functionality is not available on platforms which don’t allow loading shared objects at runtime). Two GDB commands, jit-reader-load and jit-reader-unload are provided, to be used to load and unload the readers from a preconfigured directory. Once loaded, the shared object is used the parse the debug information emitted by the JIT compiler.

Using JIT Debug Info Readers:    How to use supplied readers correctly
Writing JIT Debug Info Readers:    Creating a debug-info reader