Randomblue
Randomblue

Reputation: 116403

Print variables in hexadecimal or decimal format

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?

Upvotes: 148

Views: 146910

Answers (1)

cnicutar
cnicutar

Reputation: 182744

Sure it is. Try these:

# Hexadecimal
p/x variable

# Binary
p/t variable

See output formats.

Upvotes: 243

Related Questions