vscode icon indicating copy to clipboard operation
vscode copied to clipboard

VSCode probe-rs extension doesn't highlight and/or change coloring of Rust source code line at which breakpoint has triggered

Open jerrywrice opened this issue 9 months ago • 12 comments

Using VSCode (version 1.97.2) with probe-rs-debug extension (version 0.24.2) doesn't visually indicate the specific rust source file line of code at which a breakpoint is initially triggered, nor when single-stepping.

jerrywrice avatar Feb 17 '25 22:02 jerrywrice

There are definitely some challenges with breakpoint stepping, but many use cases work as expected. Can you please provide more information so that I can assess if this is a known issue, or something new. If you can reproduce this using a simple blinky example, that is ideal. If not, perhaps a link to your repo, with instructions for reproducing? At the very least, I need to know what chip/board you are using, launch.json, tasks.json, Cargo.toml, but obviously more info here is better.

noppej avatar Feb 18 '25 15:02 noppej

Hello I am facing the same issue as well, here is my set up below:

MCU: STM32C031k6tx

Debugger: SLogic8 - DAPLink

Project: Default project generated with stm32-template. The following config are used:

  • The STM32C0xx hal library is broken, so it's removed from compilation
  • It's not a RTIC base application
  • It does not use defmt logger
  • MCU name is stm32c031k6tx

You can review the launch.json, tasks.json, Cargo.toml of the generated project, only Cargo.toml is modified as below:

[package]
name = "thing"
version = "0.1.0"
authors = ["Justin_Gong <[email protected]>"]
edition = "2021"

[dependencies]
cortex-m = "0.7"
cortex-m-rt = "0.7"
panic-halt = "0.2.0"


# [dependencies.stm32c0xx-hal]
# git = "https://github.com/stm32-rs/stm32c0xx-hal"
# features = ["stm32c031", ]

[build-dependencies]
reqwest = { version = "0.11", features = ["blocking"] }

# Set the default for dependencies.
[profile.dev.package."*"]
opt-level = 0

[profile.release]
codegen-units = 1
incremental = false
debug = true
lto = true
opt-level = "s"

When running debugging using probe-rs-debugger with debug option selected, the line number of break point is correct but line number is not selected and file is labelled Unknown Source. I was able to verify with a blinky that the program was uploaded and the program is halted.

Using cargo embed with GDB can properly shows the "break pointed" line and which file.

Image

Happy to provide more info as needed.

JustinG002 avatar Feb 22 '25 11:02 JustinG002

@JustinG002 Thank you for providing a test case!

Can you please confirm the versions of probe-rs and the VSCode extension ?

noppej avatar Feb 22 '25 12:02 noppej

For reproduction it would also be great to have a RAM dump of the run.

Yatekii avatar Feb 22 '25 13:02 Yatekii

@Yatekii the runtime instruction to file/line/column seems to be successful, so I suspect the problem is not in the target, but in probe-rs resolving the file paths. I will look into it when I have version information.

noppej avatar Feb 22 '25 15:02 noppej

@noppej Thanks for the quick response, See version information below

  • probe-rs: 0.27.0
  • vscode: 1.97.2
  • rustup: 1.27.1
  • arm toolchain: 14.2.Rel1

Let me know if you are interested in more information.

Core dump (not sure how to interrupt the data), copied as hex Includes memory ranges: 0x8000008..0x80001F8, 0x20002FD8..0x20002FFC

87a9726567697374657273de00141181a3553332ce20002fd81481a3553332000481a3553332ceffffffff0381a3553332ceffffffff0681a3553332ceffffffff0281a3553332ce080004f40881a3553332ceffffffff0181a3553332ce200000000981a3553332ceffffffff0e81a3553332ce080001e90f81a3553332ce080001f41081a3553332ce610000000c81a3553332ceffffffff1281a3553332cefffffffc0b81a3553332ceffffffff0d81a3553332ce20002fd80081a3553332000a81a3553332ceffffffff0581a3553332ceffffffff0781a3553332ce20002ff0a464617461929282a57374617274ce08000008a3656e64ce080001f8dc01f04302000865030008000000000000000000000000000000000000000000000000000000004302000800000000000000004302000843020008430200084302000843020008430200084302000843020008430200084302000843020008430200084302000843020008430200084302000843020008430200084302000843020008430200084302000843020008430200084302000843020008430200084302000843020008430200084302000843020008430200084302000800ccf0ccc1ccf8084809490022cc814201ccd004ccc0ccfbcce707480749084acc814202ccd008ccca08ccc0ccfacce700ccf07dccf800ccde00000020000000200000002000000020ccf4040008cc80ccb500ccaf0148522100ccf006ccf968030008cc80ccb500ccafcc82ccb001cc9000ccf007ccf802ccb0cc80ccbdcc82ccb000cc9001cc9102ccb07047cc80ccb500ccafcc8accb0014603cc9106cc91081d08cc9109cc9008684968cc884203ccdbccffcce7002004cc900fcce003cc98006801cc9007cc90012102cc9100ccf00cccf803cc9b01cc99024602cc981a6005cc9104cc90ccffcce704cc9805cc990accb0cc80ccbdcc80ccb500ccafcc90ccb003cc9102460acc920bcc910ccc91511804cc91002005cc90012306cc93cc914207cc9001ccd706cc9807cc9006cc9803cc9904cc9a07cc9b01cc930dcc92002902cc9001ccd405cc9802cc9001cc9802cc9948400ecca90870002808ccd1ccffcce704cc9809cc90012008cc9009cc980fcc9010ccb0cc80ccbd03480168406808cc9109cc90ccffccf7cc91ccffccfeccdeccbc030008cc80ccb500ccaf00ccf000ccf8cc80ccb500ccafcc86ccb0002001cc90ccffcce701cc99481c9282a57374617274ce20002fd8a3656e64ce20002ffcdc002405000000000000005bccc90000cca0cc860100010000005accc90000ccf82f0020cce9010008ccffccffccffccffaf696e737472756374696f6e5f736574a65468756d6232bc737570706f7274735f6e61746976655f36346269745f616363657373c2a9636f72655f74797065a661726d76366dab6670755f737570706f7274c2bd666c6f6174696e675f706f696e745f72656769737465725f636f756e7400

JustinG002 avatar Feb 22 '25 21:02 JustinG002

Yep, but with the RAM dump we can reproduce the issue :)

Yatekii avatar Feb 22 '25 21:02 Yatekii

@Yatekii Could you explain how would I do that?

JustinG002 avatar Feb 22 '25 21:02 JustinG002

You can use the dump command in the repl :)

Yatekii avatar Feb 22 '25 21:02 Yatekii

Please see core dump https://github.com/JustinG002/file_sharing/blob/5097866950c6e4c869f1c83535ce88ba5f723f71/coredump

JustinG002 avatar Feb 22 '25 21:02 JustinG002

Please see the elf file used in the test above https://github.com/JustinG002/file_sharing/blob/66d64f188717793ed61378087db74089292ed88e/thing

JustinG002 avatar Feb 22 '25 21:02 JustinG002

How's this going? I just started my journey on embedded rust and I'm stuck on this issue. My environment is:

probe-rs: 0.27.0
probe-rs.probe-rs-debugger: 0.24.2

The project was setup with esp-generate --chip esp32c3 -o unstable-hal -o alloc -o wifi -o ble -o embassy -o probe-rs -o defmt -o embedded-test -o ci -o vscode

also attaching elf and coredump(dump 0 65536 issue-114.dump)

issue-114.zip

Image

mailiam avatar Apr 05 '25 16:04 mailiam