我们常用的p、po究竟是什么?
help
使用help命令查看LLDB的帮助文档,哪里不会查哪里
expression(简写e、expr)
首先我们来看看帮助文档怎么说(太长了,就不完全粘贴下来了):
(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(简写p)
简单来讲:'print' is an abbreviation for 'expression --'
验证一下:
(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 --'