-
-
Notifications
You must be signed in to change notification settings - Fork 446
docs: added debugging section #6743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
380ca6c
docs: added debugging section
jeluard e466750
chore: spell checks
jeluard 2602805
chore: added extra docs
jeluard c377cdb
chore: address comments
jeluard 9f46933
chore: added extra configuration
jeluard bba30de
chore: updated docs
jeluard f9ca5b3
chore: added extra configuration
jeluard c160116
chore: fix lint
jeluard b15ac9c
chore: fix typos
jeluard 68b4875
chore: .gitignore
jeluard e507bea
chore: address comments
jeluard 0583033
chore: address comments
jeluard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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`. | ||
jeluard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Follow `docs/pages/tools/debugging.md` for more details. | ||
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.