LiveWatch causes breakpoints to still be active after debugger stops
Hello,
In my STM32WBA65 + FreeRTOS project that I work on in VSCode, with the STM32CubeIDE for VScode extension, I came accross a rather strange and annoying behaviour:
It seems that when we enable liveWatch in our debug configuation in .vscode/launch.json, the breakpoints are still active after the debug session ends.
My minimal debug configuration:
{
"type": "stlinkgdbtarget",
"request": "launch",
"name": "Build+Prog+Debug",
"origin": "snippet",
"cwd": "${workspaceFolder}",
"preBuild": "${command:st-stm32-ide-debug-launch.build}",
"imagesAndSymbols": [
{
"imageFileName": "${command:st-stm32-ide-debug-launch.get-projects-binary-from-context1}"
}
],
"liveWatch": {
"enabled": true,
"samplesPerSecond": "4"
},
}
I have the same behaviour with a hot-attach debug configuration if it has liveWatch enabled.
Here is how I test:
In one thread, I have code that reacts to two external stimuli lets call them S1 and S2 (in my case it's characters sent to the target on the serial), and two paths depending on the stimuli. Each stimuli triggers a visible response R1 and R2 (prints on the serial for me). I add a breakpoint to the code handling S2, just before it produces R2.
I also have another thread that blinks an led to act as a heartbeat of the RTOS.
I run the firmware on the target using either the launch configuration above, or the same without livewatch.
When the debugger is running, all behaves as expected in both configuration: S1 triggers R1, S2 triggers the breakpoint then after execution resumes, shows R2.
The behaviour changes after I stop the debug session (shift F5):
WITHOUT LiveWatch:
The behaviour is as expected without a debugger running : S1 triggers R1, S2 triggers R2, the breakpoint never triggers (execution continues after R2). The heartbeat LED is never interrupted.
WITH LiveWatch:
S1 still triggers R1 normally.
S2 stops execution on the whole target (I suppose that it hits the breakpoint). There is no further response to stimuli, no heartbeat LED blinking.
At this point the target is stopped but the STLink still functions : I can start a normal prog+debug session, and things will just work normally.
However, trying to hot-attach the debugger at this point is unsucessful and just ends-up putting the STLINK in a state it cannot recover from without unplugging it.
This leads me to think there is a problem with enabling liveWatch that causes the debugging session not to be properly terminated, or the hardware not being aware of it in any case.
So for now I'll just refain from using liveWatch.
