GDB JIT Compilation Interface integration

GDB JIT Compilation Interface integration allows V8 to provide GDB with the symbol and debugging information for native code emitted from the V8 runtime.

When GDB JIT Compilation Interface is disabled a typical backtrace in GDB contains frames marked with ??. These frames correspond to dynamically generated code:

#8  0x08281674 in v8::internal::Runtime_SetProperty (args=...) at src/runtime.cc:3758
#9  0xf5cae28e in ?? ()
#10 0xf5cc3a0a in ?? ()
#11 0xf5cc38f4 in ?? ()
#12 0xf5cbef19 in ?? ()
#13 0xf5cb09a2 in ?? ()
#14 0x0809e0a5 in v8::internal::Invoke (construct=false, func=..., receiver=..., argc=0, args=0x0,
    has_pending_exception=0xffffd46f) at src/execution.cc:97

However enabling GDB JIT Compilation Interface allows GDB to produce more informative stack trace:

#6  0x082857fc in v8::internal::Runtime_SetProperty (args=...) at src/runtime.cc:3758
#7  0xf5cae28e in ?? ()
#8  0xf5cc3a0a in loop () at test.js:6
#9  0xf5cc38f4 in test.js () at test.js:13
#10 0xf5cbef19 in ?? ()
#11 0xf5cb09a2 in ?? ()
#12 0x0809e1f9 in v8::internal::Invoke (construct=false, func=..., receiver=..., argc=0, args=0x0,
    has_pending_exception=0xffffd44f) at src/execution.cc:97

Frames still unknown to GDB correspond to native code without source information. See known limitations for more details.

GDB JIT Compilation Interface is specified in the GDB documentation: https://sourceware.org/gdb/current/onlinedocs/gdb/JIT-Interface.html

Prerequisites #

Enabling GDB JIT Compilation Interface #

GDB JIT Compilation Interface is currently excluded from the compilation by default and disabled in runtime. To enable it:

  1. Build V8 library with ENABLE_GDB_JIT_INTERFACE defined. If you are using scons to build V8 run it with gdbjit=on.
  2. Pass --gdbjit flag when starting V8.

To check that you have enabled GDB JIT integration correctly try setting a breakpoint on __jit_debug_register_code. This function is invoked to notify GDB about new code objects.

Known limitations #