Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 240f076

Browse files
AE1020spastorinojyn514
authored
Add sample CodeLLDB launch.json (rust-lang#1482)
* Add sample CodeLLDB launch.json There is a section with [instructions for setting up source analyzer in VSCode](https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc), but nothing for setting up debugging with CodeLLDB. This adds a sample configuration that may not be ideal, but appears to work for me. To source highlight the snippet, uses JavaScript instead of JSON so that comments do not show up as errors highlighted in red (VSCode allows comments). * Update src/compiler-debugging.md Co-authored-by: jyn <[email protected]> * Update src/compiler-debugging.md Co-authored-by: jyn <[email protected]> --------- Co-authored-by: Santiago Pastorino <[email protected]> Co-authored-by: jyn <[email protected]>
1 parent 4092a74 commit 240f076

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/doc/rustc-dev-guide/src/compiler-debugging.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,3 +341,37 @@ error: aborting due to previous error
341341
```
342342

343343
[`Layout`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/abi/struct.Layout.html
344+
345+
346+
## Configuring CodeLLDB for debugging `rustc`
347+
348+
If you are using VSCode, and have edited your `config.toml` to request debugging
349+
level 1 or 2 for the parts of the code you're interested in, then you should be
350+
able to use the [CodeLLDB] extension in VSCode to debug it.
351+
352+
Here is a sample `launch.json` file, being used to run a stage 1 compiler direct
353+
from the directory where it is built (does not have to be "installed"):
354+
355+
```javascript
356+
// .vscode/launch.json
357+
{
358+
"version": "0.2.0",
359+
"configurations": [
360+
{
361+
"type": "lldb",
362+
"request": "launch",
363+
"name": "Launch",
364+
"args": [], // array of string command-line arguments to pass to compiler
365+
"program": "${workspaceFolder}/build/TARGET/stage1/bin/rustc",
366+
"windows": { // applicable if using windows
367+
"program": "${workspaceFolder}/build/x86_64-pc-windows-msvc/stage1/bin/rustc.exe"
368+
},
369+
"cwd": "${workspaceFolder}", // current working directory at program start
370+
"stopOnEntry": false,
371+
"sourceLanguages": ["rust"]
372+
}
373+
]
374+
}
375+
```
376+
377+
[CodeLLDB]: https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb

0 commit comments

Comments
 (0)