{
  "$schema": "https://doc-kit.nodejs.org/schemas/api-doc/1.0.1.json",
  "id": "debugger",
  "path": "/debugger",
  "type": "misc",
  "module": null,
  "title": "Debugger",
  "introducedIn": "v0.9.12",
  "sourceLink": null,
  "stability": {
    "index": "2",
    "description": "Stable"
  },
  "added": [],
  "deprecated": [],
  "removed": [],
  "napiVersion": [],
  "changes": [],
  "description": "Node.js includes a command-line debugging utility. The Node.js debugger client\nis not a full-featured debugger, but simple stepping and inspection are\npossible.\n\nThe debugger supports two modes of operation: [interactive mode](#interactive-mode) and [non-interactive probe mode](#probe-mode).",
  "summary": "Node.js includes a command-line debugging utility. The Node.js debugger client is not a full-featured debugger, but simple stepping and inspection are possible.",
  "examples": [],
  "children": [
    {
      "kind": "section",
      "id": "interactive-mode",
      "name": "Interactive mode",
      "title": "Interactive mode",
      "scope": "module",
      "overloadOf": null,
      "stability": null,
      "added": [],
      "deprecated": [],
      "removed": [],
      "napiVersion": [],
      "changes": [],
      "description": "```console\n$ node inspect [--port=<port>] [<node-option> ...] [<script> [<script-args>] | <host>:<port> | -p <pid>]\n```\n\nTo use it, start Node.js with the `inspect` argument followed by the path to the\nscript to debug.\n\n```console\n$ node inspect myscript.js\n< Debugger listening on ws://127.0.0.1:9229/621111f9-ffcb-4e82-b718-48a145fa5db8\n< For help, see: https://nodejs.org/learn/getting-started/debugging\n<\nconnecting to 127.0.0.1:9229 ... ok\n< Debugger attached.\n<\n ok\nBreak on start in myscript.js:2\n  1 // myscript.js\n> 2 global.x = 5;\n  3 setTimeout(() => {\n  4   debugger;\ndebug>\n```\n\nThe debugger automatically breaks on the first executable line. To instead\nrun until the first breakpoint (specified by a [`debugger`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger) statement), set\nthe `NODE_INSPECT_RESUME_ON_START` environment variable to `1`.\n\n```console\n$ cat myscript.js\n// myscript.js\nglobal.x = 5;\nsetTimeout(() => {\n  debugger;\n  console.log('world');\n}, 1000);\nconsole.log('hello');\n$ NODE_INSPECT_RESUME_ON_START=1 node inspect myscript.js\n< Debugger listening on ws://127.0.0.1:9229/f1ed133e-7876-495b-83ae-c32c6fc319c2\n< For help, see: https://nodejs.org/learn/getting-started/debugging\n<\nconnecting to 127.0.0.1:9229 ... ok\n< Debugger attached.\n<\n< hello\n<\nbreak in myscript.js:4\n  2 global.x = 5;\n  3 setTimeout(() => {\n> 4   debugger;\n  5   console.log('world');\n  6 }, 1000);\ndebug> next\nbreak in myscript.js:5\n  3 setTimeout(() => {\n  4   debugger;\n> 5   console.log('world');\n  6 }, 1000);\n  7 console.log('hello');\ndebug> repl\nPress Ctrl+C to leave debug repl\n> x\n5\n> 2 + 2\n4\ndebug> next\n< world\n<\nbreak in myscript.js:6\n  4   debugger;\n  5   console.log('world');\n> 6 }, 1000);\n  7 console.log('hello');\n  8\ndebug> .exit\n$\n```\n\nThe `repl` command allows code to be evaluated remotely. The `next` command\nsteps to the next line. Type `help` to see what other commands are available.\n\nPressing `enter` without typing a command will repeat the previous debugger\ncommand.",
      "summary": "To use it, start Node.js with the `inspect` argument followed by the path to the script to debug.",
      "examples": [
        {
          "language": "console",
          "displayName": null,
          "code": "$ node inspect [--port=<port>] [<node-option> ...] [<script> [<script-args>] | <host>:<port> | -p <pid>]"
        },
        {
          "language": "console",
          "displayName": null,
          "code": "$ node inspect myscript.js\n< Debugger listening on ws://127.0.0.1:9229/621111f9-ffcb-4e82-b718-48a145fa5db8\n< For help, see: https://nodejs.org/learn/getting-started/debugging\n<\nconnecting to 127.0.0.1:9229 ... ok\n< Debugger attached.\n<\n ok\nBreak on start in myscript.js:2\n  1 // myscript.js\n> 2 global.x = 5;\n  3 setTimeout(() => {\n  4   debugger;\ndebug>"
        },
        {
          "language": "console",
          "displayName": null,
          "code": "$ cat myscript.js\n// myscript.js\nglobal.x = 5;\nsetTimeout(() => {\n  debugger;\n  console.log('world');\n}, 1000);\nconsole.log('hello');\n$ NODE_INSPECT_RESUME_ON_START=1 node inspect myscript.js\n< Debugger listening on ws://127.0.0.1:9229/f1ed133e-7876-495b-83ae-c32c6fc319c2\n< For help, see: https://nodejs.org/learn/getting-started/debugging\n<\nconnecting to 127.0.0.1:9229 ... ok\n< Debugger attached.\n<\n< hello\n<\nbreak in myscript.js:4\n  2 global.x = 5;\n  3 setTimeout(() => {\n> 4   debugger;\n  5   console.log('world');\n  6 }, 1000);\ndebug> next\nbreak in myscript.js:5\n  3 setTimeout(() => {\n  4   debugger;\n> 5   console.log('world');\n  6 }, 1000);\n  7 console.log('hello');\ndebug> repl\nPress Ctrl+C to leave debug repl\n> x\n5\n> 2 + 2\n4\ndebug> next\n< world\n<\nbreak in myscript.js:6\n  4   debugger;\n  5   console.log('world');\n> 6 }, 1000);\n  7 console.log('hello');\n  8\ndebug> .exit\n$"
        }
      ],
      "children": [
        {
          "kind": "section",
          "id": "watchers",
          "name": "Watchers",
          "title": "Watchers",
          "scope": "module",
          "overloadOf": null,
          "stability": null,
          "added": [],
          "deprecated": [],
          "removed": [],
          "napiVersion": [],
          "changes": [],
          "description": "It is possible to watch expression and variable values while debugging. On\nevery breakpoint, each expression from the watchers list will be evaluated\nin the current context and displayed immediately before the breakpoint's\nsource code listing.\n\nTo begin watching an expression, type `watch('my_expression')`. The command\n`watchers` will print the active watchers. To remove a watcher, type\n`unwatch('my_expression')`.",
          "summary": "It is possible to watch expression and variable values while debugging. On every breakpoint, each expression from the watchers list will be evaluated in the current context and displayed immediately before the breakpoint's source code listing.",
          "examples": [],
          "children": []
        }
      ]
    },
    {
      "kind": "section",
      "id": "command-reference",
      "name": "Command reference",
      "title": "Command reference",
      "scope": "module",
      "overloadOf": null,
      "stability": null,
      "added": [],
      "deprecated": [],
      "removed": [],
      "napiVersion": [],
      "changes": [],
      "description": "",
      "summary": "",
      "examples": [],
      "children": [
        {
          "kind": "section",
          "id": "stepping",
          "name": "Stepping",
          "title": "Stepping",
          "scope": "module",
          "overloadOf": null,
          "stability": null,
          "added": [],
          "deprecated": [],
          "removed": [],
          "napiVersion": [],
          "changes": [],
          "description": "* `cont`, `c`: Continue execution\n* `next`, `n`: Step next\n* `step`, `s`: Step in\n* `out`, `o`: Step out\n* `pause`: Pause running code (like pause button in Developer Tools)",
          "summary": "",
          "examples": [],
          "children": [
            {
              "kind": "section",
              "id": "breakpoints",
              "name": "Breakpoints",
              "title": "Breakpoints",
              "scope": "module",
              "overloadOf": null,
              "stability": null,
              "added": [],
              "deprecated": [],
              "removed": [],
              "napiVersion": [],
              "changes": [],
              "description": "* `setBreakpoint()`, `sb()`: Set breakpoint on current line\n* `setBreakpoint(line)`, `sb(line)`: Set breakpoint on specific line\n* `setBreakpoint('fn()')`, `sb(...)`: Set breakpoint on a first statement in\n  function's body\n* `setBreakpoint('script.js', 1)`, `sb(...)`: Set breakpoint on first line of\n  `script.js`\n* `setBreakpoint('script.js', 1, 'num < 4')`, `sb(...)`: Set conditional\n  breakpoint on first line of `script.js` that only breaks when `num < 4`\n  evaluates to `true`\n* `clearBreakpoint('script.js', 1)`, `cb(...)`: Clear breakpoint in `script.js`\n  on line 1\n\nIt is also possible to set a breakpoint in a file (module) that\nis not loaded yet:\n\n```console\n$ node inspect main.js\n< Debugger listening on ws://127.0.0.1:9229/48a5b28a-550c-471b-b5e1-d13dd7165df9\n< For help, see: https://nodejs.org/learn/getting-started/debugging\n<\nconnecting to 127.0.0.1:9229 ... ok\n< Debugger attached.\n<\nBreak on start in main.js:1\n> 1 const mod = require('./mod.js');\n  2 mod.hello();\n  3 mod.hello();\ndebug> setBreakpoint('mod.js', 22)\nWarning: script 'mod.js' was not loaded yet.\ndebug> c\nbreak in mod.js:22\n 20 // USE OR OTHER DEALINGS IN THE SOFTWARE.\n 21\n>22 exports.hello = function() {\n 23   return 'hello from module';\n 24 };\ndebug>\n```\n\nIt is also possible to set a conditional breakpoint that only breaks when a\ngiven expression evaluates to `true`:\n\n```console\n$ node inspect main.js\n< Debugger listening on ws://127.0.0.1:9229/ce24daa8-3816-44d4-b8ab-8273c8a66d35\n< For help, see: https://nodejs.org/learn/getting-started/debugging\n<\nconnecting to 127.0.0.1:9229 ... ok\n< Debugger attached.\nBreak on start in main.js:7\n  5 }\n  6\n> 7 addOne(10);\n  8 addOne(-1);\n  9\ndebug> setBreakpoint('main.js', 4, 'num < 0')\n  1 'use strict';\n  2\n  3 function addOne(num) {\n> 4   return num + 1;\n  5 }\n  6\n  7 addOne(10);\n  8 addOne(-1);\n  9\ndebug> cont\nbreak in main.js:4\n  2\n  3 function addOne(num) {\n> 4   return num + 1;\n  5 }\n  6\ndebug> exec('num')\n-1\ndebug>\n```",
              "summary": "It is also possible to set a breakpoint in a file (module) that is not loaded yet:",
              "examples": [
                {
                  "language": "console",
                  "displayName": null,
                  "code": "$ node inspect main.js\n< Debugger listening on ws://127.0.0.1:9229/48a5b28a-550c-471b-b5e1-d13dd7165df9\n< For help, see: https://nodejs.org/learn/getting-started/debugging\n<\nconnecting to 127.0.0.1:9229 ... ok\n< Debugger attached.\n<\nBreak on start in main.js:1\n> 1 const mod = require('./mod.js');\n  2 mod.hello();\n  3 mod.hello();\ndebug> setBreakpoint('mod.js', 22)\nWarning: script 'mod.js' was not loaded yet.\ndebug> c\nbreak in mod.js:22\n 20 // USE OR OTHER DEALINGS IN THE SOFTWARE.\n 21\n>22 exports.hello = function() {\n 23   return 'hello from module';\n 24 };\ndebug>"
                },
                {
                  "language": "console",
                  "displayName": null,
                  "code": "$ node inspect main.js\n< Debugger listening on ws://127.0.0.1:9229/ce24daa8-3816-44d4-b8ab-8273c8a66d35\n< For help, see: https://nodejs.org/learn/getting-started/debugging\n<\nconnecting to 127.0.0.1:9229 ... ok\n< Debugger attached.\nBreak on start in main.js:7\n  5 }\n  6\n> 7 addOne(10);\n  8 addOne(-1);\n  9\ndebug> setBreakpoint('main.js', 4, 'num < 0')\n  1 'use strict';\n  2\n  3 function addOne(num) {\n> 4   return num + 1;\n  5 }\n  6\n  7 addOne(10);\n  8 addOne(-1);\n  9\ndebug> cont\nbreak in main.js:4\n  2\n  3 function addOne(num) {\n> 4   return num + 1;\n  5 }\n  6\ndebug> exec('num')\n-1\ndebug>"
                }
              ],
              "children": []
            },
            {
              "kind": "section",
              "id": "information",
              "name": "Information",
              "title": "Information",
              "scope": "module",
              "overloadOf": null,
              "stability": null,
              "added": [],
              "deprecated": [],
              "removed": [],
              "napiVersion": [],
              "changes": [],
              "description": "* `backtrace`, `bt`: Print backtrace of current execution frame\n* `list(5)`: List scripts source code with 5 line context (5 lines before and\n  after)\n* `watch(expr)`: Add expression to watch list\n* `unwatch(expr)`: Remove expression from watch list\n* `unwatch(index)`: Remove expression at specific index from watch list\n* `watchers`: List all watchers and their values (automatically listed on each\n  breakpoint)\n* `repl`: Open debugger's repl for evaluation in debugging script's context\n* `exec expr`, `p expr`: Execute an expression in debugging script's context and\n  print its value\n* `profile`: Start CPU profiling session\n* `profileEnd`: Stop current CPU profiling session\n* `profiles`: List all completed CPU profiling sessions\n* `profiles[n].save(filepath = 'node.cpuprofile')`: Save CPU profiling session\n  to disk as JSON\n* `takeHeapSnapshot(filepath = 'node.heapsnapshot')`: Take a heap snapshot\n  and save to disk as JSON",
              "summary": "",
              "examples": [],
              "children": []
            },
            {
              "kind": "section",
              "id": "execution-control",
              "name": "Execution control",
              "title": "Execution control",
              "scope": "module",
              "overloadOf": null,
              "stability": null,
              "added": [],
              "deprecated": [],
              "removed": [],
              "napiVersion": [],
              "changes": [],
              "description": "* `run`: Run script (automatically runs on debugger's start)\n* `restart`: Restart script\n* `kill`: Kill script",
              "summary": "",
              "examples": [],
              "children": []
            },
            {
              "kind": "section",
              "id": "various",
              "name": "Various",
              "title": "Various",
              "scope": "module",
              "overloadOf": null,
              "stability": null,
              "added": [],
              "deprecated": [],
              "removed": [],
              "napiVersion": [],
              "changes": [],
              "description": "* `scripts`: List all loaded scripts\n* `version`: Display V8's version",
              "summary": "",
              "examples": [],
              "children": []
            }
          ]
        }
      ]
    },
    {
      "kind": "section",
      "id": "probe-mode",
      "name": "Probe mode",
      "title": "Probe mode",
      "scope": "module",
      "overloadOf": null,
      "stability": {
        "index": "1",
        "description": "Experimental"
      },
      "added": [
        "v26.1.0",
        "v24.16.0"
      ],
      "deprecated": [],
      "removed": [],
      "napiVersion": [],
      "changes": [
        {
          "versions": [
            "v27.0.0-alpha.0.2.0"
          ],
          "prUrl": "https://github.com/nodejs/node/pull/67201",
          "commit": null,
          "description": "Add `--pid <pid>` and `--host <host>`/`--port <port>` to probe a process that's already running. The report now includes a top-level `target` field to describe what was probed, and a `locations` field showing which probe is bound to which location."
        },
        {
          "versions": [
            "v26.6.0",
            "v24.20.0"
          ],
          "prUrl": "https://github.com/nodejs/node/pull/64328",
          "commit": null,
          "description": "Add per-probe `--cond <expr>` option to only record a hit when the condition is truthy at the probe location."
        },
        {
          "versions": [
            "v26.4.0",
            "v24.19.0"
          ],
          "prUrl": "https://github.com/nodejs/node/pull/63704",
          "commit": null,
          "description": "Add per-probe `--max-hit <n>` option to limit evaluated hits and finish with a `completed` terminal event as soon as any probe reaches its limit."
        },
        {
          "versions": [
            "v26.3.0",
            "v24.19.0"
          ],
          "prUrl": "https://github.com/nodejs/node/pull/63437",
          "commit": null,
          "description": "Add `probe_failure` terminal `error` event for inspector-side mid-session failures, and `error.details` for additional context on per-hit and terminal errors."
        },
        {
          "versions": [
            "v26.2.0",
            "v24.19.0"
          ],
          "prUrl": "https://github.com/nodejs/node/pull/63286",
          "commit": null,
          "description": "JSON report schema bumped to v2. Probe `target` is now `{ suffix, line, column? }` instead of an array. Each \"hit\" event carries a `location` field reporting the actual evaluation location.  When the probe does not specify a column, it binds to the first executable column instead of defaulting to 1."
        }
      ],
      "description": "`node inspect` supports a non-interactive probe mode for inspecting runtime values\nin an application via the flag `--probe`.\n\nThere are two ways to use probe mode:\n\n* Launch a new process and probe it by specifying the entry point script.\n* Attach to and probe a running process using `--pid <pid>` or `--host <host>`/`--port <port>`.\n\nThe probe mode sets one or more source breakpoints, evaluates specified\nexpressions whenever the execution reaches a breakpoint, and prints one\nfinal report of all the evaluated expressions when the session ends\n(either on normal completion, error, or timeout). This allows developers to perform\nprintf-style debugging without having to modify the application code and\nclean up afterwards. It also supports structured JSON output for tool use.\n\n```console\n# To launch a new process and probe it:\n$ node inspect --probe <file>:<line>[:<col>] --expr <expr> [--cond <expr>] [--max-hit <n>]\n              [--probe <file>:<line>[:<col>] --expr <expr> [--cond <expr>] [--max-hit <n>] ...]\n              [--json] [--preview] [--timeout=<ms>] [--port=<port>]\n              [--] [<node-option> ...] <script> [<script-args> ...]\n\n# To activate the inspector in an already-running process and probe it:\n$ node inspect --probe <file>:<line>[:<col>] --expr <expr> [...] --pid <pid> [--host <host>] [--port <port>]\n\n# To probe a running process whose inspector is already listening for connections:\n$ node inspect --probe <file>:<line>[:<col>] --expr <expr> [...] --host <host> [--port <port>]\n$ node inspect --probe <file>:<line>[:<col>] --expr <expr> [...] --port <port> [--host <host>]\n```\n\n* `--probe <file>:<line>[:<col>]`: Source location of the probe. When execution\n  reaches the location, the provided expressions are evaluated and printed in\n  the output. `<file>` matches the URL suffix of the script to probe.\n  `<line>` and `<col>` numbers are 1-based. When `<col>` is omitted, the probe\n  binds to the first executable column on the line.\n* `--expr <expr>`: JavaScript expression to evaluate whenever execution reaches\n  the location specified by the preceding `--probe`.\n  Must immediately follow the `--probe` it belongs to.\n* `--cond <expr>`: An optional condition for the probe location. The probe only\n  records a hit when `<expr>` is truthy at the location. A condition that throws\n  is treated as false.\n* `--max-hit <n>`: An optional per-probe limit on the number of times the probe\n  can be hit. When not specified, there's no hit limit. When any probe reaches\n  its hit limit, the probing session finishes and reports the results. If the\n  probed process was launched by probe mode, it's then terminated. If the process\n  was already running before being attached for probing, it is resumed and left running.\n  If any other probe is never reached by the time the session ends, the missed probes will\n  be reported.\n* `--timeout=<ms>`: A deadline in milliseconds. The default is `30000`. It is\n  applied first to the target responding to the inspector and binding the\n  probes, then to the probing session itself, so a run can take up to about\n  twice the limit to time out. If the target does not respond in time during startup,\n  the report ends with an `error` and the probing process exits with a non-zero\n  code. If the process was attached to instead of launched by probe mode,\n  `--timeout` is an alternative to `--max-hit` for ending a probing session\n  without terminating the probed process.\n* `--json`: If used, prints a structured JSON report instead of the default text report.\n* `--preview`: If used, non-primitive values will include CDP property previews for\n  object-like JSON probe values.\n* `--port=<port>`: When the probe mode launches the probed process, it specifies the port\n  the launched child process' inspector listens on and defaults to `0`, which requests a\n  random port. When the probe mode attaches to a running process, this specifies the port to connect to\n  and defaults to `9229`, while `0` is invalid.\n* `--host <host>`: In attach mode, the host to connect to. Defaults to\n  `127.0.0.1`. It is an error to combine it with an entry point script.\n* `--pid <pid>`: Attach to a running Node.js process by PID instead of\n  launching a child. This activates the inspector of the target process if it\n  is not active yet, then connects to `--host`:`--port`. See\n  [Attaching to a running process](#attaching-to-a-running-process).\n* `--` is optional unless the child needs its own Node.js flags.\n\nAdditional rules about the composition of the options:\n\n* `--probe <file>:<line>[:<col>]` and `--expr <expr>` are strict pairs. Each\n  `--probe` must be followed immediately by exactly one `--expr`.\n* `--cond <expr>` and `--max-hit <n>` are optional modifiers written *after* the\n  `--probe`/`--expr` pair they apply to, each at most once per pair. They may not\n  appear before the first `--probe` or between a `--probe` and its matching\n  `--expr`.\n* `--max-hit` scopes to the `--probe`/`--expr` pair it follows, so pairs\n  sharing a location may set different limits. `--cond` scopes to the whole\n  location, probes sharing a location must share one condition (or none).\n* `--timeout`, `--json`, `--preview`, and `--port` are global probe options\n  for the whole probe session. They may appear before or between probe pairs,\n  but not between a `--probe` and its matching `--expr`.\n* If additional Node.js execution arguments need to be passed to the child\n  script, `--` must be used to separate the probe options from the Node.js\n  options for the child script.\n\nExample:\n\n```console\n$ node inspect --probe app.js:10 --expr \"user\"\n               --probe src/utils.js:5:15 --expr \"config.options\"\n               --json --preview -- --no-warnings app.js --arg-for-app=foo\n```",
      "summary": "`node inspect` supports a non-interactive probe mode for inspecting runtime values in an application via the flag `--probe`.",
      "examples": [
        {
          "language": "console",
          "displayName": null,
          "code": "# To launch a new process and probe it:\n$ node inspect --probe <file>:<line>[:<col>] --expr <expr> [--cond <expr>] [--max-hit <n>]\n              [--probe <file>:<line>[:<col>] --expr <expr> [--cond <expr>] [--max-hit <n>] ...]\n              [--json] [--preview] [--timeout=<ms>] [--port=<port>]\n              [--] [<node-option> ...] <script> [<script-args> ...]\n\n# To activate the inspector in an already-running process and probe it:\n$ node inspect --probe <file>:<line>[:<col>] --expr <expr> [...] --pid <pid> [--host <host>] [--port <port>]\n\n# To probe a running process whose inspector is already listening for connections:\n$ node inspect --probe <file>:<line>[:<col>] --expr <expr> [...] --host <host> [--port <port>]\n$ node inspect --probe <file>:<line>[:<col>] --expr <expr> [...] --port <port> [--host <host>]"
        },
        {
          "language": "console",
          "displayName": null,
          "code": "$ node inspect --probe app.js:10 --expr \"user\"\n               --probe src/utils.js:5:15 --expr \"config.options\"\n               --json --preview -- --no-warnings app.js --arg-for-app=foo"
        }
      ],
      "children": [
        {
          "kind": "section",
          "id": "attaching-to-a-running-process",
          "name": "Attaching to a running process",
          "title": "Attaching to a running process",
          "scope": "module",
          "overloadOf": null,
          "stability": null,
          "added": [],
          "deprecated": [],
          "removed": [],
          "napiVersion": [],
          "changes": [],
          "description": "When the entry point script is not specified and `--probe` is used, probe mode can attach\nto a process that is already running instead of launching a child process.\nThis is useful for probing a long-running application, when users want to inspect runtime\nvalues without restarting it.\n\nWhen `--pid` is specified, probe mode activates the inspector of the process by\nsending `SIGUSR1` on POSIX platforms. The process must be a Node.js process,\notherwise it may be terminated by `SIGUSR1`. The probing process will retry\nconnecting using `--host` and `--port` until the timeout fires.\nIf `--pid` is not specified, the inspector in the target process must already be listening.\nIf the connection is refused, an error is reported immediately.\n\n```console\n# Probing a process by PID, which may not already have the inspector listening.\n# End the probing session when the specified probe is reached 5 times.\n$ node inspect --probe app.js:42 --expr \"req.url\" --max-hit 5 --pid 12345\n\n# Probing a process that's already listening for inspector connections at 127.0.0.1:9229.\n# End the probing session when the specified timeout is reached.\n$ node inspect --probe app.js:42 --expr \"req.url\" --timeout 50000 --host 127.0.0.1 --port 9229\n```\n\nProbing by attaching to a process differs from launching one in several ways.\n\n* The scripts are already loaded in the process when the breakpoints are bound,\n  and the `locations` field for each probe in the report shows where it bound.\n  An empty list indicates that no loaded script matched the probe, e.g.\n  when there's a typo in the path or the line.\n* When the probing session ends, it resumes and detaches from the probed process.\n  The target should continue running and **its inspector will remain activated**.\n  Probe mode does not kill a process it did not launch.\n* If the target is waiting for `--inspect-brk` or `--inspect-wait` when the\n  session attaches to it, these would be released so that the probes can run.\n* An attach session ends when one of the following happens:\n  * A probe reaches `--max-hit`. The report ends with `completed`.\n  * The target finishes on its own. The report ends with `completed`, or\n    with `miss` when some probes are never hit. The target is then allowed to\n    exit.\n  * The target exits with an uncaught exception. The report ends with `probe_target_exit`\n    and an `error` that describes the exception. The probing process exits with code 0.\n  * `--timeout` fires. The report ends with `timeout` and the hits recorded\n    so far, and the probing process exits with code 0. If a probe expression\n    is still running at that point, the session reports an `error` and exits\n    with code 1 instead. The expression is terminated after at most another\n    `--timeout`, unless it is blocked inside a native call, and the target\n    then resumes.\n  * The target does not respond during startup within `--timeout`, for\n    example because its main thread is blocked for synchronous work. The\n    report then ends with an `error`, and the probing process exits with code 1.\n* If the target is killed during the session, the session ends with an\n  `error`. If it's attached via `--pid`, this is reported as\n  `probe_target_exit` with exit code 0. If it's attached via `--host` and `--port`,\n  an exit cannot be distinguished from a network failure, so it is reported as\n  `probe_failure` with a non-zero exit code.\n* The target's stdout and stderr are not captured, so the terminal `error`\n  events have no `error.stderr` field.",
          "summary": "When the entry point script is not specified and `--probe` is used, probe mode can attach to a process that is already running instead of launching a child process. This is useful for probing a long-running application, when users want to inspect runtime values without restarting it.",
          "examples": [
            {
              "language": "console",
              "displayName": null,
              "code": "# Probing a process by PID, which may not already have the inspector listening.\n# End the probing session when the specified probe is reached 5 times.\n$ node inspect --probe app.js:42 --expr \"req.url\" --max-hit 5 --pid 12345\n\n# Probing a process that's already listening for inspector connections at 127.0.0.1:9229.\n# End the probing session when the specified timeout is reached.\n$ node inspect --probe app.js:42 --expr \"req.url\" --timeout 50000 --host 127.0.0.1 --port 9229"
            }
          ],
          "children": []
        },
        {
          "kind": "section",
          "id": "probe-output-format",
          "name": "Probe output format",
          "title": "Probe output format",
          "scope": "module",
          "overloadOf": null,
          "stability": null,
          "added": [],
          "deprecated": [],
          "removed": [],
          "napiVersion": [],
          "changes": [],
          "description": "When the probe session ends, the probing process prints a final report of all the probe hits and results.\n\nConsider this script:\n\n```js\n// cli.js\nlet maxRSS = 0;\nfor (let i = 0; i < 2; i++) {\n  const { rss } = process.memoryUsage();\n  maxRSS = Math.max(maxRSS, rss);\n}\n```\n\nWithout `--json`, by default the output is printed in a human-readable text format:\n\n```console\n$ node inspect --probe cli.js:5 --expr 'rss' cli.js\nHit 1 at file:///path/to/cli.js:5:3\n  rss = 54935552\nHit 2 at file:///path/to/cli.js:5:3\n  rss = 55083008\nCompleted\n```\n\nThe original `<file>:<line>[:<col>]` passed to `--probe` may be resolved to a different\nlocation to ensure it's pausable, or it can match multiple loaded scripts, so the actual\nevaluation location helps disambiguate the results.\n\nPrimitive results are printed directly, while objects and arrays use Chrome\nDevTools Protocol preview data when available. Other non-primitive values\nfall back to the Chrome DevTools Protocol `description` string.\nExpression failures are recorded as `[error] ...` lines and do not fail\nthe overall session. If richer text formatting is needed, wrap the expression\nin `JSON.stringify(...)` or `util.inspect(...)`.\n\nWhen `--json` is used, the output shape looks like this:\n\n```console\n$ node inspect --json --probe cli.js:5 --expr 'rss' cli.js\n{\"v\":2,\"target\":{\"argv\":[\"cli.js\"]},\"probes\":[{\"expr\":\"rss\",\"target\":{\"suffix\":\"cli.js\",\"line\":5},\"locations\":[{\"url\":\"file:///path/to/cli.js\",\"line\":5,\"column\":3}]}],\"results\":[{\"probe\":0,\"event\":\"hit\",\"hit\":1,\"location\":{\"url\":\"file:///path/to/cli.js\",\"line\":5,\"column\":3},\"result\":{\"type\":\"number\",\"value\":55443456,\"description\":\"55443456\"}},{\"probe\":0,\"event\":\"hit\",\"hit\":2,\"location\":{\"url\":\"file:///path/to/cli.js\",\"line\":5,\"column\":3},\"result\":{\"type\":\"number\",\"value\":55574528,\"description\":\"55574528\"}},{\"event\":\"completed\"}]}\n```\n\n```json\n{\n  \"v\": 2, // Probe JSON schema version.\n  \"target\": {\n    // Describes what was probed. The shape depends on how the session was started:\n    //   launch mode: { \"argv\": [\"cli.js\"] }\n    //   --pid <pid>: { \"pid\": 12345, \"host\": \"127.0.0.1\", \"port\": 9229 }\n    //   --host/--port: { \"host\": \"127.0.0.1\", \"port\": 9229 }\n    \"argv\": [\"cli.js\"]\n  },\n  \"probes\": [\n    {\n      \"expr\": \"rss\", // The expression paired with --probe.\n      \"target\": {\n        // The user's probe specification. `suffix` is the raw <file> passed\n        // to --probe and is matched as a path-separator-anchored suffix\n        // against every loaded script's URL. `column` is present only if the\n        // user supplied `:col`. The actual evaluation location may differ\n        // from the target and will be reported in each hit's `location` field.\n        \"suffix\": \"cli.js\",\n        \"line\": 5\n      },\n      // Locations where the probe's breakpoint is bound. The shape is the same as the `location`\n      // of a hit. There is one entry per matching script, and it's empty when no loaded script\n      // matches the target, or when the session ends before the probe is bound.\n      \"locations\": [\n        { \"url\": \"file:///path/to/cli.js\", \"line\": 5, \"column\": 3 }\n      ]\n      // `condition` is present only when the probe was given a --cond expression.\n      // `maxHit` is present only when the probe was given a --max-hit limit.\n    }\n  ],\n  \"results\": [\n    {\n      \"probe\": 0, // Index into probes[].\n      \"event\": \"hit\", // Hit events are recorded in observation order.\n      \"hit\": 1, // 1-based hit count for this probe.\n      \"location\": {\n        // The actual location where the execution is paused to evaluate\n        // the expression of the probe. This may differ from the probe's\n        // target due to pausability adjustments or multiple matches.\n        \"url\": \"file:///path/to/cli.js\",\n        \"line\": 5,\n        \"column\": 3\n      },\n      \"result\": {\n        \"type\": \"number\",\n        \"value\": 55443456,\n        \"description\": \"55443456\"\n      }\n      // If the probe expression throws, fails, or never completes, the entry\n      // carries an `error` field instead of `result` with the shape\n      // `{ message: string, details?: object }`. The `message` and `details`\n      // content is informational only and may change between releases.\n    },\n    {\n      \"probe\": 0,\n      \"event\": \"hit\",\n      \"hit\": 2,\n      \"location\": { \"url\": \"file:///path/to/cli.js\", \"line\": 5, \"column\": 3 },\n      \"result\": {\n        \"type\": \"number\",\n        \"value\": 55574528,\n        \"description\": \"55574528\"\n      }\n    },\n    {\n      \"event\": \"completed\"\n      // The final entry is always a terminal event, for example:\n      // 1. { \"event\": \"completed\" }\n      // 2. { \"event\": \"miss\", \"pending\": [0, 1] }\n      // 3. {\n      //      \"event\": \"timeout\",\n      //      \"pending\": [0],\n      //      \"error\": {\n      //       \"code\": \"probe_timeout\",\n      //       \"message\": \"Timed out after 30000ms waiting for probes: app.js:10\"\n      //      }\n      //    }\n      // 4. {\n      //      \"event\": \"error\",\n      //      \"pending\": [0],\n      //      \"error\": {\n      //       \"code\": \"probe_target_exit\",\n      //       \"exitCode\": 1,\n      //       \"stderr\": \"Error: boom\",\n      //       \"message\": \"Target exited with code 1 before probes: app.js:10\"\n      //      }\n      //    }\n      // 5. {\n      //      \"event\": \"error\",\n      //      \"pending\": [1],\n      //      \"error\": {\n      //       \"code\": \"probe_failure\",\n      //       \"probe\": 0,\n      //       \"stderr\": \"...\",\n      //       \"message\": \"Target process exited during probe evaluation before probes: app.js:12. If the failure repeats, review the probe expression.\",\n      //       \"details\": { \"lastCdpMethod\": \"Debugger.evaluateOnCallFrame\" }\n      //      }\n      //    }\n    }\n  ]\n}\n```",
          "summary": "When the probe session ends, the probing process prints a final report of all the probe hits and results.",
          "examples": [
            {
              "language": "js",
              "displayName": null,
              "code": "// cli.js\nlet maxRSS = 0;\nfor (let i = 0; i < 2; i++) {\n  const { rss } = process.memoryUsage();\n  maxRSS = Math.max(maxRSS, rss);\n}"
            },
            {
              "language": "console",
              "displayName": null,
              "code": "$ node inspect --probe cli.js:5 --expr 'rss' cli.js\nHit 1 at file:///path/to/cli.js:5:3\n  rss = 54935552\nHit 2 at file:///path/to/cli.js:5:3\n  rss = 55083008\nCompleted"
            },
            {
              "language": "console",
              "displayName": null,
              "code": "$ node inspect --json --probe cli.js:5 --expr 'rss' cli.js\n{\"v\":2,\"target\":{\"argv\":[\"cli.js\"]},\"probes\":[{\"expr\":\"rss\",\"target\":{\"suffix\":\"cli.js\",\"line\":5},\"locations\":[{\"url\":\"file:///path/to/cli.js\",\"line\":5,\"column\":3}]}],\"results\":[{\"probe\":0,\"event\":\"hit\",\"hit\":1,\"location\":{\"url\":\"file:///path/to/cli.js\",\"line\":5,\"column\":3},\"result\":{\"type\":\"number\",\"value\":55443456,\"description\":\"55443456\"}},{\"probe\":0,\"event\":\"hit\",\"hit\":2,\"location\":{\"url\":\"file:///path/to/cli.js\",\"line\":5,\"column\":3},\"result\":{\"type\":\"number\",\"value\":55574528,\"description\":\"55574528\"}},{\"event\":\"completed\"}]}"
            },
            {
              "language": "json",
              "displayName": null,
              "code": "{\n  \"v\": 2, // Probe JSON schema version.\n  \"target\": {\n    // Describes what was probed. The shape depends on how the session was started:\n    //   launch mode: { \"argv\": [\"cli.js\"] }\n    //   --pid <pid>: { \"pid\": 12345, \"host\": \"127.0.0.1\", \"port\": 9229 }\n    //   --host/--port: { \"host\": \"127.0.0.1\", \"port\": 9229 }\n    \"argv\": [\"cli.js\"]\n  },\n  \"probes\": [\n    {\n      \"expr\": \"rss\", // The expression paired with --probe.\n      \"target\": {\n        // The user's probe specification. `suffix` is the raw <file> passed\n        // to --probe and is matched as a path-separator-anchored suffix\n        // against every loaded script's URL. `column` is present only if the\n        // user supplied `:col`. The actual evaluation location may differ\n        // from the target and will be reported in each hit's `location` field.\n        \"suffix\": \"cli.js\",\n        \"line\": 5\n      },\n      // Locations where the probe's breakpoint is bound. The shape is the same as the `location`\n      // of a hit. There is one entry per matching script, and it's empty when no loaded script\n      // matches the target, or when the session ends before the probe is bound.\n      \"locations\": [\n        { \"url\": \"file:///path/to/cli.js\", \"line\": 5, \"column\": 3 }\n      ]\n      // `condition` is present only when the probe was given a --cond expression.\n      // `maxHit` is present only when the probe was given a --max-hit limit.\n    }\n  ],\n  \"results\": [\n    {\n      \"probe\": 0, // Index into probes[].\n      \"event\": \"hit\", // Hit events are recorded in observation order.\n      \"hit\": 1, // 1-based hit count for this probe.\n      \"location\": {\n        // The actual location where the execution is paused to evaluate\n        // the expression of the probe. This may differ from the probe's\n        // target due to pausability adjustments or multiple matches.\n        \"url\": \"file:///path/to/cli.js\",\n        \"line\": 5,\n        \"column\": 3\n      },\n      \"result\": {\n        \"type\": \"number\",\n        \"value\": 55443456,\n        \"description\": \"55443456\"\n      }\n      // If the probe expression throws, fails, or never completes, the entry\n      // carries an `error` field instead of `result` with the shape\n      // `{ message: string, details?: object }`. The `message` and `details`\n      // content is informational only and may change between releases.\n    },\n    {\n      \"probe\": 0,\n      \"event\": \"hit\",\n      \"hit\": 2,\n      \"location\": { \"url\": \"file:///path/to/cli.js\", \"line\": 5, \"column\": 3 },\n      \"result\": {\n        \"type\": \"number\",\n        \"value\": 55574528,\n        \"description\": \"55574528\"\n      }\n    },\n    {\n      \"event\": \"completed\"\n      // The final entry is always a terminal event, for example:\n      // 1. { \"event\": \"completed\" }\n      // 2. { \"event\": \"miss\", \"pending\": [0, 1] }\n      // 3. {\n      //      \"event\": \"timeout\",\n      //      \"pending\": [0],\n      //      \"error\": {\n      //       \"code\": \"probe_timeout\",\n      //       \"message\": \"Timed out after 30000ms waiting for probes: app.js:10\"\n      //      }\n      //    }\n      // 4. {\n      //      \"event\": \"error\",\n      //      \"pending\": [0],\n      //      \"error\": {\n      //       \"code\": \"probe_target_exit\",\n      //       \"exitCode\": 1,\n      //       \"stderr\": \"Error: boom\",\n      //       \"message\": \"Target exited with code 1 before probes: app.js:10\"\n      //      }\n      //    }\n      // 5. {\n      //      \"event\": \"error\",\n      //      \"pending\": [1],\n      //      \"error\": {\n      //       \"code\": \"probe_failure\",\n      //       \"probe\": 0,\n      //       \"stderr\": \"...\",\n      //       \"message\": \"Target process exited during probe evaluation before probes: app.js:12. If the failure repeats, review the probe expression.\",\n      //       \"details\": { \"lastCdpMethod\": \"Debugger.evaluateOnCallFrame\" }\n      //      }\n      //    }\n    }\n  ]\n}"
            }
          ],
          "children": []
        },
        {
          "kind": "section",
          "id": "output-and-exit-codes",
          "name": "Output and exit codes",
          "title": "Output and exit codes",
          "scope": "module",
          "overloadOf": null,
          "stability": null,
          "added": [],
          "deprecated": [],
          "removed": [],
          "napiVersion": [],
          "changes": [],
          "description": "Probe mode only prints the final probe report to stdout. If the probed process is launched by\nprobe mode, the stdout/stderr of the child process is silenced. When the probing session ends,\nthe probing process typically exits with code `0` and prints a final report to\nstdout. If the child process exits with a non-zero code before the probe\nsession ends, or the probe session cannot complete for another reason, the\nfinal report records a terminal `error` event.\n\nWhen `error.code` is `'probe_failure'`, the probing process exits with a\nnon-zero code, indicating recorded hits may be incomplete. In this case,\n`error.message` will contain recovery hints, and `error.probe`, when present,\nis an index into the report's `probes` array that identifies the possible\nculprit probe on a best-effort basis to help guide debugging.\n\nWhen `error.code` is `'probe_timeout'`, the probing process exits with a\nnon-zero code if it launched the process, and with `0` if it attached to a\nrunning process, where the timeout is considered a normal end of the session. See\n[Attaching to a running process](#attaching-to-a-running-process).\n\nInvalid arguments and fatal launch or connect failures may cause the\nprobing process to exit with a non-zero code and print an error message\nto stderr without a final probe report.",
          "summary": "Probe mode only prints the final probe report to stdout. If the probed process is launched by probe mode, the stdout/stderr of the child process is silenced. When the probing session ends, the probing process typically exits with code `0` and prints a final report to stdout. If the child process exits with a non-zero code before the probe session ends, or the probe session cannot complete for another reason, the final report records a terminal `error` event.",
          "examples": [],
          "children": []
        },
        {
          "kind": "section",
          "id": "probing-multiple-expressions-at-the-same-execution-point",
          "name": "Probing multiple expressions at the same execution point",
          "title": "Probing multiple expressions at the same execution point",
          "scope": "module",
          "overloadOf": null,
          "stability": null,
          "added": [],
          "deprecated": [],
          "removed": [],
          "napiVersion": [],
          "changes": [],
          "description": "When multiple `--probe`/`--expr` pairs share the same `--probe`, the\nexpressions will be evaluated on the same pause in the order they appear\non the command line.\n\nFor each location, there can only be at most one `--cond` (or none).\nMultiple `--probe`/`--expr` pairs with conflicting conditions\nat the same location will be rejected at launch time.\n\n```js\n// app.js\nconst x = { x: 42 };       // line 2\nconst y = { y: 35 };       // line 3\nconst z = { ...x, ...y };  // line 4\n```\n\n```console\n$ node inspect --probe app.js:4 --expr 'x' --probe app.js:4 --expr 'y' -- app.js\n```\n\nPrints\n\n```text\nHit 1 at file:///path/to/app.js:4:1\n  x = {x: 42}\nHit 1 at file:///path/to/app.js:4:1\n  y = {y: 35}\nCompleted\n```\n\n```console\n$ node inspect --probe app.js:4 --expr 'x' --probe app.js:4 --expr 'y' --json --preview -- app.js\n```\n\nPrints\n\n```json\n{\"v\":2,\"probes\":[{\"expr\":\"x\",\"target\":{\"suffix\":\"app.js\",\"line\":4}},{\"expr\":\"y\",\"target\":{\"suffix\":\"app.js\",\"line\":4}}],\"results\":[{\"probe\":0,\"event\":\"hit\",\"hit\":1,\"location\":{\"url\":\"file:///path/to/app.js\",\"line\":4,\"column\":1},\"result\":{\"type\":\"object\",\"description\":\"Object\",\"preview\":{\"type\":\"object\",\"description\":\"Object\",\"overflow\":false,\"properties\":[{\"name\":\"x\",\"type\":\"number\",\"value\":\"42\"}]}}},{\"probe\":1,\"event\":\"hit\",\"hit\":1,\"location\":{\"url\":\"file:///path/to/app.js\",\"line\":4,\"column\":1},\"result\":{\"type\":\"object\",\"description\":\"Object\",\"preview\":{\"type\":\"object\",\"description\":\"Object\",\"overflow\":false,\"properties\":[{\"name\":\"y\",\"type\":\"number\",\"value\":\"35\"}]}}},{\"event\":\"completed\"}]}\n```",
          "summary": "When multiple `--probe`/`--expr` pairs share the same `--probe`, the expressions will be evaluated on the same pause in the order they appear on the command line.",
          "examples": [
            {
              "language": "js",
              "displayName": null,
              "code": "// app.js\nconst x = { x: 42 };       // line 2\nconst y = { y: 35 };       // line 3\nconst z = { ...x, ...y };  // line 4"
            },
            {
              "language": "console",
              "displayName": null,
              "code": "$ node inspect --probe app.js:4 --expr 'x' --probe app.js:4 --expr 'y' -- app.js"
            },
            {
              "language": "text",
              "displayName": null,
              "code": "Hit 1 at file:///path/to/app.js:4:1\n  x = {x: 42}\nHit 1 at file:///path/to/app.js:4:1\n  y = {y: 35}\nCompleted"
            },
            {
              "language": "console",
              "displayName": null,
              "code": "$ node inspect --probe app.js:4 --expr 'x' --probe app.js:4 --expr 'y' --json --preview -- app.js"
            },
            {
              "language": "json",
              "displayName": null,
              "code": "{\"v\":2,\"probes\":[{\"expr\":\"x\",\"target\":{\"suffix\":\"app.js\",\"line\":4}},{\"expr\":\"y\",\"target\":{\"suffix\":\"app.js\",\"line\":4}}],\"results\":[{\"probe\":0,\"event\":\"hit\",\"hit\":1,\"location\":{\"url\":\"file:///path/to/app.js\",\"line\":4,\"column\":1},\"result\":{\"type\":\"object\",\"description\":\"Object\",\"preview\":{\"type\":\"object\",\"description\":\"Object\",\"overflow\":false,\"properties\":[{\"name\":\"x\",\"type\":\"number\",\"value\":\"42\"}]}}},{\"probe\":1,\"event\":\"hit\",\"hit\":1,\"location\":{\"url\":\"file:///path/to/app.js\",\"line\":4,\"column\":1},\"result\":{\"type\":\"object\",\"description\":\"Object\",\"preview\":{\"type\":\"object\",\"description\":\"Object\",\"overflow\":false,\"properties\":[{\"name\":\"y\",\"type\":\"number\",\"value\":\"35\"}]}}},{\"event\":\"completed\"}]}"
            }
          ],
          "children": []
        },
        {
          "kind": "section",
          "id": "selecting-the-probe-location",
          "name": "Selecting the probe location",
          "title": "Selecting the probe location",
          "scope": "module",
          "overloadOf": null,
          "stability": null,
          "added": [],
          "deprecated": [],
          "removed": [],
          "napiVersion": [],
          "changes": [],
          "description": "The expressions are evaluated in the lexical scope of the probe location when\nexecution reaches it. Avoid probing a variable declared by `let` or `const` at its\ndeclaration site, as this leads to a `ReferenceError` caused by\naccessing the variable in its temporal dead zone (TDZ).\n\n```js\n// app.js\nconst x = 42;        // line 2\nconsole.log(x);      // line 3\n```\n\n```console\n$ node inspect --probe app.js:1 --expr 'x' app.js\nHit 1 at file:///path/to/app.js:1:1\n  [error] x = ReferenceError: Cannot access 'x' from debugger\n  ...\nCompleted\n```\n\nInstead, probe at a location where the variable is already initialized:\n\n```console\n$ node inspect --probe app.js:3 --expr 'x' app.js\nHit 1 at file:///path/to/app.js:3:1\n  x = 42\nCompleted\n```\n\nThe `<file>` argument is matched as a path suffix of every loaded\nscript URL, anchored on a path separator. Passing only a basename\nmatches every loaded script with that basename, similar to how native\ndebuggers typically match breakpoints, while passing a partial path\nnarrows the match. Given:\n\n```text\nproject/\n  - src/utils.js\n  - lib/utils.js\n```\n\n`--probe utils.js:10` binds to *both* files and produces one hit per match.\nEach hit carries its own `location` field identifying where the expression\nwas actually executed, so consumers can attribute the result to one of the\ntwo files accurately. To disambiguate at bind time, specify a fuller path\nthat only matches the intended file:\n\n```console\n$ node inspect --probe src/utils.js:10 --expr 'x' main.js   # matches only src/utils.js\n```",
          "summary": "The expressions are evaluated in the lexical scope of the probe location when execution reaches it. Avoid probing a variable declared by `let` or `const` at its declaration site, as this leads to a `ReferenceError` caused by accessing the variable in its temporal dead zone (TDZ).",
          "examples": [
            {
              "language": "js",
              "displayName": null,
              "code": "// app.js\nconst x = 42;        // line 2\nconsole.log(x);      // line 3"
            },
            {
              "language": "console",
              "displayName": null,
              "code": "$ node inspect --probe app.js:1 --expr 'x' app.js\nHit 1 at file:///path/to/app.js:1:1\n  [error] x = ReferenceError: Cannot access 'x' from debugger\n  ...\nCompleted"
            },
            {
              "language": "console",
              "displayName": null,
              "code": "$ node inspect --probe app.js:3 --expr 'x' app.js\nHit 1 at file:///path/to/app.js:3:1\n  x = 42\nCompleted"
            },
            {
              "language": "text",
              "displayName": null,
              "code": "project/\n  - src/utils.js\n  - lib/utils.js"
            },
            {
              "language": "console",
              "displayName": null,
              "code": "$ node inspect --probe src/utils.js:10 --expr 'x' main.js   # matches only src/utils.js"
            }
          ],
          "children": []
        },
        {
          "kind": "section",
          "id": "probe-examples",
          "name": "Probe examples",
          "title": "Probe examples",
          "scope": "module",
          "overloadOf": null,
          "stability": null,
          "added": [],
          "deprecated": [],
          "removed": [],
          "napiVersion": [],
          "changes": [],
          "description": "",
          "summary": "",
          "examples": [],
          "children": [
            {
              "kind": "section",
              "id": "probing-a-variable-conditionally",
              "name": "Probing a variable conditionally",
              "title": "Probing a variable conditionally",
              "scope": "module",
              "overloadOf": null,
              "stability": null,
              "added": [],
              "deprecated": [],
              "removed": [],
              "napiVersion": [],
              "changes": [],
              "description": "```js\n// app.js\nlet total = 0;\nfor (let i = 0; i < 10; i++) {\n  total += i;  // line 4\n}\n```\n\n```console\n$ out/Release/node inspect --probe app.js:4 --expr 'total' \\\n                           --cond 'i % 3 === 0' app.js\n```\n\n```text\nHit 1 at file:///path/to/app.js:3:3\n  total = 0\nHit 2 at file:///path/to/app.js:3:3\n  total = 3\nHit 3 at file:///path/to/app.js:3:3\n  total = 15\nHit 4 at file:///path/to/app.js:3:3\n  total = 36\nCompleted\n```",
              "summary": "",
              "examples": [
                {
                  "language": "js",
                  "displayName": null,
                  "code": "// app.js\nlet total = 0;\nfor (let i = 0; i < 10; i++) {\n  total += i;  // line 4\n}"
                },
                {
                  "language": "console",
                  "displayName": null,
                  "code": "$ out/Release/node inspect --probe app.js:4 --expr 'total' \\\n                           --cond 'i % 3 === 0' app.js"
                },
                {
                  "language": "text",
                  "displayName": null,
                  "code": "Hit 1 at file:///path/to/app.js:3:3\n  total = 0\nHit 2 at file:///path/to/app.js:3:3\n  total = 3\nHit 3 at file:///path/to/app.js:3:3\n  total = 15\nHit 4 at file:///path/to/app.js:3:3\n  total = 36\nCompleted"
                }
              ],
              "children": []
            }
          ]
        }
      ]
    },
    {
      "kind": "section",
      "id": "advanced-usage",
      "name": "Advanced usage",
      "title": "Advanced usage",
      "scope": "module",
      "overloadOf": null,
      "stability": null,
      "added": [],
      "deprecated": [],
      "removed": [],
      "napiVersion": [],
      "changes": [],
      "description": "",
      "summary": "",
      "examples": [],
      "children": [
        {
          "kind": "section",
          "id": "v8-inspector-integration-for-nodejs",
          "name": "V8 inspector integration for Node.js",
          "title": "V8 inspector integration for Node.js",
          "scope": "module",
          "overloadOf": null,
          "stability": null,
          "added": [],
          "deprecated": [],
          "removed": [],
          "napiVersion": [],
          "changes": [],
          "description": "V8 Inspector integration allows attaching Chrome DevTools to Node.js\ninstances for debugging and profiling. It uses the\n[Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n\nV8 Inspector can be enabled by passing the `--inspect` flag when starting a\nNode.js application. It is also possible to supply a custom port with that flag,\ne.g. `--inspect=9222` will accept DevTools connections on port 9222.\n\nUsing the `--inspect` flag will execute the code immediately before debugger is connected.\nThis means that the code will start running before you can start debugging, which might\nnot be ideal if you want to debug from the very beginning.\n\nIn such cases, you have two alternatives:\n\n1. `--inspect-wait` flag: This flag will wait for debugger to be attached before executing the code.\n   This allows you to start debugging right from the beginning of the execution.\n2. `--inspect-brk` flag: Unlike `--inspect`, this flag will break on the first line of the code\n   as soon as debugger is attached. This is useful when you want to debug the code step by step\n   from the very beginning, without any code execution prior to debugging.\n\nSo, when deciding between `--inspect`, `--inspect-wait`, and `--inspect-brk`, consider whether you want\nthe code to start executing immediately, wait for debugger to be attached before execution,\nor break on the first line for step-by-step debugging.\n\n```console\n$ node --inspect index.js\nDebugger listening on ws://127.0.0.1:9229/dc9010dd-f8b8-4ac5-a510-c1a114ec7d29\nFor help, see: https://nodejs.org/learn/getting-started/debugging\n```\n\n(In the example above, the UUID dc9010dd-f8b8-4ac5-a510-c1a114ec7d29\nat the end of the URL is generated on the fly, it varies in different\ndebugging sessions.)",
          "summary": "V8 Inspector integration allows attaching Chrome DevTools to Node.js instances for debugging and profiling. It uses the Chrome DevTools Protocol.",
          "examples": [
            {
              "language": "console",
              "displayName": null,
              "code": "$ node --inspect index.js\nDebugger listening on ws://127.0.0.1:9229/dc9010dd-f8b8-4ac5-a510-c1a114ec7d29\nFor help, see: https://nodejs.org/learn/getting-started/debugging"
            }
          ],
          "children": []
        }
      ]
    }
  ]
}