LLDB common debug commands

Reference Links: https://www.cnblogs.com/hjltonyios/p/8878959.html

 

1. p, po value print

Print-related commands are: p, po.
the difference between p and po po only is the use of the output value corresponding to the p type value is returned, and the command reference name results.

(lldb) p width
(CGFloat) $10 = 70
(lldb) po width
70
(lldb) p endTime
(__NSCFString *) $14 = 0x0000608000437660 @"08-11 11:43"
(lldb) po endTime
08-11 11:43

compare results:

po: output value of
p: output value + value + type reference name + memory address (xcode have memory addresses, other platforms uncertain)
In addition, p also hides an interesting feature, a constant base for the conversion:

//默认打印为10进制
(lldb) p 100
(int) $8 = 100 //转16进制 (lldb) p/x 100 (int) $9 = 0x00000064 //转8进制 (lldb) p/o 100 (int) $10 = 0144 //转二进制 (lldb) p/t 100 (int) $2 = 0b00000000000000000000000001100100 //字符转10进制数字 (lldb) p/d 'A' (char) $7 = 65 //10进制数字转字符 (lldb) p/c 66 (int) $10 = B\0\0\0

Guess you like

Origin www.cnblogs.com/liuzhi20101016/p/12113561.html