code-debug
code-debug copied to clipboard
C Union and struct members are not listed
First, thank you very much for creating this extension. It allowed me to debug the ESP32 on Visual Studio Code, which is indeed much better than only using GDB TUI!
Using xtensa-esp32-elf-gdb 8.1.0.20180627-git and Native Debug 0.23.1, union and struct members are not listed as expected. When the struct/union is a local variable, <args> is shown on the pointer and [err] is shown when trying to access the members underneath.

However, when the union/struct is added to the watch list, its members are printed the same way as GDB does on the command line, yet this is very inconvenient for unions or structs with many members.

So I wrote a quick example for x86-64 that mixes both union and struct and ran the default vscode C/C++ debugger extension to show the expected output:

Could Native Debug be modified so it outputs union/struct information as shown above?
Thank you very much for your work!
have you maybe tried changing the "valuesFormatting" setting in the launch config? Depending on your programming language and GDB version different values will display in differing qualities.
Thanks for the extremely fast reply!
Assigning "valuesFormatting" to "prettyPrinters" solved the problem for local variables, but variables on the watch list are still shown the same way:

Assigning other values to "valuesFormatting" did nothing better.
OTOH, this does not happen on the C/C++ debugger extension provided by Microsoft:

the watch list variables are currently implemented without any variable rendering
OK, then please notify me when this gets implemented.