probe-rs / vscode

VSCode debug extension for probe-rs. It uses the MS DAP protocol to communicate directly with the probe (via probe-rs), and supports basic command line debugging in addition to VSCode UI.
https://probe.rs/
Other
66 stars 6 forks source link

Debugging Session Errors on Breakpoint #36

Closed curiousmuch closed 2 years ago

curiousmuch commented 2 years ago

Hello!

The first break point I hit debugging my application results in a number of errors in the debugging log. I'm using the latest version probe-rs w/ the latest release version of the vscode extension.

Example 2:

[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x1CCE580E : An error with the usage of the probe occurred.

I'm clueless where this is suppose to be lol.

VSCode Launch File

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "probe-rs-debug",
            "request": "launch",
            "name": "probe_rs Executable launch example",
            "cwd": "${workspaceFolder}",
            "connectUnderReset": true,
            "speed": 24000, //!MODIFY (or remove)
            // "probe": "PID:VID:<Serial>", //!MODIFY (or remove)
            "runtimeExecutable": "probe-rs-debugger",
            "runtimeArgs": [
                "debug"
            ],
            "flashingConfig": {
                "flashingEnabled": true,
                "resetAfterFlashing": true,
                "haltAfterReset": true,
            },
            "chip": "STM32H723ZGTx", //!MODIFY
            "coreConfigs": [
                {
                    "coreIndex": 0,
                    "programBinary": "target/thumbv7em-none-eabihf/debug/blinky", //!MODIFY
                    // "svdFile": "Relative or fully qualified path to your programBinary", //!MODIFY
                }
            ],
            "consoleLogLevel": "Info", //Error, Warn, Info, Debug, Trace 
        }
    ]
}

Debugging Log File.


Received DAP Request sequence #1 : initialize
   Sent DAP Response sequence #1 : initialize

Received DAP Request sequence #2 : launch
INFO: FLASHING: Starting write of "/home/curiousmuch/Repos/Rust/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/blinky" to device memory

Triggered DAP Event: progressStart

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressUpdate

Triggered DAP Event: progressEnd
INFO: FLASHING: Completed write of "/home/curiousmuch/Repos/Rust/embassy/examples/stm32h7/target/thumbv7em-none-eabihf/debug/blinky" to device memory
   Sent DAP Response sequence #2 : launch

Triggered DAP Event: initialized

Received DAP Request sequence #3 : setBreakpoints
   Sent DAP Response sequence #3 : setBreakpoints

Received DAP Request sequence #4 : setInstructionBreakpoints
   Sent DAP Response sequence #4 : setInstructionBreakpoints

Received DAP Request sequence #5 : configurationDone
   Sent DAP Response sequence #5 : configurationDone

Received DAP Request sequence #6 : threads

Triggered DAP Event: stopped
   Sent DAP Response sequence #6 : threads

Received DAP Request sequence #7 : threads
   Sent DAP Response sequence #7 : threads

Received DAP Request sequence #8 : stackTrace
   Sent DAP Response sequence #8 : stackTrace

Received DAP Request sequence #9 : stackTrace
   Sent DAP Response sequence #9 : stackTrace

Received DAP Request sequence #10 : scopes
   Sent DAP Response sequence #10 : scopes

Received DAP Request sequence #11 : continue
   Sent DAP Response sequence #11 : continue

Triggered DAP Event: stopped

Received DAP Request sequence #12 : threads
   Sent DAP Response sequence #12 : threads

Received DAP Request sequence #13 : stackTrace
   Sent DAP Response sequence #13 : stackTrace

Received DAP Request sequence #14 : stackTrace
   Sent DAP Response sequence #14 : stackTrace

Received DAP Request sequence #15 : stackTrace
   Sent DAP Response sequence #15 : stackTrace

Received DAP Request sequence #16 : scopes
   Sent DAP Response sequence #16 : scopes
[2022-07-03T18:26:42Z WARN  probe_rs::probe::stlink] send_jtag_command 242 failed: SwdApWdataError
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x88000024 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z WARN  probe_rs::probe::stlink] send_jtag_command 242 failed: SwdApFault
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x1CCE580E : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x1CCE5812 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x1CCE5816 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z WARN  probe_rs::probe::stlink] send_jtag_command 242 failed: SwdApFault
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x1CCE581A : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x7CD10585 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x7CD10589 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x7CD1058D : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x7CD10591 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z WARN  probe_rs::probe::stlink] send_jtag_command 242 failed: SwdApWdataError
[2022-07-03T18:26:42Z WARN  probe_rs::probe::stlink] send_jtag_command 242 failed: SwdApFault
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x2E5BF0DD : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x2E5BF0E1 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x2E5BF0E5 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z WARN  probe_rs::probe::stlink] send_jtag_command 242 failed: SwdApFault
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x2E5BF0E9 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z WARN  probe_rs::probe::stlink] send_jtag_command 242 failed: SwdApFault
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x1CCE580E : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x1CCE5812 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x1CCE5816 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z WARN  probe_rs::probe::stlink] send_jtag_command 242 failed: SwdApFault
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x1CCE581A : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x7CD10585 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x7CD10589 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x7CD1058D : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x7CD10591 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z WARN  probe_rs::probe::stlink] send_jtag_command 242 failed: SwdApWdataError
[2022-07-03T18:26:42Z WARN  probe_rs::probe::stlink] send_jtag_command 242 failed: SwdApFault
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x2E5BF0DD : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x2E5BF0E1 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x2E5BF0E5 : An error with the usage of the probe occurred.
[2022-07-03T18:26:42Z WARN  probe_rs::probe::stlink] send_jtag_command 242 failed: SwdApFault
[2022-07-03T18:26:42Z ERROR probe_rs::debug::debug_info] Failed to read referenced variable address from memory location 0x2E5BF0E9 : An error with the usage of the probe occurred.

Received DAP Request sequence #17 : variables
   Sent DAP Response sequence #17 : variables
noppej commented 2 years ago

Thanks. It definitely seems like there is something funky with the memory addresses. These are calculated using the debug info (DWARF) generated as part of creating the binary, and it is quite possible that there is an issue with the logic.

Is this just the standard 'blinky' example? Have you made any changes to the config files? Can you give me some info on where you've set the breakpoint in the source file?

I don't get these errors, so to reproduce/fix I will need a little more info please.

noppej commented 2 years ago

@curiousmuch I've done some work against breakpoints and variable handling that is now checked into the 'master' branch. Any chance you can retest, and/or answer some of the above questions?

noppej commented 2 years ago

Closing until further information/testing by OP.