Format variables output when debugging
It would be nice to be able to choose the format of the variables when in debug. Right now the output seems to be fixed as decimal. Sometimes is convenient to see the value in hexa or binary. (this is applicable for both the variables list output and for the "mouse over" display)
Are you debugging with the windows debugger, gdb, or lldb? If it is the windows debugger, you can use a format specifier to change the format. For example, to see the value in binary, use "value,b" in the watch window. For lldb and gdb, this is currently only supported in the debug console with -exec.
@jacdavis I'm using gdb. Could you please add this as a suggestion for future enhancement?
It turns out, gdb has a few format specifiers of its own. They are 'h', (or 'x') for hex and 'o' for octal.
Got you. Question: isn't easier to 'just' format the output (according to the user preference) when actually outputting to the screen rather then having to go and config gdb to output the variable with this or that format?
Any update on this? Can you guys move it to the higher priority list?
I filed a suggestion with vscode but was told that it was something that was related to the extension. This issue seems to cover my request, but I enclose my original text:
I'd like to be able to select in which format I see the values of local and watched variables in the debugger. It would be preferred to have a generic setting but be able to change it per variable.
The way that it is now I often need to use a exteral dec-to-hex converter and copy the values from VS Code. Being able to see them in hex directly in the debugger would be a great help!
I mostly debug C/C++ programs but I imagine that this is generic for all languages.
VSCode Version: 1.12.2 OS Version: Linux Ubuntu 16.04 LTS
Steps to Reproduce: Start debugging Add a watched variable or two. Set a breakpoint and run When stopping at the breakpoint, take a look at the values of the watched and local variables. They are all given in decimal values (except pointers that are hex).
Is there any timeline for this feature implementation in GUI local var display?
"watch" variables binary representation would be very useful
In professional tools when I right click on watch item I can set formats:
or
So that would be nice. I believe this issue has enough upvotes.
Looking at this comment:
@yaNePonedelnik Debug extensions must support this. I suggest to file feature requests against the debug extensions you are using.
So it seems that the VSCode changes are already in?
Is there any update on this issue? Is there a timeline to implement that feature?
To set the representation of "watch" variables is a mean feature while debugging. For this it doesn't matter if debugging a windows/linux program or embedded firmware. Without the ability to configure the representation in different numeric formats, debugging is nearly impossible. This renders VS Code unusable, and you look for other, more viable IDEs. But I don't think this is the intention...
Just finished reading through a bunch of threads. Sad it's still not implemented. I'd expect majority users who use c/c++ deal with hex about 80% of the time. Just installed the Ashling RISC V extension and now unable to view hex lol. Looks like it's back to Ashling/Eclipse based ones.
If you are using GDB for debugging, you can set the variable display format by entering -exec set output-radix 16/10/8/2 in the debugging console.
If you are using GDB for debugging, you can set the variable display format by entering
-exec set output-radix 16/10/8/2in the debugging console.
Note though there is seems to be a bug that doing so breaks the context menu - https://github.com/microsoft/vscode-cpptools/issues/13742
Other related bugs with many votes that show general interest in this:
- https://github.com/microsoft/vscode-cpptools/issues/557
- https://github.com/microsoft/vscode-cpptools/issues/7281
- https://github.com/microsoft/vscode-cpptools/issues/6521
In current state cppdbg seems to show an octal value after the decimal values in locals and watch. It would be very nice if we could at least change that to showing the hex value after decimal values.