OLD | NEW |
(Empty) | |
| 1 # Prerequisites |
| 2 |
| 3 * V8 3.0.9 or newer |
| 4 * GDB 7.0 or newer |
| 5 * Linux OS |
| 6 * CPU with Intel-compatible architecture (ia32 or x64) |
| 7 |
| 8 # Introduction |
| 9 |
| 10 GDB JIT interface integration allows V8 to provide GDB with the symbol and debug
ging information for a native code emitted in runtime. |
| 11 |
| 12 When GDB JIT interface is disabled a typical backtrace in GDB will contain frame
s marked with ??. This frames correspond to dynamically generated code: |
| 13 |
| 14 ``` |
| 15 #8 0x08281674 in v8::internal::Runtime_SetProperty (args=...) at src/runtime.cc
:3758 |
| 16 #9 0xf5cae28e in ?? () |
| 17 #10 0xf5cc3a0a in ?? () |
| 18 #11 0xf5cc38f4 in ?? () |
| 19 #12 0xf5cbef19 in ?? () |
| 20 #13 0xf5cb09a2 in ?? () |
| 21 #14 0x0809e0a5 in v8::internal::Invoke (construct=false, func=..., receiver=...,
argc=0, args=0x0, |
| 22 has_pending_exception=0xffffd46f) at src/execution.cc:97 |
| 23 ``` |
| 24 |
| 25 However enabling GDB JIT integration allows GDB to produce more informative stac
k trace: |
| 26 |
| 27 ``` |
| 28 #6 0x082857fc in v8::internal::Runtime_SetProperty (args=...) at src/runtime.cc
:3758 |
| 29 #7 0xf5cae28e in ?? () |
| 30 #8 0xf5cc3a0a in loop () at test.js:6 |
| 31 #9 0xf5cc38f4 in test.js () at test.js:13 |
| 32 #10 0xf5cbef19 in ?? () |
| 33 #11 0xf5cb09a2 in ?? () |
| 34 #12 0x0809e1f9 in v8::internal::Invoke (construct=false, func=..., receiver=...,
argc=0, args=0x0, |
| 35 has_pending_exception=0xffffd44f) at src/execution.cc:97 |
| 36 ``` |
| 37 |
| 38 Frames still unknown to GDB correspond to native code without source information
. See [GDBJITInterface#KnownLimitations](GDBJITInterface#KnownLimitations.md) fo
r more details. |
| 39 |
| 40 GDB JIT interface is specified in the GDB documentation: http://sourceware.org/g
db/current/onlinedocs/gdb/JIT-Interface.html |
| 41 |
| 42 # Enabling GDB JIT integration |
| 43 |
| 44 GDBJIT currently is by default excluded from the compilation and disabled in run
time. To enable it: |
| 45 |
| 46 1. Build V8 library with `ENABLE_GDB_JIT_INTERFACE` defined. If you are using
scons to build V8 run it with `gdbjit=on`. |
| 47 1. Pass `--gdbjit` flag when starting V8. |
| 48 |
| 49 To check that you have enabled GDB JIT integration correctly try setting breakpo
int on `__jit_debug_register_code`. This function will be invoked to notify GDB
about new code objects. |
| 50 |
| 51 # Known Limitations |
| 52 |
| 53 * GDB side of JIT Interface currently (as of GDB 7.2) does not handle registra
tion of code objects very effectively. Each next registration takes more time: w
ith 500 registered objects each next registration takes more than 50ms, with 100
0 registered code objects - more than 300 ms. This problem was reported to GDB d
evelopers (http://sourceware.org/ml/gdb/2011-01/msg00002.html) but currently the
re is no solution available. To reduce pressure on GDB current implementation of
GDB JIT integration operates in two modes: _default_ and _full_ (enabled by `--
gdbjit-full` flag). In _default_ mode V8 notifies GDB only about code objects th
at have source information attached (this usually includes all user scripts). In
_full_ - about all generated code objects (stubs, ICs, trampolines). |
| 54 |
| 55 * On x64 GDB is unable to properly unwind stack without `.eh_frame` section (I
ssue 1053 (on Google Code)) |
| 56 |
| 57 * GDB is not notified about code deserialized from the snapshot (Issue 1054 (o
n Google Code)) |
| 58 |
| 59 * Only Linux OS on Intel-compatible CPUs is supported. For different OSes eith
er a different ELF-header should be generated or a completely different object f
ormat should be used. |
| 60 |
| 61 * Enabling GDB JIT interface disables compacting GC. This is done to reduce pr
essure on GDB as unregistering and registering each moved code object will incur
considerable overhead. |
| 62 |
| 63 * GDB JIT integration provides only _approximate_ source information. It does
not provide any information about local variables, function's arguments, stack l
ayout etc. It does not enable stepping through JavaScript code or setting breakp
oint on the given line. However one can set a breakpoint on a function by it's n
ame. |
OLD | NEW |