Search code examples
gdbv8

How to set a breakpoint in V8 using GDB


I am fairly new to GDB and V8 JavaScript engine.

After compiling shell.cc(/v8/v8-trunk/samples/Shell.cc), I try to set the breakpoint(b Parser::Parser) in parser.cc(/v8/v8-trunk/src), then GDB unexpectedly displays an error message: Can't find member of namespace, class, struct, or union named "Parser::Parser". However, the source code of the method "Parser::Parser" can be found in parser.cc.

Any ideas? thanks.

(gdb) c
Continuing.
V8 version 3.13.1 [sample shell]
> 3+5;
8
> 
Program received signal SIGINT, Interrupt.
0x00752402 in __kernel_vsyscall ()
(gdb) b Parser::Parser
Can't find member of namespace, class, struct, or union named "Parser::Parser"
Hint: try 'Parser::Parser<TAB> or 'Parser::Parser<ESC-?>
(Note leading single quote.)
(gdb)

Solution

  • You need to specify namespaces also. According to parser.cc, Parser::Parser is located inside v8::internal namespace. Try this:

    (gdb) b 'v8::internal::Parser::Parser'