{"action":"created","issue":{"url":"https://api.github.com/repos/svaarala/duktape/issues/263","labels_url":"https://api.github.com/repos/svaarala/duktape/issues/263/labels{/name}","comments_url":"https://api.github.com/repos/svaarala/duktape/issues/263/comments","events_url":"https://api.github.com/repos/svaarala/duktape/issues/263/events","html_url":"https://github.com/svaarala/duktape/issues/263","id":99775205,"number":263,"title":"Breakpoint stops on wrong line","user":{"login":"fatcerberus","id":4097841,"avatar_url":"https://avatars.githubusercontent.com/u/4097841?v=3","gravatar_id":"","url":"https://api.github.com/users/fatcerberus","html_url":"https://github.com/fatcerberus","followers_url":"https://api.github.com/users/fatcerberus/followers","following_url":"https://api.github.com/users/fatcerberus/following{/other_user}","gists_url":"https://api.github.com/users/fatcerberus/gists{/gist_id}","starred_url":"https://api.github.com/users/fatcerberus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fatcerberus/subscriptions","organizations_url":"https://api.github.com/users/fatcerberus/orgs","repos_url":"https://api.github.com/users/fatcerberus/repos","events_url":"https://api.github.com/users/fatcerberus/events{/privacy}","received_events_url":"https://api.github.com/users/fatcerberus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/svaarala/duktape/labels/debugger","name":"debugger","color":"bfdadc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-08T05:30:13Z","updated_at":"2015-08-08T15:16:13Z","closed_at":null,"body":"I have the following deep-copy function:\r\n\r\n```javascript\r\n// clone() function\r\n// Creates a deep copy of an object, preserving circular references.\r\n// Arguments:\r\n//     o: The object to clone.\r\n// Returns:\r\n//     The new, cloned object.\r\nfunction clone(o)\r\n{\r\n\tvar clones = arguments.length >= 2 ? arguments[1] : [];\r\n\tif (typeof o === 'object' && o !== null) {\r\n\t\tfor (var i = 0; i < clones.length; ++i) {\r\n\t\t\tif (o === clones[i].original) {\r\n\t\t\t\treturn clones[i].dolly;\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar dolly = o instanceof Array ? []\r\n\t\t\t: 'clone' in o && typeof o.clone === 'function' ? o.clone()\r\n\t\t\t: {};\r\n\t\tclones.push({ original: o, dolly: dolly });\r\n\t\tif (o instanceof Array || !('clone' in o) || typeof o.clone !== 'function') {\r\n\t\t\tfor (var p in o) {\r\n\t\t\t\tdolly[p] = clone(o[p], clones);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn dolly;\r\n\t} else {\r\n\t\treturn o;\r\n\t}\r\n}\r\n```\r\n\r\nWhen I set a breakpoint on `return dolly;`, Duktape will break on that line, but it will also break on `return o;` for which no breakpoint is set."},"comment":{"url":"https://api.github.com/repos/svaarala/duktape/issues/comments/128989383","html_url":"https://github.com/svaarala/duktape/issues/263#issuecomment-128989383","issue_url":"https://api.github.com/repos/svaarala/duktape/issues/263","id":128989383,"user":{"login":"fatcerberus","id":4097841,"avatar_url":"https://avatars.githubusercontent.com/u/4097841?v=3","gravatar_id":"","url":"https://api.github.com/users/fatcerberus","html_url":"https://github.com/fatcerberus","followers_url":"https://api.github.com/users/fatcerberus/followers","following_url":"https://api.github.com/users/fatcerberus/following{/other_user}","gists_url":"https://api.github.com/users/fatcerberus/gists{/gist_id}","starred_url":"https://api.github.com/users/fatcerberus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fatcerberus/subscriptions","organizations_url":"https://api.github.com/users/fatcerberus/orgs","repos_url":"https://api.github.com/users/fatcerberus/repos","events_url":"https://api.github.com/users/fatcerberus/events{/privacy}","received_events_url":"https://api.github.com/users/fatcerberus/received_events","type":"User","site_admin":false},"created_at":"2015-08-08T15:16:13Z","updated_at":"2015-08-08T15:16:13Z","body":"So if I understand you correctly, the condition to trigger a breakpoint is basically this, then?\r\n`if (cur_line >= breakpoint_line) pause()`\r\n\r\nThat seems unintuitive.  And in any case, if a breakpoint is set on a line that isn't executed, I wouldn't expect it to be hit at all.  Unless I misunderstand?"}}