Skip to content

Commit 6823e88

Browse files
eregonandrykonchin
authored andcommitted
Document the simplest way to use VSCode as a debugger for TruffleRuby
1 parent 9fd5c24 commit 6823e88

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

doc/user/debugging.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,41 @@ Also see [Tools](tools.md) for more tools besides just debuggers.
1414

1515
## VSCode
1616

17+
### Simple and Fast
18+
19+
1. Open VSCode in the project you want to debug:
20+
```bash
21+
$ cd /path/to/project
22+
$ code .
23+
```
24+
25+
1. Create a file `.vscode/launch.json` with this contents:
26+
27+
```json
28+
{
29+
"version": "0.2.0",
30+
"configurations": [
31+
{
32+
"name": "Attach",
33+
"type": "node",
34+
"request": "attach",
35+
"debugServer": 4711
36+
}
37+
]
38+
}
39+
```
40+
41+
3. Run TruffleRuby on the command line and pass `--dap`, e.g.
42+
```bash
43+
$ ruby --dap test.rb
44+
$ ruby --dap -Ilib test/some_test.rb
45+
$ TRUFFLERUBYOPT=--dap bundle exec rspec some_spec.rb
46+
```
47+
48+
4. In VSCode click on `Run` -> `Start Debugging`.
49+
50+
### With the GraalVM VSCode extension
51+
1752
First install [the GraalVM VSCode extension](https://marketplace.visualstudio.com/items?itemName=oracle-labs-graalvm.graalvm).
1853

1954
Then follow [this documentation](https://www.graalvm.org/latest/tools/vscode/graalvm-extension/polyglot-runtime/#debugging-ruby) to debug TruffleRuby with VSCode.

0 commit comments

Comments
 (0)