新手发问,请多指点。
如图,x8的值是"demo",但是po打印出来的始终编码不对,要怎么才能打印呢
发现NSString类型的就能打印
新手发问,请多指点。
如图,x8的值是"demo",但是po打印出来的始终编码不对,要怎么才能打印呢
发现NSString类型的就能打印
没复现出来你的操作,我感觉有几个概念要弄清楚:
https://lldb.llvm.org/use/map.html 里的 Evaluating Expressions 有解释
Printing the ObjC “description” of an object.
(gdb) po [SomeClass returnAnObject]
(lldb) expr -o – [SomeClass returnAnObject]
or using the po alias:
(lldb) po [SomeClass returnAnObject]
User defined variables:
You can define your own variables for convenience or to be used in subsequent expressions. You define them the same way you would define variables in C. If the first character of your user defined variable is a $, then the variable's value will be available in future expressions, otherwise it will just be available in the current expression.
带 $ 开头的,后续也可以使用(作用域变大)。
所以 $x8 和 $8 是不一样的。
$x8 是lldb的内置变量,并且作用域全局
$8 是你自己定义(有可能误操作?)的名字叫做8,作用域全局的变量.
所以重新运行一下程序,直接 p (char*)$x3 或者 p (char*)0x0000000104211a99 试试。
所以我猜是不是误操作把这个地址的值给覆盖了。。。 但是我没复现出来。。。