Windbg .formats命令
2024-01-04
8
0
.formats命令用于对表达式进行格式化显示,相当于C语言的printf。
.formats命令的前提是当前的数字是什么进制。可以通过命令n查看和设置。
n=16时
3: kd> n
base is 16
3: kd> .formats a0
Evaluate expression:
Hex: 00000000`000000a0
Decimal: 160
Octal: 0000000000000000000240
Binary: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 10100000
Chars: ........
Time: Thu Jan 1 08:02:40 1970
Float: low 2.24208e-043 high 0
Double: 7.90505e-322
3: kd> .formats -10
Evaluate expression:
Hex: ffffffff`fffffff0
Decimal: -16
Octal: 1777777777777777777760
Binary: 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11110000
Chars: ........
Time: ***** Invalid
Float: low -1.#QNAN high -1.#QNAN
Double: -1.#QNAN
3: kd> .formats a0*2
Evaluate expression:
Hex: 00000000`00000140
Decimal: 320
Octal: 0000000000000000000500
Binary: 00000000 00000000 00000000 00000000 00000000 00000000 00000001 01000000
Chars: .......@
Time: Thu Jan 1 08:05:20 1970
Float: low 4.48416e-043 high 0
Double: 1.58101e-321
n=10时
3: kd> .formats -2147483638
Evaluate expression:
Hex: ffffffff`8000000a
Decimal: -2147483638
Octal: 1777777777760000000012
Binary: 11111111 11111111 11111111 11111111 10000000 00000000 00000000 00001010
Chars: ........
Time: ***** Invalid
Float: low -1.4013e-044 high -1.#QNAN
Double: -1.#QNAN
3: kd> .formats 100%3
Evaluate expression:
Hex: 00000000`00000001
Decimal: 1
Octal: 0000000000000000000001
Binary: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001
Chars: ........
Time: Thu Jan 1 08:00:01 1970
Float: low 1.4013e-045 high 0
Double: 4.94066e-324