Skip to content

Commit

Permalink
chore: review debugging section PR (#6807)
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig authored May 22, 2024
1 parent 992fdd4 commit 3c5bb15
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 3 additions & 2 deletions .vscode/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Adapt to your needs `launch.template.json` and copy as `launch.json`.
Follow `docs/pages/tools/debugging.md` for more details.
Copy `launch.template.json` as `launch.json` and adapt to your needs.

See [Debugging](../docs/pages/tools/debugging.md) for more details.
2 changes: 1 addition & 1 deletion .vscode/launch.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@
"description": "Enter the test name to run, leave empty to run all"
}
]
}
}
13 changes: 9 additions & 4 deletions docs/pages/tools/debugging.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
---
title: Debugging
---
# Debugging

This page describes different approaches for debugging Lodestar.

## VS Code launch config

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`. Copy them as `.vscode/launch.json` and they will be made available in the `Run and Debug` section in VS Code. Adapt as needed, e.g. by adding additional arguments to the beacon [configuration](https://github.com/ChainSafe/lodestar/blob/unstable/.vscode/launch.template.json#L22) to match your needs.

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.

## Attach to running process

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
Expand Down

0 comments on commit 3c5bb15

Please sign in to comment.