Created
September 17, 2020 18:16
-
-
Save xanathar/c7c83e6d53b72dd4464f695607012629 to your computer and use it in GitHub Desktop.
launch.json to debug Rust with VsCode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// The following are sample configurations for common case scenarios of debugging | |
// Rust in Visual Studio Code | |
// | |
// For syntax, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
// | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Launch an application", | |
"type": "lldb", | |
"request": "launch", | |
"program": "${workspaceRoot}/path-to/the-executable", | |
"args": [ "arg1", "arg2" ], | |
"cwd": "${workspaceRoot}/path-to", | |
}, | |
{ | |
"name": "Attach to a named executable", | |
"type": "lldb", | |
"request": "attach", | |
"program": "${workspaceRoot}/path-to/the-executable", | |
}, | |
{ | |
"name": "Debug ALL unit tests in library 'mylib'", | |
"type": "lldb", | |
"request": "launch", | |
"cargo": { | |
"args": [ | |
"test", | |
"--no-run", | |
"--lib", | |
"--package=mylib" | |
], | |
"filter": { | |
"name": "mylib", | |
"kind": "lib" | |
} | |
}, | |
"args": [ ], | |
"cwd": "${workspaceFolder}" | |
}, | |
{ | |
"name": "Debug specific unit test in library 'mylib'", | |
"type": "lldb", | |
"request": "launch", | |
"cargo": { | |
"args": [ | |
"test", | |
"--no-run", | |
"--lib", | |
"--package=mylib" | |
], | |
"filter": { | |
"name": "mylib", | |
"kind": "lib" | |
} | |
}, | |
"args": [ "name_of_the_unit_test" ], | |
"cwd": "${workspaceFolder}" | |
}, | |
{ | |
"name": "Debug example 'some-example'", | |
"type": "lldb", | |
"request": "launch", | |
"cargo": { | |
"args": [ | |
"build", | |
"--example=some-example", | |
"--package=my-package" | |
], | |
"filter": { | |
"name": "some-example", | |
"kind": "example" | |
} | |
}, | |
"args": [], | |
"cwd": "${workspaceFolder}" | |
}, | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very useful, thank you!