V8 Debugging protocol

59 views
Skip to first unread message

Abhishek Singh

unread,
Jul 28, 2016, 8:44:13 AM7/28/16
to v8-u...@googlegroups.com
Hi,

I’m trying to hook in V8 JSON based debugger into a project. I was able to setup a breakpoint(line: 2 column: 0) against a OnUpdate function, sample function looks like this:

```
function OnUpdate(doc, meta) {
log("doc meta id: ", meta.key);

if (meta.type === "json" && doc.ssn) {
log("doc.ssn field: ", doc.ssn);

updated_doc = CalculateCreditScore(doc)
credit_bucket[meta.key] = updated_doc;

var value = credit_bucket[meta.key];

//delete credit_bucket[meta.key];

var d = new Date();
var n = ISODateString(d);
log("ISO 8601: ", n);

registerCallback("CallbackFunc", meta.key, n);
enqueue(order_queue, meta.key);
}
}
```

Got success message from V8 via sample response like this:

{"seq":1,"request_seq":579,"type":"response","command":"setbreakpoint","success":true,"body":{"type":"scriptId","breakpoint":1,"script_id":37,"line":2,"column":0,"actual_locations":[{"line":3,"column":2,"script_id":37}]},"refs":[],"running":true}

I was hoping given breakpoint is set, "OnUpdate()” execution would be paused unless I explicitly send continue call - but that didn’t happen and it continued business as usual. Is that expected? I’m thinking probably reading up node.js 5.x source for debugger agent, but just asking here in case somebody already knows what I might be missing.

Thanks!
Reply all
Reply to author
Forward
0 new messages