platformio / platformio-vscode-ide

PlatformIO IDE for VSCode: The next generation integrated development environment for IoT
https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide
Apache License 2.0
1.18k stars 191 forks source link

Dissasembly and global variables not working with second debug environment (build_type = debug) #3708

Open dzid26 opened 1 year ago

dzid26 commented 1 year ago

Using a separate environment for debugging (as in the example) causes global variables to disappear and switching to assembly impossible.

Debugging session:

image image

Globals are still accessible in debug console (e.g. p a returns 5 correctly)

image

Platformio.ini


[env]
platform = ststm32
board = bluepill_f103c8
framework = cmsis
upload_protocol = stlink

[env:bluepill_f103c8]
build_type = release

[env:bluepill_f103c8_debug]
debug_build_flags = -O0 -ggdb3              ; Apply no optimization to the code written.

build_type = debug
debug_tool = stlink
; ===========================================================================

References: Original issue Similar issue OP issue is probably unrelated but linking for others.

Workaround is to point the environment switcher from default environment to the debug one.

image
dzid26 commented 1 year ago

This partially fixed itself somehow. Maybe VScode pushed an update?

The main.c can be found by disassembly if I explicitly switch to debug environment:

image

I am currently working with this repo if someone wanted to reproduce it.

Edit: It didn't switch to disassembly in "Auto" mode again. I needed to manually select a specific debug-type environment. Globals work most of the time, but occasionally they don't show up. Static variables, I believe, never show up.