我們常用的p、po究竟是什么?
help
使用help命令查看LLDB的幫助文檔,哪里不會(huì)查哪里
expression(簡(jiǎn)寫e、expr)
首先我們來(lái)看看幫助文檔怎么說(shuō)(太長(zhǎng)了,就不完全粘貼下來(lái)了):
(lldb) help expression
Evaluate an expression on the current thread. Displays any returned value
with LLDB's default formatting. Expects 'raw' input (see 'help
raw-input'.)
Syntax:
Command Options Usage:
......
Timeouts:
......
User defined variables:
......
Continuing evaluation after a breakpoint:
......
Examples:
expr my_struct->a = my_array[3]
expr -f bin -- (index * 8) + 5
expr unsigned int $foo = 5
expr char c[] = \"foo\"; c[0]
Important Note: Because this command takes 'raw' input, if you use any
command options you must use ' -- ' between the end of the command options
and the beginning of the raw input.
歸納一下就是:
print(簡(jiǎn)寫p)
簡(jiǎn)單來(lái)講:'print' is an abbreviation for 'expression --'
驗(yàn)證一下:
(lldb) expression @"123"
(NSTaggedPointerString *) $0 = 0xa000000003332313 @"123"
(lldb) print @"123"
(NSTaggedPointerString *) $1 = 0xa000000003332313 @"123"
po
(lldb) help po
Evaluate an expression on the current thread. Displays any returned value
with formatting controlled by the type's author.
'po' is an abbreviation for 'expression -O --'