~ubuntu-branches/ubuntu/saucy/nodejs/saucy-proposed

« back to all changes in this revision

Viewing changes to doc/api/debugger.json

  • Committer: Package Import Robot
  • Author(s): Jérémy Lal
  • Date: 2013-08-14 00:16:46 UTC
  • mfrom: (7.1.40 sid)
  • Revision ID: package-import@ubuntu.com-20130814001646-bzlysfh8sd6mukbo
Tags: 0.10.15~dfsg1-4
* Update 2005 patch, adding a handful of tests that can fail on
  slow platforms.
* Add 1004 patch to fix test failures when writing NaN to buffer
  on mipsel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
  "source": "doc/api/debugger.markdown",
 
3
  "stability": 3,
 
4
  "stabilityText": "Stable",
 
5
  "miscs": [
 
6
    {
 
7
      "textRaw": "Debugger",
 
8
      "name": "Debugger",
 
9
      "stability": 3,
 
10
      "stabilityText": "Stable",
 
11
      "type": "misc",
 
12
      "desc": "<p>V8 comes with an extensive debugger which is accessible out-of-process via a\nsimple <a href=\"http://code.google.com/p/v8/wiki/DebuggerProtocol\">TCP protocol</a>.\nNode has a built-in client for this debugger. To use this, start Node with the\n<code>debug</code> argument; a prompt will appear:\n\n</p>\n<pre><code>% node debug myscript.js\n&lt; debugger listening on port 5858\nconnecting... ok\nbreak in /home/indutny/Code/git/indutny/myscript.js:1\n  1 x = 5;\n  2 setTimeout(function () {\n  3   debugger;\ndebug&gt;</code></pre>\n<p>Node&#39;s debugger client doesn&#39;t support the full range of commands, but\nsimple step and inspection is possible. By putting the statement <code>debugger;</code>\ninto the source code of your script, you will enable a breakpoint.\n\n</p>\n<p>For example, suppose <code>myscript.js</code> looked like this:\n\n</p>\n<pre><code>// myscript.js\nx = 5;\nsetTimeout(function () {\n  debugger;\n  console.log(&quot;world&quot;);\n}, 1000);\nconsole.log(&quot;hello&quot;);</code></pre>\n<p>Then once the debugger is run, it will break on line 4.\n\n</p>\n<pre><code>% node debug myscript.js\n&lt; debugger listening on port 5858\nconnecting... ok\nbreak in /home/indutny/Code/git/indutny/myscript.js:1\n  1 x = 5;\n  2 setTimeout(function () {\n  3   debugger;\ndebug&gt; cont\n&lt; hello\nbreak in /home/indutny/Code/git/indutny/myscript.js:3\n  1 x = 5;\n  2 setTimeout(function () {\n  3   debugger;\n  4   console.log(&quot;world&quot;);\n  5 }, 1000);\ndebug&gt; next\nbreak in /home/indutny/Code/git/indutny/myscript.js:4\n  2 setTimeout(function () {\n  3   debugger;\n  4   console.log(&quot;world&quot;);\n  5 }, 1000);\n  6 console.log(&quot;hello&quot;);\ndebug&gt; repl\nPress Ctrl + C to leave debug repl\n&gt; x\n5\n&gt; 2+2\n4\ndebug&gt; next\n&lt; world\nbreak in /home/indutny/Code/git/indutny/myscript.js:5\n  3   debugger;\n  4   console.log(&quot;world&quot;);\n  5 }, 1000);\n  6 console.log(&quot;hello&quot;);\n  7\ndebug&gt; quit\n%</code></pre>\n<p>The <code>repl</code> command allows you to evaluate code remotely. The <code>next</code> command\nsteps over to the next line. There are a few other commands available and more\nto come. Type <code>help</code> to see others.\n\n</p>\n",
 
13
      "miscs": [
 
14
        {
 
15
          "textRaw": "Watchers",
 
16
          "name": "watchers",
 
17
          "desc": "<p>You can watch expression and variable values while debugging your code.\nOn every breakpoint each expression from the watchers list will be evaluated\nin the current context and displayed just before the breakpoint&#39;s source code\nlisting.\n\n</p>\n<p>To start watching an expression, type <code>watch(&quot;my_expression&quot;)</code>. <code>watchers</code>\nprints the active watchers. To remove a watcher, type\n<code>unwatch(&quot;my_expression&quot;)</code>.\n\n</p>\n",
 
18
          "type": "misc",
 
19
          "displayName": "Watchers"
 
20
        },
 
21
        {
 
22
          "textRaw": "Commands reference",
 
23
          "name": "commands_reference",
 
24
          "modules": [
 
25
            {
 
26
              "textRaw": "Stepping",
 
27
              "name": "Stepping",
 
28
              "desc": "<p>It is also possible to set a breakpoint in a file (module) that\nisn&#39;t loaded yet:\n\n</p>\n<pre><code>% ./node debug test/fixtures/break-in-module/main.js\n&lt; debugger listening on port 5858\nconnecting to port 5858... ok\nbreak in test/fixtures/break-in-module/main.js:1\n  1 var mod = require(&#39;./mod.js&#39;);\n  2 mod.hello();\n  3 mod.hello();\ndebug&gt; setBreakpoint(&#39;mod.js&#39;, 23)\nWarning: script &#39;mod.js&#39; was not loaded yet.\n  1 var mod = require(&#39;./mod.js&#39;);\n  2 mod.hello();\n  3 mod.hello();\ndebug&gt; c\nbreak in test/fixtures/break-in-module/mod.js:23\n 21\n 22 exports.hello = function() {\n 23   return &#39;hello from module&#39;;\n 24 };\n 25\ndebug&gt;</code></pre>\n",
 
29
              "type": "module",
 
30
              "displayName": "Breakpoints"
 
31
            },
 
32
            {
 
33
              "textRaw": "Breakpoints",
 
34
              "name": "breakpoints",
 
35
              "desc": "<p>It is also possible to set a breakpoint in a file (module) that\nisn&#39;t loaded yet:\n\n</p>\n<pre><code>% ./node debug test/fixtures/break-in-module/main.js\n&lt; debugger listening on port 5858\nconnecting to port 5858... ok\nbreak in test/fixtures/break-in-module/main.js:1\n  1 var mod = require(&#39;./mod.js&#39;);\n  2 mod.hello();\n  3 mod.hello();\ndebug&gt; setBreakpoint(&#39;mod.js&#39;, 23)\nWarning: script &#39;mod.js&#39; was not loaded yet.\n  1 var mod = require(&#39;./mod.js&#39;);\n  2 mod.hello();\n  3 mod.hello();\ndebug&gt; c\nbreak in test/fixtures/break-in-module/mod.js:23\n 21\n 22 exports.hello = function() {\n 23   return &#39;hello from module&#39;;\n 24 };\n 25\ndebug&gt;</code></pre>\n",
 
36
              "type": "module",
 
37
              "displayName": "Breakpoints"
 
38
            },
 
39
            {
 
40
              "textRaw": "Execution control",
 
41
              "name": "Execution control",
 
42
              "type": "module",
 
43
              "displayName": "Various"
 
44
            },
 
45
            {
 
46
              "textRaw": "Various",
 
47
              "name": "various",
 
48
              "type": "module",
 
49
              "displayName": "Various"
 
50
            }
 
51
          ],
 
52
          "type": "misc",
 
53
          "displayName": "Commands reference"
 
54
        },
 
55
        {
 
56
          "textRaw": "Advanced Usage",
 
57
          "name": "advanced_usage",
 
58
          "desc": "<p>The V8 debugger can be enabled and accessed either by starting Node with\nthe <code>--debug</code> command-line flag or by signaling an existing Node process\nwith <code>SIGUSR1</code>.\n\n</p>\n<p>Once a process has been set in debug mode with this it can be connected to\nwith the node debugger. Either connect to the <code>pid</code> or the URI to the debugger.\nThe syntax is:\n\n</p>\n<ul>\n<li><code>node debug -p &lt;pid&gt;</code> - Connects to the process via the <code>pid</code></li>\n<li>`node debug <URI> - Connects to the process via the URI such as localhost:5858</li>\n</ul>\n",
 
59
          "type": "misc",
 
60
          "displayName": "Advanced Usage"
 
61
        }
 
62
      ]
 
63
    }
 
64
  ]
 
65
}