JIT Interface (Debugging with ROCGDB)

Next: In-Process Agent, Previous: Annotations, Up: Top [Contents][Index]

## 30 JIT Compilation Interface

This chapter documents ROCGDB’s just-in-time (JIT) compilation interface. A JIT compiler is a program or library that generates native executable code at runtime and executes it, usually in order to achieve good performance while maintaining platform independence.

Programs that use JIT compilation are normally difficult to debug because portions of their code are generated at runtime, instead of being loaded from object files, which is where ROCGDB normally finds the program’s symbols and debug information. In order to debug programs that use JIT compilation, ROCGDB has an interface that allows the program to register in-memory symbol files with ROCGDB at runtime.

If you are using ROCGDB to debug a program that uses this interface, then it should work transparently so long as you have not stripped the binary. If you are developing a JIT compiler, then the interface is documented in the rest of this chapter. At this time, the only known client of this interface is the LLVM JIT.

Broadly speaking, the JIT interface mirrors the dynamic loader interface. The JIT compiler communicates with ROCGDB by writing data into a global variable and calling a function at a well-known symbol. When ROCGDB attaches, it reads a linked list of symbol files from the global variable to find existing code, and puts a breakpoint in the function so that it can find out about additional code.

Next: In-Process Agent, Previous: Annotations, Up: Top [Contents][Index]