{"issue":{"created_at":"2011-12-15T12:00:15Z","state":"open","updated_at":"2011-12-15T12:00:15Z","user":{"gravatar_id":"4c1ce641eb40bef6bf9ac76575391072","id":803101,"url":"https://api.github.com/users/osher","avatar_url":"https://secure.gravatar.com/avatar/4c1ce641eb40bef6bf9ac76575391072?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"osher"},"comments":0,"body":"**Motive**\r\nTrying to reuse my core files on both client and server I avoid by policy using debugger statements.\r\nHowever, I would still like to have them placed for me when I attend to debug a utility file.\r\n\r\nMore over - since debugging a utility file usually results in placing debugger statements in the same places, it should be supported to automate setting them without polluting source files with debugger statements.\r\n\r\n\r\n**Proposal**\r\n\r\nI noticed that running node in debug mode starts with an initial brakepoint, in which I can set brakepoints using debugger context functions like sb(), and so forth.\r\n\r\nConsider the following usage:\r\n\r\n```\r\n\r\n$ node [path/to/debugged/file] [path/to/debugging/script]\r\n\r\n```\r\n\r\nwhere the goal of the debugging script is to mainly place brakepoints for you, but any debugger-context function should be supported.\r\n\r\nExample:\r\n\r\ndebugged file:hello.js\r\n\r\n```\r\n\r\n1  var x = 0;\r\n2  setTimeout(function () {\r\n3      x = x + 1;\r\n4      console.log(\"world \" + x );\r\n5  }, 1000);\r\n6  console.log(\"hello\");\r\n\r\n```\r\n\r\ndebugger script: hello_debug_xcount.ndb\r\n\r\n```\r\n\r\n1 sb(3)\r\n2 watch(\"x\")\r\n3 c\r\n\r\n```\r\n\r\ndebugger command\r\n\r\n```\r\n\r\n$ node debug hello.js hello_debug_xcount.ndb\r\n\r\n```\r\n\r\nwill set a break-point in line 3, add \"x\" to watch, start the script ...  and stop on the break-point on line 3 :)\r\n\r\nusing this, you can have for every utility several debugging-scripts, that place breakpoints in different places according to the debugged logic.\r\n\r\n**Nice to haves:**\r\nmaybe it would also be useful to support several debug scripts at once, so you can summon to your debug context several groups of debugs...\r\n\r\nAnother wild idea is to have any additional parameter passed to the last debug script, and execute debug logic there...\r\n\r\n(P.S - ndb - I noted that the debug commands are not exacly javascript...\r\nfor example, you call ```c``` and not ```c()```. \r\nso  ndb postfix stands for  = node debugger...  or maybe nds = node debug script, I don't mind...)","assignee":null,"id":2565806,"number":2339,"labels":[],"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"title":"Feature request: additional parameter to the debugger mode - debug-script files ","html_url":"https://github.com/joyent/node/issues/2339","closed_at":null,"milestone":null,"url":"https://api.github.com/repos/joyent/node/issues/2339"},"action":"opened"}