Skip to content
Merged
Changes from all 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
47 changes: 31 additions & 16 deletions src/toolchain/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,46 @@ you will only have symbols for stack frames in Rust code.

## Launching with VS Code

Here is an example launch configuration for Visual Studio Code. Launch configurations should be added to `./.vscode/launch.json`, relative
to your project's root. This example assumes you have the [CodeLLDB] extension installed, which is common for Rust development.
Here is an example debugger setup for Visual Studio Code. Launch configurations and tasks should be placed in`./.vscode/launch.json` and
`./.vscode/tasks.json` respectively, relative to your project's root.

This example assumes you have the [CodeLLDB] extension installed, which is common for Rust development.

For commands like `-w` (windowed mode) or `-e` (editor), refer to Godot's [command line tutorial][godot-command-line].

```json
// ./.vscode/launch.json
{
"configurations": [
{
"name": "Debug Project (Godot 4)",
"type": "lldb", // type provided by CodeLLDB extension
"request": "launch",
"preLaunchTask": "rust: cargo build",
"cwd": "${workspaceFolder}",
"cwd": "${workspaceFolder}/godot",
"preLaunchTask": "build-rust",
"args": [
"-w" // windowed mode
// "-e": editor does not keep breakpoints; thus not listed here.
],
Comment on lines 37 to 40
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here, you removed the -e and all comments. I understand why -e might not be preferrable as default choice, but you could still leave it there, commented-out, so that people who want it can quickly learn about it.

I don't see why you removed the comment for -w, it's not necessarily obvious what this argument does.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening it as editor with -e does not keep the breakpoints for LLDB. At least I was unable to make it work and I found several other sharing that problem on the discord.

I forgot mentioning this in my original PR description and will add it now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"program": "PATH/TO/GODOT"
}
]
}
```

```json
// ./.vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "build-rust",
"command": "cargo",
"args": [
"-e", // run editor (remove this to launch the scene directly)
"-w", // windowed mode
"build"
],
"linux": {
"program": "/usr/local/bin/godot4",
},
"windows": {
"program": "C:\\Program Files\\Godot\\Godot_v4.1.X.exe",
},
"osx": {
// NOTE: on macOS the Godot.app needs to be manually re-signed
// to enable debugging (see below)
"program": "/Applications/Godot.app/Contents/MacOS/Godot",
"options": {
"cwd": "${workspaceFolder}/rust"
}
}
]
Expand Down Expand Up @@ -97,3 +111,4 @@ in Terminal to complete the re-signing process. It is recommended to check this
re-sign their local installation if you have a team. This process should only be necessary once per Godot installation though.

[CodeLLDB]: https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb
[godot-command-line]: https://docs.godotengine.org/en/latest/tutorials/editor/command_line_tutorial.html#command-line-reference
Loading