Status: New
Owner: ----

New issue 3960 by [email protected]: Problems with Debug.setBreakPoint on node.js/io.js
https://code.google.com/p/v8/issues/detail?id=3960

Version: 4.1.0.14, 4.1.0.21, 3.28.73, others
OS: OS X 10.10.2
Architecture: x64


I am using the V8 Debug API from node.js/io.js. Until now, I had been using Debug.setBreakPointByScriptIdAndPosition, and that was working well enough. However, I recently started playing with Debug.setBreakPoint and Debug.setScriptBreakPoint. I believe I have uncovered some interesting behavior.

Here's a testcase that I adapted from test/mjsunit/debug-breakpoints.js:

test.js:
Debug = require('vm').runInDebugContext('Debug');
Debug.setListener(function(){console.log('Break event');});
function f() {a=1;b=2}
Debug.setBreakPoint(f, 0, 0);
console.log(Debug.showBreakPoints(f));
f();


You should expect the breakpoint to be hit when f is called. The expected output is:
() {[B0]a=1;b=2}
Break event

However, this is what I get instead:
$ iojs test.js
() {a=1;b=2}

Now if you change 'setBreakPoint(f,0,0)' to 'setBreakPoint(f,2,0)', this is the output:

$ iojs test2.js
Break event
() {a=1;b=2}

i.e. we hit *some* breakpoint – so some parts of the Debug API are clearly working. It seems that we managed to set the breakpoint at the console.log(...) line (2 lines after f – makes sense). But why can't we set a breakpoint in f itself?

The plot thickens. If you run the original testcase with the --expose-debug-as option:

$ iojs --expose-debug-as=PrincessButtercup test.js
() {[B0]a=1;b=2}
Break event

So whatever the issue is, adding --expose-debug-as to the command line ends up working around it.

Since all our Debug API mjsunit testcases run with the --expose-debug-as option, all those test cases pass.

I suspect this is an issue in the V8 Debug API rather than in node.js/io.js – the debug API should either uniformly work or uniformly not work.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" 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