Is VSCode able to display hex values for local variables in debug mode ? I have been searching for a way to make this happen but with no success.
11 Answers
I know this is an old thread, but it was at the top of my Google search so I thought I'd add some new information, which I found in the issues thread linked by Burt_Harris.
You can't seem to change the formatting of values displayed in the Locals pane or in tooltips, but you can force the formatting on variables in the Watch pane by appending ,x to the variable name.
Other formats exist, such as ,b for binary, ,o for octal. I believe it's based on the GDB display modifiers uses (e.g. display/x myVariable)
Suffixes used in VSCode's Watch pane:

It has been a while since last activity on this, but I found by looking through links from this thread on the Cortex-Debug github (Issues) a solution for me. From the (GDB) Debug Console use -exec set output-radix 16 for hex, set it to 10 for decimal.
3 Comments
-exec set output-radix 16This answer applies to GDB debugging.
For an active debug session, type the following in the debug console:
-exec set output-radix 16
To apply this every time the debugger runs, add text "set output-radix 16" in the "setupCommands" section of launch.json
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{ "text": "set output-radix 16" }
]
4 Comments
invalid command 'settings output-radix’. Has this feature been removed?I was looking for the same thing and ended up here, and I saw that the feature request has been denied at this time.
But then it hit me: In the watch window, you can add an expression, and Number have a toString method, where you can choose what radix (2-36) to convert the number to. And it works:
Instead of just watching value, watch value.toString(16) for hex.
I tried to add more methods to the Number prototype in my code (I wanted a grouped display), but unfortunately it is only shown as "[Object object]".
I know that this is not exactly what you where looking for, but it is something that works without any plugins.
1 Comment
$xyz.ToString('x')You can't currently, but there are feature requests outstanding for this. According to VSCode core developers, this needs to be implemented in the specific debugger extension for the environment you are debugging.
Links to known related debugger extension feature requests listed below:
Vote your preferences by adding thumbs-up to the feature request
1 Comment
If using the CodeLLDB debugger, the display setting for variables can be changed in the VSCode setting Lldb: Display Format. It can be found by typing lldb.displayFormat in the search bar in VSCode settings.
Note that this changes the display setting for all variables.
Comments
make sure uncheck this box

,h; e.g.,originalPtr,hwithin the watch panel