Attaching debugger to embedded v8

149 views
Skip to first unread message

Neil Moore

unread,
Jun 30, 2016, 11:05:13 AM6/30/16
to v8-users
It says here that "The message based API is no longer maintained.". Does that mean that entering JSON commands via v8::Debug::SendCommand is no longer supported, or is the message based API something else? I don't have any historical context with v8 so I am not sure.

Nevertheless in the version of the source I have I have attempted to use v8::Debug::SendCommand. I am attempting to let my embedded v8 communicate with node-inspector over a socket. I have so far got the following JSON command after trimming off "Content-Length: 173\r\n\r\n":

"{"seq":22,"type":"request","command":"evaluate","arguments":{"expression":"JSON.stringify(process.version).match(/.{1,80}/g).slice()","global":true,"maxStringLength":10000}}"


Then I pass it to v8 with v8::Debug::SendCommand.


However I don't get any call back on the handler I registered with v8::Debug::SetMessageHandler


I appreciate that I haven't given a lot of code, but is the general approach I am taking expected to work or is this the thing that's not maintained?




Neil


Ben Noordhuis

unread,
Jun 30, 2016, 3:34:32 PM6/30/16
to v8-users
It's the thing that is not maintained but it still works well enough
in V8 5.0 and 5.1 that node.js can use it. Try passing
--trace_debug_json to V8.

Neil Moore

unread,
Jul 1, 2016, 3:18:22 AM7/1/16
to v8-users
On Thursday, 30 June 2016 20:34:32 UTC+1, Ben Noordhuis wrote:
It's the thing that is not maintained but it still works well enough
in V8 5.0 and 5.1 that node.js can use it.  Try passing
--trace_debug_json to V8.

Thanks for that. Sorry to be a pest, I turn that on but I don't see any standard output or output files in any obvious location (i.e. in ~/Library/Logs on my Mac or next to the binary). What would the trace output look like and does it go to standard output?


Ben Noordhuis

unread,
Jul 1, 2016, 5:46:51 AM7/1/16
to v8-users
You should see gobs of JSON get printed to stdout. Maybe try
programmatically feeding JSON into v8::Debug::SendCommand() and see if
anything gets printed.
Reply all
Reply to author
Forward
0 new messages