-
-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
104 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Adapt to your needs `launch.template.json` and copy as `launch.json`. | ||
Follow `docs/pages/tools/debugging.md` for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"name": "Attach", | ||
"port": 9229, | ||
"request": "attach", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
] | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Beacon", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"smartStep": true, | ||
"program": "${workspaceFolder}/packages/cli/bin/lodestar.js", | ||
"args": [ | ||
"beacon" | ||
], | ||
"console": "integratedTerminal" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Dev", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"smartStep": true, | ||
"program": "${workspaceFolder}/packages/cli/bin/lodestar.js", | ||
"args": [ | ||
"dev" | ||
], | ||
"console": "integratedTerminal" | ||
}, | ||
{ | ||
"name": "Test Current File", | ||
"type": "node", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/node_modules/.bin/vitest", | ||
"args": [ | ||
"--run", | ||
"${file}", | ||
"-t", | ||
"${input:testName}", | ||
"--pool", | ||
"threads", | ||
"--poolOptions.threads.singleThread" | ||
], | ||
"cwd": "${workspaceFolder}/${input:packageName}", | ||
"console": "integratedTerminal", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
] | ||
} | ||
], | ||
"inputs": [ | ||
{ | ||
"id": "packageName", | ||
"type": "command", | ||
"command": "extension.commandvariable.transform", | ||
"args": { | ||
"text": "${relativeFileDirname}", | ||
"find": "^(packages/[^/]+).*", | ||
"replace": "$1" | ||
} | ||
}, | ||
{ | ||
"id": "testName", | ||
"type": "promptString", | ||
"description": "Enter the test name to run, leave empty to run all" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
title: Debugging | ||
--- | ||
|
||
The simplest way to debug is to use the provided [launch.template.json](https://github.com/ChainSafe/lodestar/blob/unstable/.vscode/launch.template.json) `configurations`. Adapt and copy them as `.vscode/launch.json`, and they will be made available in the `Run and Debug` section. Note that users probably want to adapt the arguments of the beacon [configuration](https://github.com/ChainSafe/lodestar/blob/unstable/.vscode/launch.json#L11) to match their needs. | ||
VS Code supports debugging Workers out of the box when using those configurations. | ||
|
||
Remote `lodestar` processes can also be debugged by leveraging [node:inspector](https://nodejs.org/api/inspector.html). Adding `--inspect` to the node CLI (e.g. `NODE_OPTIONS=--inspect ./lodestar beacon`) allows to debug the main thread. To debug a specific `Worker`, follow those steps: | ||
|
||
- remove `--inspect` from `node` CLI | ||
- add following code to the `worker` | ||
|
||
```js | ||
import inspector from "node:inspector"; | ||
inspector.open(); | ||
inspector.waitForDebugger(); | ||
``` | ||
|
||
Use VS Code or Chrome devtools to debug those processes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters