Open U007D opened 1 month ago
I apologize for the slow response on this one. The current version of probe-rs has some known limitations with respect to stepping code, and this one falls squarely into that category.
The debug stepping functionality is actually very tricky to implement, because the debug info generated by Rust (and similarly by other languages) have some limitations. Lots of optimizations to the current 'semantic' implementation is possible, but the only way to really fix this would be to implement platform specific disassembly to interpret the branching instructions in the code (this is what tools like gdb does).
For clarity's sake, I should add that you can 'workaround' this limitation by one of two means, or even a combination of the two:
I hope this helps.
PR's are always welcome :)
Description
I am building and debugging (single-stepping)
embassy
'swifi_blinky
example app.I set two breakpoints: first is the first statement within main and the second is the first statement in the
loop
.When using
Step Over
, everything appears to work correctly through the first loop iteration, but then the debugger appears to lose track of the remote processor starting with the second iteration of the loop. This only occurs when single-stepping (usingStep Over
). On the second iteration of the loop, the IDE starts by pointing to the second loop statement (control.gpio_set().await
, skipping theinfo!
statement). Single-stepping further gives more and more bizarre source code locations until the debugger simply displays "The editor could not be opened because the file was not found" and is unresponsive except forhalt
.If I instead only use
Continue
, the debugger (and hardware) behave perfectly for as many iterations as I wish. Subsequently usingStep Over
shows the "lost control" behavior beginning with the subsequent iteration.Repro Steps
Perhaps I have misconfigured something?
Details
System: Apple M3 Max OS: macOS Sequoia 15.0.1 VSCode: Version: 1.94.2 Commit: 384ff7382de624fb94dbaf6da11977bba1ecd427 Date: 2024-10-09T16:08:44.566Z VSCode
probe-rs
Debugger Extension: Debugger for probe-rs v0.24.2probe-rs --version
: v0.24.0 (git commit: crates.io)rustc --version
: rustc 1.82.0 (f6e511eec 2024-10-15) Debugger hardware: RPi Debug Probe Debugger firmware: v2.0.1 Target: RPi Pico Wembassy-rs
: commit rp2040.svd: pico-sdk v2.0.0.vscode/launch.json
Please let me know if there is any other information I can provide.