Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Beacon",
"skipFiles": ["<node_internals>/**"],
"smartStep": true,
"program": "${workspaceFolder}/packages/cli/bin/lodestar.js",
"args": ["beacon"],
Comment thread
jeluard marked this conversation as resolved.
Outdated
"console": "integratedTerminal"
},
{
"type": "node",
"request": "launch",
"name": "Dev",
"skipFiles": ["<node_internals>/**"],
"smartStep": true,
"program": "${workspaceFolder}/packages/cli/bin/lodestar.js",
"args": ["dev"],
"console": "integratedTerminal"
}
]
}
17 changes: 17 additions & 0 deletions docs/pages/tools/debugging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: Debugging
---

The simplest way to debug is to use the provided [launch.json](../../../.vscode/launch.json) `configurations`, made available in the `Run and Debug` section. Those configurations will start new `node` processes.
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();
```
2 changes: 1 addition & 1 deletion docs/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const sidebars: SidebarsConfig = {
{
type: "category",
label: "Tools",
items: ["tools/flamegraphs", "tools/heap-dumps", "tools/core-dumps"],
items: ["tools/debugging", "tools/flamegraphs", "tools/heap-dumps", "tools/core-dumps"],
},
{
type: "category",
Expand Down