Reputation: 377
I was trying to print out the v8::Local
object content, with either of v8/tools/gdbinit
and v8/tools/lldb_commands.py
helper scripts, I got Empty Line
OR Syntax Error
messages. Is there anything I've missed? So my question is how can we print the v8::Local
object content?
Most of configurations are from official embed tutorial (https://v8.dev/docs/embed), without any single line of modification. Here are some details:
### Compile & Link
$ g++ -I. -Iinclude samples/hello-world.cc -o hello_world -lv8_monolith -ldl -Lout.gn/x64.release.sample/obj/ -pthread -std=c++14 -DV8_COMPRESS_POINTERS -g
### Debug
$ gdb -x tools/gdbinit ./hello_world
(gdb) p result
$1 = {val_ = 0x55d4f7a35408}
(gdb) jlh result
A syntax error in expression, near `)(result).val_))'.
### Compile & Link
$ g++ -I. -Iinclude samples/hello-world.cc -o hello_world -lv8_monolith -Lout.gn/x64.release.sample/obj/ -pthread -std=c++14 -DV8_COMPRESS_POINTERS -g
### Debug
$ lldb ./hello_world
(lldb) command script import tools/lldb_commands.py
(lldb) b hello-world.cc:56
(lldb) r
(lldb) p *utf8
(char *) $0 = 0x0000000102302590 "Hello, World!"
(lldb) p result
(v8::Local<v8::Value>) $1 = (val_ = 0x0000000102815668)
(lldb) jlh result
(lldb)
Upvotes: 0
Views: 445
Reputation: 40561
For debugging, try using a debug build: use gn args <your_output_dir>
to set is_debug = true
, then recompile.
If you insist on debugging release-mode binaries, you can enable jlh
and friends with the v8_enable_object_print = true
GN arg, but your experience will likely be weird in other ways (e.g. stepping and breakpoints won't be reliable, many values will be <optimized out>
, etc.).
Upvotes: 1