Eri*_*ric 165 debugging xcode lldb
在Xcode中,GDB允许您在调试时更改局部变量(请参阅在XCode中调试时如何更改NSString值?).LLDB是否提供类似的功能?如果是这样,我们如何使用它?
Mat*_*uch 259
expr myString = @"Foo"
Run Code Online (Sandbox Code Playgroud)
(lldb)help expr
使用当前范围内的变量评估当前程序上下文中的C/ObjC/C++表达式.此命令采用"原始"输入(无需引用内容).语法:expression -
命令选项用法:表达式[-f] [-G] [-d] [-u] - 表达式[-o] [-d] [-u] - 表达式
Run Code Online (Sandbox Code Playgroud)-G <gdb-format> ( --gdb-format <gdb-format> ) Specify a format using a GDB format specifier string. -d <boolean> ( --dynamic-value <boolean> ) Upcast the value resulting from the expression to its dynamic type if available. -f <format> ( --format <format> ) Specify a format to be used for display. -o ( --object-description ) Print the object description of the value resulting from the expression. -u <boolean> ( --unwind-on-error <boolean> ) Clean up program state if the expression causes a crash, breakpoint hit or signal.例子:
expr my_struct-> a = my_array [3]
expr -f bin - (index*8)+ 5
expr char c [] ="foo"; C [0]重要说明:由于此命令采用"原始"输入,因此如果使用任何命令选项,则必须在命令选项的末尾和原始输入的开头之间使用" - ".
'expr'是'expression'的缩写
ara*_*_86 17
以下内容对我有用.我正在使用Xcode 8.
如果要将某个变量(例如"dict")设置为nil,然后测试代码流,可以尝试以下操作.
它看起来像在控制台中.
(lldb) expression dict = nil
(NSDictionary *) $5 = nil
Run Code Online (Sandbox Code Playgroud)