762a5bbefa
- Move the debugging guides for VSCode and node-inspector into separate files. - Add instructions for using electron-inspector to the node-inspector guide. - Remove note in node-inspector guide about crashing when inspecting `process` (it was fixed a long time ago: https://github.com/nodejs/node-v0.x-archive/issues/8205)
29 lines
1 KiB
Markdown
29 lines
1 KiB
Markdown
# Debugging the Main Process
|
|
|
|
The DevTools in an Electron browser window can only debug JavaScript that's
|
|
executed in that window (i.e. the web pages). To debug JavaScript that's
|
|
executed in the main process you will need to use an external debugger and
|
|
launch Electron with the `--debug` or `--debug-brk` switch.
|
|
|
|
## Command Line Switches
|
|
|
|
Use one of the following command line switches to enable debugging of the main
|
|
process:
|
|
|
|
### `--debug=[port]`
|
|
|
|
Electron will listen for V8 debugger protocol messages on the specified `port`,
|
|
an external debugger will need to connect on this port. The default `port` is
|
|
`5858`.
|
|
|
|
### `--debug-brk=[port]`
|
|
|
|
Like `--debug` but pauses execution on the first line of JavaScript.
|
|
|
|
## External Debuggers
|
|
|
|
You will need to use a debugger that supports the V8 debugger protocol,
|
|
the following guides should help you to get started:
|
|
|
|
- [Debugging the Main Process in VSCode](debugging-main-process-vscode.md)
|
|
- [Debugging the Main Process in node-inspector](debugging-main-process-node-inspector.md)
|