Skip to content

Commit a2d15c9

Browse files
authored
Add Windows-specific debugging instructions (Azure#2399)
* Add Windows-specific debugging instructions * Fix spelling lint
1 parent f6e00cc commit a2d15c9

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

.vscode/cspell.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
"clippy",
3232
"contoso",
3333
"cplusplus",
34+
"cpptools",
35+
"cppvsdbg",
3436
"datalake",
3537
"datetime",
3638
"devicecode",

CONTRIBUTING.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,77 @@ Similarly, if running on the command line pass `PROXY_MANUAL_START=true`.
139139
To log tracing information to the terminal, you can add the `RUST_LOG` environment variable as shown above using the [same format supported by `env_logger`](https://docs.rs/env_logger/latest/env_logger/#enabling-logging).
140140
The targets are the crate names if you want to trace more or less for specific targets e.g., `RUST_LOG=info,azure_core=trace` to trace information messages by default but detailed traces for the `azure_core` crate.
141141

142+
#### Debugging in Windows
143+
144+
Using the recommended [CodeLLDB] Visual Studio Code extension on Windows will stop at breakpoints but may not pretty print variables e.g.,
145+
for a `String` or `str` slice you may only see the length of UTF-8 bytes. See <https://github.com/vadimcn/codelldb/wiki/Windows> for suggestions.
146+
147+
Alternatively, you can install the [C/C++] extension and update configuration as described below.
148+
`String`, `str` slices, enums and more should pretty print as expected, but some types e.g., `PathBuf` may not; however,
149+
you can click the memory button next to a variable to see the contents in memory.
150+
151+
##### Debugging from within the Editor
152+
153+
To support debugging tests from within the editor, you can change your Visual Studio Code user settings as shown below:
154+
155+
```json
156+
{
157+
"rust-analyzer.debug.engine": "ms-vscode.cpptools",
158+
}
159+
```
160+
161+
##### Run and Debug
162+
163+
For debugging examples from the **Run and Debug** view in Visual Studio Code, add a target to your `.vscode/launch.json` file like so:
164+
165+
```json
166+
{
167+
"version": "0.2.0",
168+
"configurations": [
169+
{
170+
"type": "cppvsdbg",
171+
"request": "launch",
172+
"name": "Launch test_proxy",
173+
"program": "${workspaceRoot}/target/debug/examples/test_proxy.exe",
174+
"args": [
175+
"--auto"
176+
],
177+
"cwd": "${workspaceFolder}",
178+
"environment": [
179+
{
180+
"name": "RUST_LOG",
181+
"value": "debug,test-proxy=trace"
182+
}
183+
],
184+
"preLaunchTask": "Build test_proxy"
185+
}
186+
]
187+
}
188+
```
189+
190+
And update `.vscode/tasks.json` to add the `preLaunchTask` if desired:
191+
192+
```json
193+
{
194+
"tasks": [
195+
{
196+
"label": "Build test_proxy",
197+
"command": "cargo",
198+
"args": [
199+
"build",
200+
"--package",
201+
"azure_core_test",
202+
"--example",
203+
"test_proxy"
204+
],
205+
"problemMatcher": [
206+
"$rustc"
207+
]
208+
}
209+
]
210+
}
211+
```
212+
142213
## Code Review Process
143214

144215
Before a pull request will be considered by the Azure SDK team, the following requirements must be met:
@@ -213,6 +284,8 @@ Samples may take the following categories of dependencies:
213284

214285
In general, we prefer taking dependencies on licensed components in the order of the listed categories. In cases where the category may not be well known, we'll document the category so that readers understand the choice that they're making by using that dependency.
215286

287+
[C/C++]: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
288+
[CodeLLDB]: https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb
216289
[Rust Guidelines]: https://azure.github.io/azure-sdk/rust_introduction.html
217290
[Test Proxy]: https://github.com/Azure/azure-sdk-tools/blob/main/tools/test-proxy/Azure.Sdk.Tools.TestProxy/README.md
218291
[TypeSpec]: https://aka.ms/typespec

0 commit comments

Comments
 (0)