xcode - 如何在 Xcode 中使用 LLDB 调试时更改变量值?

标签 xcode debugging lldb

在 Xcode 中,GDB 允许您在调试时更改局部变量(请参阅 how to change NSString value while debugging in XCode? )。 LLDB 是否提供类似的功能?如果可以的话,我们该如何使用它呢?

最佳答案

expr myString = @"Foo"

(lldb) help expr
Evaluate a C/ObjC/C++ expression in the current program context, using variables currently in scope. This command takes 'raw' input (no need to quote stuff).

Syntax: expression --

Command Options Usage: expression [-f ] [-G ] [-d ] [-u ] -- expression [-o] [-d ] [-u ] -- expression

   -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.

Examples:

expr my_struct->a = my_array[3]
expr -f bin -- (index * 8) + 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.

'expr' is an abbreviation for 'expression'

关于xcode - 如何在 Xcode 中使用 LLDB 调试时更改变量值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9907387/

相关文章:

javascript - Jquery 100% 滚动到第一部分

python - 为什么assertEquals()参数的顺序是(预期的,实际的)?

ios - 我的 View Controller 和 Storyboard项目周围不需要的蓝色线条

objective-c - shouldAutorotate 返回 true 但不旋转

iphone - 键盘出现时 ScrollView : Library or DIY?

c - 堆栈跟踪、GDB 中没有函数名称,但出现在 LLDB 中

qemu - 如何使用 LLDB 调试在 Apple Silicon Mac 上的 QEMU 中运行的原始 i386 MBR 二进制文件?

iphone - 两个 nib 文件以 .h 和 .m 连接?

html - href 链接中的填充在 firefox 移动版(应用程序)中不可点击?漏洞?

ios - 如何在 lldb 中创建和使用临时 NSRange?