Marus / cortex-debug

Visual Studio Code extension for enhancing debug capabilities for Cortex-M Microcontrollers
MIT License
996 stars 238 forks source link

Missing variables in the Variables View #1023

Closed AndriiLishchynskyi closed 3 months ago

AndriiLishchynskyi commented 3 months ago

Summary

GDB provides the ability to use debug symbols from multiple files. That can be achieved, for example, by using add-symbol-file GDB command. I noticed that Variables VSCode menu does not list some global variables when debug symbols were loaded using add-symbol-file command.

Details

I have a TrustZone project divided into two subprojects: proj_secure, proj_non_secure. Non-secure part (proj_non_secure) defines a global variable. To have access to debug symbols of both subprojects I launch debug session by specifying symbol file of proj_secure subproject via file GDB command and symbol files of proj_non_secure subproject via add-symbol-file command. Once debug session I can observe a problem that Global dropdown under Variables view does not list global variable defines in proj_non_secure while it can be accessed via Watch view:

Once symbol file of proj_non_secure is fed via file command I am able to see global variable in the list:

What can be the reason of such behavior? Can it be somehow fixed?

PhilippHaefele commented 3 months ago

As this extension does not (only) use GDB directly to get variables. It also uses objdump and nm for this.

So most likely you only need to use the symbolFiles (and loadFiles if you like to load both of them on debug start) in launch.json instead of the add-symbol-file GDB command.