code-debug icon indicating copy to clipboard operation
code-debug copied to clipboard

C Union and struct members are not listed

Open XaviDCR92 opened this issue 6 years ago • 4 comments

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. native_debug_issue_0

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. native_debug_issue_2

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: native_debug_issue_1

Could Native Debug be modified so it outputs union/struct information as shown above?

Thank you very much for your work!

XaviDCR92 avatar Nov 27 '19 20:11 XaviDCR92

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.

WebFreak001 avatar Nov 27 '19 20:11 WebFreak001

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: native_debug_issue_3

Assigning other values to "valuesFormatting" did nothing better.

OTOH, this does not happen on the C/C++ debugger extension provided by Microsoft: native_debug_issue_4

XaviDCR92 avatar Nov 27 '19 21:11 XaviDCR92

the watch list variables are currently implemented without any variable rendering

WebFreak001 avatar Nov 27 '19 21:11 WebFreak001

OK, then please notify me when this gets implemented.

XaviDCR92 avatar Nov 27 '19 22:11 XaviDCR92