New issue
Advanced search Search tips
Starred by 4 users
Status: Assigned
Owner:
Cc:
Components:
HW: ----
OS: ----
Priority: 2
Type: Bug



Sign in to add a comment
When debugging - delete statement is skipped
Reported by fedor.in...@gmail.com, Oct 24 2013 Back to list
When trying to debug following script with node.js step-by-step:

var exPE = { ex2_prop1 : 23, ex2_prop2 : 13 };
debugger;
delete exPE.ex2_prop1;
debugger;

Following lines will be visited: 1,2,4 ; thus skipping third line with delete statement. Reproducible in master and 0.10 version of node.js (3.21.18.3 and 3.14.5.9 v8 versions respectively).

Here is a dump of debug messages that are sent to node:

{"seq":11,"request_seq":1,"type":"response","command":"continue","success":true,"running":true}

{"seq":12,"type":"event","event":"break","body":{"invocationText":"#<Object>.[anonymous](exports=#<Object>, require=function require(path) {\n    return self.require(path);\n  }, module=#<Module>, __filename=/Users/indutny/Code/indutny/node/5.js, __dirname=/Users/indutny/Code/indutny/node)","sourceLine":1,"sourceColumn":0,"sourceLineText":"debugger;","script":{"id":36,"name":"/Users/indutny/Code/indutny/node/5.js","lineOffset":0,"columnOffset":0,"lineCount":6}}}

{"seq":13,"request_seq":1,"type":"response","command":"source","success":true,"body":{"source":"(function (exports, require, module, __filename, __dirname) { var exPE = { ex2_prop1 : 23, ex2_prop2 : 13 };\ndebugger;\ndelete exPE.ex2_prop1;\ndebugger;\n\n});","fromLine":0,"toLine":6,"fromPosition":0,"toPosition":157,"totalLines":6},"refs":[],"running":false}

{"seq":14,"request_seq":1,"type":"response","command":"continue","success":true,"running":true}

{"seq":15,"type":"event","event":"break","body":{"invocationText":"#<Object>.[anonymous](exports=#<Object>, require=function require(path) {\n    return self.require(path);\n  }, module=#<Module>, __filename=/Users/indutny/Code/indutny/node/5.js, __dirname=/Users/indutny/Code/indutny/node)","sourceLine":3,"sourceColumn":0,"sourceLineText":"debugger;","script":{"id":36,"name":"/Users/indutny/Code/indutny/node/5.js","lineOffset":0,"columnOffset":0,"lineCount":6}}}

{"seq":16,"request_seq":1,"type":"response","command":"source","success":true,"body":{"source":"(function (exports, require, module, __filename, __dirname) { var exPE = { ex2_prop1 : 23, ex2_prop2 : 13 };\ndebugger;\ndelete exPE.ex2_prop1;\ndebugger;\n\n});","fromLine":0,"toLine":6,"fromPosition":0,"toPosition":157,"totalLines":6},"refs":[],"running":false}

Original node.js issue: https://github.com/joyent/node/issues/6405

 
Here is my finding:

When node.js running debugger, it will enclose the script within a anonymous function. So I wrote a script and enclose delete operator within a function and found that even d8 will skip the delete operator. Here is test script and test steps:
$cat delete_infun.js
function a() {
debugger;
var exPE = { ex2_prop1 : 23, ex2_prop2 : 13 };
delete exPE.ex2_prop1;
debugger;
};
a();

$d8 --debugger delete_infun.js
JavaScript debugger enabled
break in a(), /home/tinaho/delete_infun.js line 2 column 5
debugger;
^
dbg> bt
Frames #0 to #1 of 2
#00 a() /home/tinaho/delete_infun.js line 2 column 5 (position 20)
#1 anonymous /home/tinaho/delete_infun.js line 11 column 1 (position 129)
dbg> n
(running)
break in a(), /home/tinaho/delete_infun.js line 4 column 5
var exPE = { ex2_prop1 : 23, ex2_prop2 : 13 };
^
dbg> n
(running)
break in a(), /home/tinaho/delete_infun.js line 8 column 5
debugger;
^
dbg> n
(running)
break in a() returning undefined, /home/tinaho/delete_infun.js line 9 column 1
};
^
Owner: yangguo@chromium.org
Labels: Type-Bug Priority-Medium Area-Runtime
Status: Assigned
Is this still valid?
Labels: Priority-2
Sign in to add a comment