Print variables in hexadecimal or decimal format

2020-02-16 07:49发布

问题:

Currently, when I print the value of a variable v in GDB (print v) I get an integer.

Is it possible to have GDB print such integer variables in hexadecimal or binary?

回答1:

Sure it is. Try these:

# Hexadecimal
p/x variable

# Binary
p/t variable

See output formats.



标签: gdb