I need to add a watch in hexadecimal format in CLion.
ltoa(variable, 16)
doesn't work, at least, on my system.
In Java/Python, I can have a workaround: write a custom toString()
/__str__
for my class and have it displayed the way I need. gdb
has p/x
. How do I do it in CLion?
Edit: ltoa(variable, 16)
works if I define ltoa
in my code, as it's not always present in standard library.
You can set this as a default option in a file called
.gdbinit
, which you can put in your home directory, or the working directory from which you start GDB (project root, for instance).