Modification of values stored in registers of the processor during debugging

using the PIO unified debugger in VSCode, is there a way one can change a value stored in a processor register when the program is halted? I am using STM32F4Discovery board with default settings in PIO. I know this functionality is possible in ST’s CubeIDE, so I was wondering whether this feature is also available in PIO and I can not just figure out the right way to do it. The same holds for on-the-fly modifications of the memory content, but I see that this is a work in progress (Edit memory contents in Platformio debugger · Issue #1495 · platformio/platformio-vscode-ide · GitHub). Thanks for any advice.

You have the GDB console available to you at all times in the Debug Console. The documentation for that can be found here. Generally

set $<register name> = <some value>
set $r0 = 2

E.g. when I put a breakpoint here and R0 is 0:

I execute the set $r0 = 2, print the registers using i r (info registers) and advance one instruction using stepi (PIO’s register view doesn’t update otherwise… but the processor has internally set the requested value).

I then get the expect state

So it is possible using the base GDB. I aggree that a feature like an option like right-clicking and “Edit” or double-clicking the register to change the value would be great. That would be a feature-request for


1 Like