debug v8 with gdb

1,753 views
Skip to first unread message

Deepak Subramanian

unread,
Jul 17, 2015, 11:59:34 AM7/17/15
to v8-u...@googlegroups.com
Please let me know the best way to debug v8 with gdb. debugging d8 is not helping much.

Thanks

Adrian Perez de Castro

unread,
Jul 18, 2015, 6:48:46 AM7/18/15
to Deepak Subramanian, v8-u...@googlegroups.com

Hello!

Deepak Subramanian <subud...@gmail.com> writes:

> Please let me know the best way to debug v8 with gdb. debugging d8 is not
> helping much.

We do run d8 under GDB in order to debug V8. You will have to build V8
with debugging information, though. There are also a couple of build
options which will add some additional debugging support into V8. This
is the command I use for building:

make -j4 console=readline disassembler=on objectprint=on \
verifyheap=on backtrace=on verifypredictable=on \
gdbjit=off deprecationwarnings=on extrachecks=on \
slowdchecks=on x64.debug

Once you have a debug build of V8, it will be much easier to debug it
using GDB; run it with:

gdb --args ./out/x64.debug/d8

You can source the “tools/gdbinit“, and “tools/gdb-v8-support.py”
scripts in GDB to have some additional debugging commands loaded, for
example, you can use the “job” command to print JavaScript objects — do
check the files to learn more about the rest of commands, they come with
brief descriptions :)

Cheers,

--
⌨ Adrian
signature.asc

Deepak Subramanian

unread,
Jul 18, 2015, 5:11:21 PM7/18/15
to v8-u...@googlegroups.com, subud...@gmail.com
Thanks Adrian,

Is there an equivalent in Ninja build as well ?

This is really useful. Why is gdbjit off ?

Best Regards,
Deepak  Subramanian

Adrian Perez de Castro

unread,
Jul 22, 2015, 3:44:36 PM7/22/15
to Deepak Subramanian, v8-u...@googlegroups.com, subud...@gmail.com
Deepak Subramanian <subud...@gmail.com> writes:

> Thanks Adrian,

You're welcome :)

> Is there an equivalent in Ninja build as well ?

Yes, there is. You can do something like:

% export GYP_GENERATORS=ninja \
./build/gyp_v8 -Dv8_enable_disassembler=1 \
-Dv8_enable_backtrace=1 \
-Dv8_enable_gdbjit=1 \
-Dv8_enable_verify_heap=1 \
-Dv8_enable_object_print=1 && ninja

> This is really useful. Why is gdbjit off ?

Most of the time I don't use/need it. Feel free to enable it. It uses
the GDB JIT interface [1] to register JITed code into GDB, and make GDB
treat it a bit better.

Cheers,


--
⌨ Adrian

---
[1] https://www.sourceware.org/gdb/onlinedocs/gdb/JIT-Interface.html
signature.asc

Felix

unread,
Jul 27, 2015, 10:46:23 PM7/27/15
to v8-users, subud...@gmail.com, ape...@igalia.com
Hi,
    Is there a way to debug v8 runtime functions with eclipse CDT? 


在 2015年7月23日星期四 UTC+8上午3:44:36,Adrian Perez de Castro写道:
Reply all
Reply to author
Forward
0 new messages