gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 04:18:03 29 4
gpt4 key购买 nike

在 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/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com