Thank you. My bad, should have recognised that “global” actually refers to the 
scope.

> On 09-Sep-2016, at 1:28 PM, Ben Noordhuis <[email protected]> wrote:
> 
> On Thu, Sep 8, 2016 at 11:54 AM, Abhishek Singh
> <[email protected]> wrote:
>> Hi,
>> 
>> I’m seeing a problem with the way “Evaluate” request works with V8 Debug
>> protocol. Have a sample standalone simulation of the problem, will
>> appreciate inputs on what I might be missing.
>> 
>> Link:
>> https://gist.github.com/abhi-bit/20b8569bc5d655659b51d425564eb49d#file-v8_debug_testing-cc
>> 
>> Sample program execution flow looks like this in chronological order:
>> 
>> * User supplied code runs initially.
>> * Breakpoint is set, as a result execution halts.
>> * Does list breakpoints, clear breakpoint
>> * Does evaluate <- here is where I’m seeing problem
>> * Does continue, and user code execution flows normally.
>> 
>> Set breakpoint response looks like this:
>> 
>> {"seq":1,"type":"event","event":"break","body":{"invocationText":"DebugUserRequest(doc=#<Object>)","sourceLine":1,"sourceColumn":4,"sourceLineText":"
>> if (doc.type === \"json\")
>> {","script":{"id":33,"name":null,"lineOffset":0,"columnOffset":0,"lineCount":6},"breakpoints":[1]}}
>> 
>> So clearly, context in which code is executing knows value of var “doc”, but
>> evaluate against it fails - what could be wrong here?
>> 
>> Evaluate request looks like this:
>> {"seq":12,"type":"request","command":"evaluate","arguments":{"expression":"doc","global":true,"disable_break":true}}
>> 
>> Evaluate response from V8
>> {"seq":5,"request_seq":12,"type":"response","command":"evaluate","success":false,"message":"ReferenceError:
>> doc is not defined","running":false}
> 
> Your evaluate request runs in the global context ("global": true) but
> I suspect that `doc` is a local variable.
> 
> -- 
> -- 
> v8-users mailing list
> [email protected]
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
v8-users mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to