Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS Code debugger on Windows #251

Open
photex opened this issue Dec 3, 2023 · 0 comments
Open

VS Code debugger on Windows #251

photex opened this issue Dec 3, 2023 · 0 comments
Labels
C-enhancement New content that isn't covered already S-setup Dev tools / Environment Setup Z-small small task that should be quick to do

Comments

@photex
Copy link

photex commented Dec 3, 2023

Howdy!

The CodeLLDB plugin is very very slow on Windows unfortunately. However! The microsoft debugger works pretty well.

In order to use the debugger with dynamic bevy I'm using the following launch configuration:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "cppvsdbg",
            "name": "my_game",
            "program": "${workspaceFolder}/target/debug/my_game.exe",
            "cwd": "${workspaceFolder}",
            "request": "launch",
            "windows": {
                "environment": [
                    {
                        "name": "PATH",
                        "value": "${userHome}/.rustup/toolchains/nightly-x86_64-pc-windows-msvc/bin;${workspaceFolder}/target/debug/deps"
                    },
                    {
                        "name": "CARGO_MANIFEST_DIR",
                        "value": "${workspaceFolder}"
                    }
                ]
            },
            "preLaunchTask": "cargo build"
        }
    ]
}

In my tasks.json I have a build config called "cargo build":

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cargo",
			"command": "build",
			"problemMatcher": [
				"$rustc"
			],
			"group": {
				"kind": "build",
				"isDefault": true
			},
			"label": "cargo build",
			"presentation": {
				"echo": true,
				"reveal": "always",
				"focus": false,
				"panel": "shared",
				"showReuseMessage": false,
				"clear": true
			}
		}
	]
}

If you change your toolchain then update these paths to match. Because Rust puts the hash into artifact names it was a bit of a mystery why something wasn't loading when starting the debugger. It turned out I was writing 'stable' instead of 'nightly' there.
What cleared that up was to open a visual studio dev shell and use the dumpbin program to see the expected dll names (dumpbin /DEPENDENTS my_game.exe) at which point I realized my mistake.

@inodentry inodentry added C-enhancement New content that isn't covered already S-setup Dev tools / Environment Setup Z-small small task that should be quick to do labels Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement New content that isn't covered already S-setup Dev tools / Environment Setup Z-small small task that should be quick to do
Projects
None yet
Development

No branches or pull requests

2 participants