Was able to solve the problem I had. Just thought of sharing sample standalone 
code based on C++ api in case anyone else on v8-users group wanted to have 
initial understanding of V8 debugger protocol - 
https://github.com/abhi-bit/v8_debugging_progs/blob/master/breakpoint_simulation.cc

> On 04-Aug-2016, at 3:59 PM, Ben Noordhuis <i...@bnoordhuis.nl> wrote:
> 
> On Thu, Aug 4, 2016 at 12:01 PM, Abhishek Singh
> <singhabhishek....@gmail.com> wrote:
>> Appreciate your help so far.
>> 
>> Sample user JS code[0] looks like this now:
>> 
>> {code}
>> function OnUpdate(doc, meta) {
>>  log("doc meta id: ", meta.key);
>> 
>>  if (meta.type === "json" && doc.ssn) {
>>  ..
>>  ..
>>   }
>> }
>> 
>> Debug = debug.Debug;
>> log(Debug.showBreakPoints(OnUpdate));
>> 
>> Function OnDelete() {}
>> // more functions
>> {code}
>> 
>> ===
>> 
>> 
>> * Fired command:
>> 
>> {"command": "setbreakpoint", "type": "request", "arguments": {"type": 
>> "function", "target": "OnUpdate"}, "seq": 862}
>> 
>> * show.BreakPoints(“OnUpdate”) dumps the function definition:
>> 
>> "(doc, meta) {\n  log(\"doc meta id: \", meta.key);\n\n  if (meta.type === 
>> \"json\" ) {\n    log(\"doc.ssn field: \", doc.ssn);\n\n    updated_doc = 
>> CalculateCreditScore(doc)\n    credit_bucket[meta.key] = updated_doc;\n\n    
>> var value = credit_bucket[meta.key];\n\n    //delete 
>> credit_bucket[meta.key];\n\n    var d = new Date();\n    var n = 
>> ISODateString(d);\n    log(\"ISO 8601: \", n);\n\n    
>> registerCallback(\"CallbackFunc1\", meta.key, n);\n    
>> order_queue[meta.key];\n  }\n}"
>> 
>> I guess it confirms that breakpoint has been set using C++ apis
> 
> The breakpoint should show up as a statement prefixed with [B0].  I
> don't see it so it looks like setting it failed somehow.
> 
>> ===
>> 
>> One new problem that I see now, when I’ve :
>> 
>> {code}
>> Debug = debug.Debug;
>> log(Debug.showBreakPoints(OnUpdate));
>> {code}
>> 
>> as part of user JS code, I see a crash from V8 when “Call” to “OnUpdate”[1] 
>> is made . All I get from V8 about that crash was:
>> 
>> fatal error: unexpected signal during runtime execution
>> [signal 0xb code=0x1 addr=0x0 pc=0x4dc05f1]
>> 
>> Could I get a bit more verbose error message, which I could make sense of? :)
> 
> Looks like a nullptr dereference.  Try it with a debug build (`make
> x64.debug`), it has many extra checks enabled.
> 
>> BTW Ben, do you hang around on any IRC room? Understand you’re much busy, 
>> but I suppose I can fix things much sooner on my end using your help via IRC 
>> communication than email :) Else I could continue using this thread.
> 
> Only sporadically, usually only when I feel like procrastinating. :-)
> 
> -- 
> -- 
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> --- 
> You received this message because you are subscribed to the Google Groups 
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to