以十六进制或十进制格式打印变量 [英] Print variables in hexadecimal or decimal format
本文介绍了以十六进制或十进制格式打印变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前,当我在GDB( print v
)中输出变量 v
的值时,我得到一个整数。
是否有可能让GDB以十六进制或二进制形式打印这样的整数变量?
解决方案
确实如此。试试这些:
#十六进制
p / x变量
#二进制
p / t变量
请参阅输出格式。
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?
解决方案
Sure it is. Try these:
# Hexadecimal
p/x variable
# Binary
p/t variable
See output formats.
这篇关于以十六进制或十进制格式打印变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文