我如何在GDB中打印十六进制的双重位
How do I print the bits of a double in hex, in GDB?
我认为这是 p/x
,但会产生奇怪的结果。这是一个错误还是我做错了什么?
(gdb) ptype row.DBL_NPIO2.m_value
type = double
(gdb) p row.DBL_NPIO2.m_value
$6 = -1.5707963267948966
(gdb) p/x row.DBL_NPIO2.m_value
$7 = 0xffffffffffffffff
(gdb) print (double)0xffffffffffffffff
$8 = 1.844674407370955e+19
这是在CentOS5 x86机器上
mattheww@SEN-CentOS5: ~$ uname -a
Linux SEN-CentOS5 2.6.18-238.9.1.el5 #1 SMP Tue Apr 12 18:10:13 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
mattheww@SEN-CentOS5: ~$ gdb --version
GNU gdb (GDB) CentOS (7.0.1-45.el5.centos)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
在x86_64中,双重和未签名的长度具有相同的尺寸,您可以将双重转换为无签名长,然后打印。
p /x *(unsigned long*)&row.DBL_NPIO2.m_value
或者您可以
x/8x &row.DBL_NPIO2.m_value
将打印从低地址到高地址的字节。
相关文章:
- 读取文件中所有可能的十六进制 16 字节序列并打印每个序列
- C ++如何使用UTF8十六进制代码打印UTF8符号?
- 打印十六进制字符
- 编译器始终打印十六进制/八进制数字
- 在 c++ 中以十六进制格式打印无符号字符(BYTE).使用 std::cout
- 以十六进制打印出 DWORD 会在 win32 c++ 中返回0x7FFFFFFF
- 将长整型值打印为带有前导零的十六进制
- C++ 在地板函数之后以十六进制打印数字
- 如何使系统在十六进制数之前打印 0x,在八进制数之前打印 0?
- 打印出浮点数的内部十六进制
- 为什么 std::hex 没有特别用字符打印为十六进制?
- 我如何在GDB中打印十六进制的双重位
- C/C++ 以十六进制打印字节,得到奇怪的十六进制值
- 尝试将二进制数组转换为十六进制C++然后打印结果
- 如何从uint32_t打印十六进制
- 用IO操纵器在十六进制中打印一个8位号码
- 将内存地址中的值打印为十六进制C++
- fprintf:打印文字十六进制字符串
- 将十六进制转换为可打印的字符串/字符
- 以十六进制打印数据结构值