Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display hex value in watch in vscode?

I started to test the VSCode on Linux and I'd like to see the hex value of a variable near its value. I need it because the variable is a mask, so it is composed from 0s and 1s on certain positions. I did not manage to find a setting or something like it to add it, is it possible? I am using c++ code. I see that the addresses are in hex, so is there a way to see the value of a variable in hex, too?

like image 454
sop Avatar asked Oct 11 '16 08:10

sop


2 Answers

In the watch window, type <variable-name>,h.

like image 95
Kovalex Avatar answered Sep 18 '22 05:09

Kovalex


Adding ,h etc didn't work for me (at least on lldb on mac).

Try casting the variable to the output type you want:

Example for hex:

(void*)test3x1[1]

Example for integer:

(int)test3x1[1]
like image 38
Alex E Avatar answered Sep 18 '22 05:09

Alex E