lldb使用帮助

1,601 阅读22分钟

常用命令

命令 解释 备注
p <expr> 在当前线程上求一个表达式。 以LLDB的默认格式显示任何返回的值 pexpression --的缩写。
po <expr> 在当前线程上求一个表达式。 显示任何返回的值,其格式由类型的作者控制。 poexpression -O --的缩写。
expression <cmd-options> -- <expr> 命令选项用法:
expression [-AFLORTgp] [-f <format>] [-G <gdb-format>] [-a <boolean>] [-i <boolean>] [-t <unsigned-integer>] [-u <boolean>] [-l <source-language>] [-X <source-language>] [-v[<description-verbosity>]] [-j <boolean>] [-d <none>] [-S <boolean>] [-D <count>] [-P <count>] [-Y[<count>]] [-V <boolean>] [-Z <count>] -- <expr>

expression [-AFLORTgp] [-a <boolean>] [-i <boolean>] [-t <unsigned-integer>] [-u <boolean>] [-l <source-language>] [-X <source-language>] [-j <boolean>] [-d <none>] [-S <boolean>] [-D <count>] [-P ] [-Y[<count>]] [-V <boolean>] [-Z <count>] -- <expr>

expression [-r] -- <expr>

expression <expr>
见expression 的详细说明
x <cmd-options> <address-expression> [<address-expression>] 打印内存
规则类似于p,不同点为
少了:
-X -a -g -i -j -p -u -v
多了的见下表 x相比p增加的参数
xmemory read的缩写。

expression 的详细说明

选项 说明
-A ( --show-all-children ) 显示全部子项目
-D <count> ( --depth ) 设置转储聚合类型时的最大递归深度(默认为无穷大)。
-F ( --flat ) 以flat格式显示结果,该格式为每个变量或成员使用表达式路径
-G <gdb-format> ( --gdb-format <gdb-format> ) 使用GDB格式说明符字符串指定格式。
-L ( --location ) 显示变量地址信息。
-O ( --object-description ) 如果可能,使用特定语言的描述API进行显示。
-P <count> ( --ptr-depth <count> ) 转储值时要遍历的指针数(默认为零)。
-R ( --raw-output ) 不使用格式选项。
-S <boolean> ( --synthetic-type <boolean> ) 显示对象遵循其综合提供者(如果有)。
-T ( --show-types ) 转储值时显示变量类型。
-V <boolean> ( --validate <boolean> ) 显示类型验证器的结果。
-X <source-language> ( --apply-fixits <source-language> ) 如果为true,则简单的fix-it提示将自动应用于表达式。
-Y[<count>] ( --no-summary-depth=[<count>] ) 设置省略摘要信息的停止深度(默认值为1)。
-Z <count> ( --element-count <count> ) 将表达式的结果视为其类型是具有这么多值的数组。
-a <boolean> ( --all-threads <boolean> ) 如果执行没有在一个线程上完成,我们应该运行所有线程吗?
-d <none> ( --dynamic-type <none> ) 将对象显示为其完整的动态类型,而不显示为其静态类型(如果有)。
Values: no-dynamic-values | run-target | no-run-target
-f <format> ( --format <format> ) 指定用于显示的格式。
-g ( --debug ) 指定后,通过在第一条指令上设置断点并强制不要忽略断点(-i0)并且在错误(-u0)时不展开来调试JIT代码。
-i <boolean> ( --ignore-breakpoints <boolean> ) 运行表达式时忽略断点命中
-j <boolean> ( --allow-jit <boolean> ) 控制如果解释器不支持表达式是否可以退回到JITted(默认为true)。
-p ( --top-level ) 将表达式解释为完整的翻译单元,而无需将其注入本地上下文。 允许声明不带$前缀的持久性顶级实体。
-r ( --repl ) 放入Swift REPL
-t <unsigned-integer> ( --timeout <unsigned-integer> ) 用于运行表达式的超时值(以微秒为单位)。
-u <boolean> ( --unwind-on-error <boolean> ) 如果表达式导致崩溃或引发信号,清理程序状态。 注意,与gdb命中断点不同,它由另一个选项(-i)控制
-v[<description-verbosity>] ( --description-verbosity=[<description-verbosity>] ) 如果要求对象描述,则此表达式的输出应有多详细。
Values: compact | full
其它 -------
单行和多行表达式: 命令行上提供的表达式必须是不带换行符的完整表达式。 要评估多行表达式,请在一个空表达式之后输入一个返回值,然后lldb将进入多行表达式编辑器。 在空行上按回车键以结束多行表达式
超时时间: 如果表达式可以静态求值(无需运行代码),则它将是。 否则,默认情况下,表达式将在当前线程上运行,且超时时间较短:当前为.25秒。 如果在那个时候没有返回,则评估将被中断并在所有线程运行时恢复。 您可以使用-a选项禁用所有线程上的重试。 您可以使用-t选项设置较短的超时。
用户定义的变量: 您可以定义自己的变量以方便使用或在后续表达式中使用。 您可以使用在C中定义变量的方式来定义它们。如果用户定义的变量的第一个字符是$,则变量的值将在将来的表达式中可用,否则它将仅在当前表达式中可用。
断点后继续: 如果使用了“ -i false”选项,并且执行过程因断点命中而中断,那么一旦完成调查,就可以使用“ thread return -x”从堆栈中删除表达式执行帧,或者如果 仍然对表达式结果感兴趣,您可以发出“continue”命令,表达式评估将完成,并且可以使用线程格式的“ thread.completed-expression”键来获得表达式结果。
例子: expr my_struct->a = my_array[3]
expr -f bin -- (index * 8) + 5
expr unsigned int $foo = 5
expr char c[] = "foo"; c[0]
重要说明: 由于此命令采用“raw”输入,因此,如果使用任何命令选项,则必须在命令选项的末尾与原始输入的开头之间使用“ -- ”。
(lldb) help expression 的帮助内容原文
(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: expression <cmd-options> -- <expr>

Command Options Usage:

  expression [-AFLORTgp] [-f <format>] [-G <gdb-format>] [-a <boolean>] [-i <boolean>] [-t <unsigned-integer>] [-u <boolean>] [-l <source-language>] [-X <source-language>] [-v[<description-verbosity>]] [-j <boolean>] [-d <none>] [-S <boolean>] [-D <count>] [-P <count>] [-Y[<count>]] [-V <boolean>] [-Z <count>] -- <expr>
  expression [-AFLORTgp] [-a <boolean>] [-i <boolean>] [-t <unsigned-integer>] [-u <boolean>] [-l <source-language>] [-X <source-language>] [-j <boolean>] [-d <none>] [-S <boolean>] [-D <count>] [-P <count>] [-Y[<count>]] [-V <boolean>] [-Z <count>] -- <expr>
  expression [-r] -- <expr>
  expression <expr>

       -A ( --show-all-children )
            Ignore the upper bound on the number of children to show.

       -D <count> ( --depth <count> )
            Set the max recurse depth when dumping aggregate types (default is
            infinity).

       -F ( --flat )
            Display results in a flat format that uses expression paths for
            each variable or member.

       -G <gdb-format> ( --gdb-format <gdb-format> )
            Specify a format using a GDB format specifier string.

       -L ( --location )
            Show variable location information.

       -O ( --object-description )
            Display using a language-specific description API, if possible.

       -P <count> ( --ptr-depth <count> )
            The number of pointers to be traversed when dumping values (default
            is zero).

       -R ( --raw-output )
            Don't use formatting options.

       -S <boolean> ( --synthetic-type <boolean> )
            Show the object obeying its synthetic provider, if available.

       -T ( --show-types )
            Show variable types when dumping values.

       -V <boolean> ( --validate <boolean> )
            Show results of type validators.

       -X <source-language> ( --apply-fixits <source-language> )
            If true, simple fix-it hints will be automatically applied to the
            expression.

       -Y[<count>] ( --no-summary-depth=[<count>] )
            Set the depth at which omitting summary information stops (default
            is 1).

       -Z <count> ( --element-count <count> )
            Treat the result of the expression as if its type is an array of
            this many values.

       -a <boolean> ( --all-threads <boolean> )
            Should we run all threads if the execution doesn't complete on one
            thread.

       -d <none> ( --dynamic-type <none> )
            Show the object as its full dynamic type, not its static type, if
            available.
            Values: no-dynamic-values | run-target | no-run-target

       -f <format> ( --format <format> )
            Specify a format to be used for display.

       -g ( --debug )
            When specified, debug the JIT code by setting a breakpoint on the
            first instruction and forcing breakpoints to not be ignored (-i0)
            and no unwinding to happen on error (-u0).

       -i <boolean> ( --ignore-breakpoints <boolean> )
            Ignore breakpoint hits while running expressions

       -j <boolean> ( --allow-jit <boolean> )
            Controls whether the expression can fall back to being JITted if
            it's not supported by the interpreter (defaults to true).

       -l <source-language> ( --language <source-language> )
            Specifies the Language to use when parsing the expression.  If not
            set the target.language setting is used.

       -p ( --top-level )
            Interpret the expression as a complete translation unit, without
            injecting it into the local context.  Allows declaration of
            persistent, top-level entities without a $ prefix.

       -r ( --repl )
            Drop into Swift REPL

       -t <unsigned-integer> ( --timeout <unsigned-integer> )
            Timeout value (in microseconds) for running the expression.

       -u <boolean> ( --unwind-on-error <boolean> )
            Clean up program state if the expression causes a crash, or raises
            a signal.  Note, unlike gdb hitting a breakpoint is controlled by
            another option (-i).

       -v[<description-verbosity>] ( --description-verbosity=[<description-verbosity>] )
            How verbose should the output of this expression be, if the object
            description is asked for.
            Values: compact | full

Single and multi-line expressions:

    The expression provided on the command line must be a complete expression
    with no newlines.  To evaluate a multi-line expression, hit a return after
    an empty expression, and lldb will enter the multi-line expression editor.
    Hit return on an empty line to end the multi-line expression.

Timeouts:

    If the expression can be evaluated statically (without running code) then
    it will be.  Otherwise, by default the expression will run on the current
    thread with a short timeout: currently .25 seconds.  If it doesn't return
    in that time, the evaluation will be interrupted and resumed with all
    threads running.  You can use the -a option to disable retrying on all
    threads.  You can use the -t option to set a shorter timeout.

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.

Continuing evaluation after a breakpoint:

    If the "-i false" option is used, and execution is interrupted by a
    breakpoint hit, once you are done with your investigation, you can either
    remove the expression execution frames from the stack with "thread return
    -x" or if you are still interested in the expression result you can issue
    the "continue" command and the expression evaluation will complete and the
    expression result will be available using the "thread.completed-expression"
    key in the thread format.

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.

x相比p增加的参数

选项 说明
-E <count> ( --offset <count> ) 开始显示数据之前要跳过多少个指定类型的元素。
-b ( --binary ) 如果为true,则内存将保存为二进制。 如果为false,则将内存另存为ASCII转储,该转储使用格式,大小,计数和每行编号设置。
-c <count> ( --count <count> ) The number of total items to display.
-l <number-per-line> ( --num-per-line <number-per-line> ) 每行显示的项目数。
-o <filename> ( --outfile <filename> ) 指定捕获命令输出的路径。
-r ( --force ) (不同) 如果读取target.max-memory-read-size字节,则为必需。
-s <byte-size> ( --size <byte-size> ) 以选定格式显示时要使用的字节大小。
-t <none> ( --type <none> )(不同) 查看内存所用的类型的名称。
--append-outfile 追加到使用'--outfile '指定的文件。
(lldb) help memory read 的帮助内容原文
(lldb) help memory read
     Read from the memory of the current target process.

Syntax: memory read <cmd-options> <address-expression> [<address-expression>]

Command Options Usage:
  memory read [-r] [-f <format>] [-c <count>] [-G <gdb-format>] [-s <byte-size>] [-l <number-per-line>] [-o <filename>] <address-expression> [<address-expression>]
  memory read [-br] [-f <format>] [-c <count>] [-s <byte-size>] [-o <filename>] <address-expression> [<address-expression>]
  memory read [-AFLORTr] -t <none> [-f <format>] [-c <count>] [-G <gdb-format>] [-E <count>] [-o <filename>] [-d <none>] [-S <boolean>] [-D <count>] [-P <count>] [-Y[<count>]] [-V <boolean>] [-Z <count>] <address-expression> [<address-expression>]

       -A ( --show-all-children )
            Ignore the upper bound on the number of children to show.

       -D <count> ( --depth <count> )
            Set the max recurse depth when dumping aggregate types (default is
            infinity).

       -E <count> ( --offset <count> )
            How many elements of the specified type to skip before starting to
            display data.

       -F ( --flat )
            Display results in a flat format that uses expression paths for
            each variable or member.

       -G <gdb-format> ( --gdb-format <gdb-format> )
            Specify a format using a GDB format specifier string.

       -L ( --location )
            Show variable location information.

       -O ( --object-description )
            Display using a language-specific description API, if possible.

       -P <count> ( --ptr-depth <count> )
            The number of pointers to be traversed when dumping values (default
            is zero).

       -R ( --raw-output )
            Don't use formatting options.

       -S <boolean> ( --synthetic-type <boolean> )
            Show the object obeying its synthetic provider, if available.

       -T ( --show-types )
            Show variable types when dumping values.

       -V <boolean> ( --validate <boolean> )
            Show results of type validators.

       -Y[<count>] ( --no-summary-depth=[<count>] )
            Set the depth at which omitting summary information stops (default
            is 1).

       -Z <count> ( --element-count <count> )
            Treat the result of the expression as if its type is an array of
            this many values.

       -b ( --binary )
            If true, memory will be saved as binary. If false, the memory is
            saved save as an ASCII dump that uses the format, size, count and
            number per line settings.

       -c <count> ( --count <count> )
            The number of total items to display.

       -d <none> ( --dynamic-type <none> )
            Show the object as its full dynamic type, not its static type, if
            available.
            Values: no-dynamic-values | run-target | no-run-target

       -f <format> ( --format <format> )
            Specify a format to be used for display.

       -l <number-per-line> ( --num-per-line <number-per-line> )
            The number of items per line to display.

       -o <filename> ( --outfile <filename> )
            Specify a path for capturing command output.

       -r ( --force )
            Necessary if reading over target.max-memory-read-size bytes.

       -s <byte-size> ( --size <byte-size> )
            The size in bytes to use when displaying with the selected format.

       -t <none> ( --type <none> )
            The name of a type to view memory as.

       --append-outfile
            Append to the file specified with '--outfile <path>'.
     
     This command takes options and free-form arguments.  If your arguments
     resemble option specifiers (i.e., they start with a - or --), you must use
     ' -- ' between the end of the command options and the beginning of the
     arguments.

详细内容

输入(lldb) help显示出帮助内容,非常长,为了排版进行了缩减

(lldb) help
Debugger commands:
  apropos           -- List debugger commands related to a word or subject.
  breakpoint        -- Commands for operating on breakpoints (see 'help b' for
                       shorthand.)
  bugreport         -- Commands for creating domain-specific bug reports.
  ......
Current command abbreviations (type 'help command alias' for more info):
  add-dsym  -- Add a debug symbol file to one of the target's current modules
               by specifying a path to a debug symbols file, or using the
               options to specify a module to download symbols for.
  attach    -- Attach to process by ID or name.
  b         -- Set a breakpoint using one of several shorthand formats.
  .......
For more information on any command, type 'help <command-name>'.
展开查看完整帮助内容
(lldb) help
Debugger commands:
  apropos           -- List debugger commands related to a word or subject.
  breakpoint        -- Commands for operating on breakpoints (see 'help b' for
                       shorthand.)
  bugreport         -- Commands for creating domain-specific bug reports.
  command           -- Commands for managing custom LLDB commands.
  disassemble       -- Disassemble specified instructions in the current
                       target.  Defaults to the current function for the
                       current thread and stack frame.
  expression        -- Evaluate an expression on the current thread.  Displays
                       any returned value with LLDB's default formatting.
  frame             -- Commands for selecting and examing the current thread's
                       stack frames.
  gdb-remote        -- Connect to a process via remote GDB server.  If no host
                       is specifed, localhost is assumed.
  gui               -- Switch into the curses based GUI mode.
  help              -- Show a list of all debugger commands, or give details
                       about a specific command.
  kdp-remote        -- Connect to a process via remote KDP server.  If no UDP
                       port is specified, port 41139 is assumed.
  language          -- Commands specific to a source language.
  log               -- Commands controlling LLDB internal logging.
  memory            -- Commands for operating on memory in the current target
                       process.
  platform          -- Commands to manage and create platforms.
  plugin            -- Commands for managing LLDB plugins.
  process           -- Commands for interacting with processes on the current
                       platform.
  quit              -- Quit the LLDB debugger.
  register          -- Commands to access registers for the current thread and
                       stack frame.
  reproducer        -- Commands controlling LLDB reproducers.
  script            -- Invoke the script interpreter with provided code and
                       display any results.  Start the interactive interpreter
                       if no code is supplied.
  settings          -- Commands for managing LLDB settings.
  source            -- Commands for examining source code described by debug
                       information for the current target process.
  statistics        -- Print statistics about a debugging session
  target            -- Commands for operating on debugger targets.
  thread            -- Commands for operating on one or more threads in the
                       current process.
  type              -- Commands for operating on the type system.
  version           -- Show the LLDB debugger version.
  watchpoint        -- Commands for operating on watchpoints.
Current command abbreviations (type 'help command alias' for more info):
  add-dsym  -- Add a debug symbol file to one of the target's current modules
               by specifying a path to a debug symbols file, or using the
               options to specify a module to download symbols for.
  attach    -- Attach to process by ID or name.
  b         -- Set a breakpoint using one of several shorthand formats.
  bt        -- Show the current thread's call stack.  Any numeric argument
               displays at most that many frames.  The argument 'all' displays
               all threads.
  c         -- Continue execution of all threads in the current process.
  call      -- Evaluate an expression on the current thread.  Displays any
               returned value with LLDB's default formatting.
  continue  -- Continue execution of all threads in the current process.
  detach    -- Detach from the current target process.
  di        -- Disassemble specified instructions in the current target. 
               Defaults to the current function for the current thread and
               stack frame.
  dis       -- Disassemble specified instructions in the current target. 
               Defaults to the current function for the current thread and
               stack frame.
  display   -- Evaluate an expression at every stop (see 'help target
               stop-hook'.)
  down      -- Select a newer stack frame.  Defaults to moving one frame, a
               numeric argument can specify an arbitrary number.
  env       -- Shorthand for viewing and setting environment variables.
  exit      -- Quit the LLDB debugger.
  f         -- Select the current stack frame by index from within the current
               thread (see 'thread backtrace'.)
  file      -- Create a target using the argument as the main executable.
  finish    -- Finish executing the current stack frame and stop after
               returning.  Defaults to current thread unless specified.
  image     -- Commands for accessing information for one or more target
               modules.
  j         -- Set the program counter to a new address.
  jump      -- Set the program counter to a new address.
  kill      -- Terminate the current target process.
  l         -- List relevant source code using one of several shorthand formats.
  list      -- List relevant source code using one of several shorthand formats.
  n         -- Source level single step, stepping over calls.  Defaults to
               current thread unless specified.
  next      -- Source level single step, stepping over calls.  Defaults to
               current thread unless specified.
  nexti     -- Instruction level single step, stepping over calls.  Defaults to
               current thread unless specified.
  ni        -- Instruction level single step, stepping over calls.  Defaults to
               current thread unless specified.
  p         -- Evaluate an expression on the current thread.  Displays any
               returned value with LLDB's default formatting.
  parray    -- Evaluate an expression on the current thread.  Displays any
               returned value with LLDB's default formatting.
  po        -- Evaluate an expression on the current thread.  Displays any
               returned value with formatting controlled by the type's author.
  poarray   -- Evaluate an expression on the current thread.  Displays any
               returned value with LLDB's default formatting.
  print     -- Evaluate an expression on the current thread.  Displays any
               returned value with LLDB's default formatting.
  q         -- Quit the LLDB debugger.
  r         -- Launch the executable in the debugger.
  rbreak    -- Sets a breakpoint or set of breakpoints in the executable.
  re        -- Commands to access registers for the current thread and stack
               frame.
  repl      -- Evaluate an expression on the current thread.  Displays any
               returned value with LLDB's default formatting.
  run       -- Launch the executable in the debugger.
  s         -- Source level single step, stepping into calls.  Defaults to
               current thread unless specified.
  si        -- Instruction level single step, stepping into calls.  Defaults to
               current thread unless specified.
  sif       -- Step through the current block, stopping if you step directly
               into a function whose name matches the TargetFunctionName.
  step      -- Source level single step, stepping into calls.  Defaults to
               current thread unless specified.
  stepi     -- Instruction level single step, stepping into calls.  Defaults to
               current thread unless specified.
  t         -- Change the currently selected thread.
  tbreak    -- Set a one-shot breakpoint using one of several shorthand formats.
  undisplay -- Stop displaying expression at every stop (specified by stop-hook
               index.)
  up        -- Select an older stack frame.  Defaults to moving one frame, a
               numeric argument can specify an arbitrary number.
  v         -- Show variables for the current stack frame. Defaults to all
               arguments and local variables in scope. Names of argument,
               local, file static and file global variables can be specified.
               Children of aggregate variables can be specified such as
               'var->child.x'.  The -> and [] operators in 'frame variable' do
               not invoke operator overloads if they exist, but directly access
               the specified element.  If you want to trigger operator
               overloads use the expression command to print the variable
               instead.
               It is worth noting that except for overloaded operators, when
               printing local variables 'expr local_var' and 'frame var
               local_var' produce the same results.  However, 'frame variable'
               is more efficient, since it uses debug information and memory
               reads directly, rather than parsing and evaluating an
               expression, which may even involve JITing and running code in
               the target program.
  var       -- Show variables for the current stack frame. Defaults to all
               arguments and local variables in scope. Names of argument,
               local, file static and file global variables can be specified.
               Children of aggregate variables can be specified such as
               'var->child.x'.  The -> and [] operators in 'frame variable' do
               not invoke operator overloads if they exist, but directly access
               the specified element.  If you want to trigger operator
               overloads use the expression command to print the variable
               instead.
               It is worth noting that except for overloaded operators, when
               printing local variables 'expr local_var' and 'frame var
               local_var' produce the same results.  However, 'frame variable'
               is more efficient, since it uses debug information and memory
               reads directly, rather than parsing and evaluating an
               expression, which may even involve JITing and running code in
               the target program.
  vo        -- Show variables for the current stack frame. Defaults to all
               arguments and local variables in scope. Names of argument,
               local, file static and file global variables can be specified.
               Children of aggregate variables can be specified such as
               'var->child.x'.  The -> and [] operators in 'frame variable' do
               not invoke operator overloads if they exist, but directly access
               the specified element.  If you want to trigger operator
               overloads use the expression command to print the variable
               instead.
               It is worth noting that except for overloaded operators, when
               printing local variables 'expr local_var' and 'frame var
               local_var' produce the same results.  However, 'frame variable'
               is more efficient, since it uses debug information and memory
               reads directly, rather than parsing and evaluating an
               expression, which may even involve JITing and running code in
               the target program.
  x         -- Read from the memory of the current target process.
For more information on any command, type 'help <command-name>'.

帮助内容翻译

指令 译文 原文
apropos 列出与单词或主题相关的调试器命令。 List debugger commands related to a word or subject.
breakpoint 在断点上操作的命令(有关速记,请参见help b。) Commands for operating on breakpoints (see help b for shorthand.)
bugreport 用于创建特定于域的错误报告的命令。 Commands for creating domain-specific bug reports.
command 用于管理定制LLDB命令的命令。 Commands for managing custom LLDB commands.
disassemble 在当前目标中反汇编指定的指令。 对于当前线程和堆栈框架,默认为当前函数。 Disassemble specified instructions in the current target. Defaults to the current function for the current thread and stack frame.
expression 在当前线程上求一个表达式。 以LLDB的默认格式显示任何返回的值。 Evaluate an expression on the current thread. Displays any returned value with LLDB's default formatting.
frame 用于选择和检查当前线程的堆栈框架的命令。 Commands for selecting and examing the current thread's stack frames.
gdb-remote 通过远程GDB服务器连接到进程。 如果未指定主机,则假定为localhost。 Connect to a process via remote GDB server. If no host is specifed, localhost is assumed.
gui 切换到基于curses的GUI模式。 Switch into the curses based GUI mode.
help 显示所有调试器命令的列表,或提供有关特定命令的详细信息。 Show a list of all debugger commands, or give details about a specific command.
kdp-remote 通过远程KDP服务器连接到进程。 如果未指定UDP端口,则使用端口41139。 Connect to a process via remote KDP server. If no UDP port is specified, port 41139 is assumed.
language 代码语言的命令。 Commands specific to a source language.
log 控制LLDB内部日志记录的命令。 Commands controlling LLDB internal logging.
memory 当前目标进程中用于在内存上运行的命令。 Commands for operating on memory in the current target process.
platform 用于管理和创建平台的命令。 Commands to manage and create platforms.
plugin 用于管理LLDB插件的命令。 Commands for managing LLDB plugins.
process 用于与当前平台上的进程进行交互的命令。 Commands for interacting with processes on the current platform.
quit 退出LLDB调试器。 Quit the LLDB debugger.
register 用于访问当前线程和堆栈帧的寄存器的命令。 Commands to access registers for the current thread and stack frame.
reproducer 控制LLDB复制器的命令。 Commands controlling LLDB reproducers.
script 用提供的代码调用脚本解释器,并显示所有结果。 如果没有提供代码,启动交互式解释器。 Invoke the script interpreter with provided code and display any results. Start the interactive interpreter if no code is supplied.
settings 用于管理LLDB设置的命令。 Commands for managing LLDB settings.
source 用于检查由当前目标进程的调试信息描述的源代码的命令。 Commands for examining source code described by debug information for the current target process.
statistics 打印有关调试会话的统计信息 Print statistics about a debugging session
target 用于在调试器目标上运行的命令。 Commands for operating on debugger targets.
thread 在当前进程中操作一个或多个线程上运行的命令。 Commands for operating on one or more threads in the current process.
type 类型系统上的控制命令。 Commands for operating on the type system.
version 显示LLDB调试器版本。 Show the LLDB debugger version.
watchpoint 用于监视点的命令。 Commands for operating on watchpoints.

当前命令的缩写(有关更多信息,请键入help command alias):

Current command abbreviations (type 'help command alias' for more info):

指令 译文 原文
add-dsym 通过指定调试符号文件的路径,或使用选项指定要为其下载符号的模块,将调试符号文件添加到目标的当前模块之一。 Add a debug symbol file to one of the target's current modules by specifying a path to a debug symbols file, or using the options to specify a module to download symbols for.
attach 按ID或名称附加(连接)到进程。 Attach to process by ID or name.
b 使用几种速记格式之一设置断点 Set a breakpoint using one of several shorthand formats.
bt 显示当前线程的调用堆栈。 任何数字参数最多显示多少帧。 参数all显示所有线程。 Show the current thread's call stack. Any numeric argument displays at most that many frames. The argument 'all' displays all threads.
c 继续执行当前进程中的所有线程。 Continue execution of all threads in the current process.
call 在当前线程上求一个表达式。 以LLDB的默认格式显示任何返回的值。 Evaluate an expression on the current thread. Displays any returned value with LLDB's default formatting.
continue 继续执行当前进程中的所有线程。 Continue execution of all threads in the current process.
detach 脱离当前的目标过程。 Detach from the current target process.
di 在当前目标中反汇编指定的指令。 对于当前线程和堆栈框架,默认为当前函数。 Disassemble specified instructions in the current target. Defaults to the current function for the current thread and stack frame.
dis 在当前目标中反汇编指定的指令。 对于当前线程和堆栈框架,默认为当前函数。 Disassemble specified instructions in the current target. Defaults to the current function for the current thread and stack frame.
display 每次停止时都要评估表达式(请参阅help target stop-hook。) Evaluate an expression at every stop (see 'help target stop-hook'.)
down 选择一个新的堆栈框架。 默认为移动一帧,数字参数可以指定任意数字。 Select a newer stack frame. Defaults to moving one frame, a numeric argument can specify an arbitrary number.
env 查看和设置环境变量的简写。 Shorthand for viewing and setting environment variables.
exit Quit the LLDB debugger. Quit the LLDB debugger.
f 从当前线程中按索引选择当前堆栈帧(请参阅“线程回溯”。) Select the current stack frame by index from within the current thread (see 'thread backtrace'.)
file 使用参数作为主要可执行文件创建目标。 Create a target using the argument as the main executable.
finish 完成执行当前堆栈帧,并在返回后停止。 除非指定,否则默认为当前线程。 Finish executing the current stack frame and stop after returning. Defaults to current thread unless specified.
image 用于访问一个或多个目标模块信息的命令。 Commands for accessing information for one or more target modules
j 将程序计数器设置为新地址。 Set the program counter to a new address.
jump 将程序计数器设置为新地址。 Set the program counter to a new address.
kill 终止当前目标过程。 Terminate the current target process.
l 使用几种速记格式之一列出相关的源代码。 List relevant source code using one of several shorthand formats.
list 使用几种速记格式之一列出相关的源代码。 List relevant source code using one of several shorthand formats.
n 源代码级单步执行,逐步执行调用。 除非指定,否则默认为当前线程。 Source level single step, stepping over calls. Defaults to current thread unless specified.
next 源代码级单步执行,逐步执行调用。 除非指定,否则默认为当前线程。 Source level single step, stepping over calls. Defaults to current thread unless specified.
nexti 指令级单步执行,单步执行调用。 除非指定,否则默认为当前线程。 Instruction level single step, stepping over calls. Defaults to current thread unless specified.
ni 指令级单步执行,单步执行调用。 除非指定,否则默认为当前线程。 Instruction level single step, stepping over calls. Defaults to current thread unless specified.
p 在当前线程上求一个表达式。 以LLDB的默认格式显示任何返回的值。 Evaluate an expression on the current thread. Displays any returned value with LLDB's default formatting.
parray 在当前线程上求一个表达式。 以LLDB的默认格式显示任何返回的值。 Evaluate an expression on the current thread. Displays any returned value with LLDB's default formatting.
po 在当前线程上求一个表达式。 显示任何返回的值,其格式由类型的作者控制。 Evaluate an expression on the current thread. Displays any returned value with formatting controlled by the type's author.
poarray 在当前线程上求一个表达式。 以LLDB的默认格式显示任何返回的值。 Evaluate an expression on the current thread. Displays any returned value with LLDB's default formatting.
print 在当前线程上求一个表达式。 以LLDB的默认格式显示任何返回的值。 Evaluate an expression on the current thread. Displays any returned value with LLDB's default formatting.
q 退出LLDB调试器。 Quit the LLDB debugger.
r 在调试器中启动可执行文件。 Launch the executable in the debugger.
run 在调试器中启动可执行文件。 Launch the executable in the debugger.
rbreak 在可执行文件中设置一个断点或一组断点。 Sets a breakpoint or set of breakpoints in the executable.
re 用于访问当前线程和堆栈帧的寄存器的命令。 Commands to access registers for the current thread and stack frame.
repl 在当前线程上求一个表达式。 以LLDB的默认格式显示任何返回的值。 Evaluate an expression on the current thread. Displays any returned value with LLDB's default formatting.
s 源代码级单步执行,进入调用。 除非指定,否则默认为当前线程。 Source level single step, stepping into calls. Defaults to current thread unless specified.
step 源代码级单步执行,进入调用。 除非指定,否则默认为当前线程。 Source level single step, stepping into calls. Defaults to current thread unless specified.
si 指令级单步执行,逐步执行。 除非指定,否则默认为当前线程。 Instruction level single step, stepping into calls. Defaults to current thread unless specified.
stepi 指令级单步执行,逐步执行。 除非指定,否则默认为当前线程。 Instruction level single step, stepping into calls. Defaults to current thread unless specified.
sif 单步执行当前块,如果直接步入名称与TargetFunctionName匹配的函数,则停止。 Step through the current block, stopping if you step directly into a function whose name matches the TargetFunctionName.
t 更改当前选定的线程 Change the currently selected thread.
tbreak 使用几种速记格式之一设置单发断点。 Set a one-shot breakpoint using one of several shorthand formats.
undisplay 停止在每个停止位置显示表达式(由停止钩索引指定)。 Stop displaying expression at every stop (specified by stop-hook index.)
up 选择一个较旧的堆栈帧。 默认为移动一帧,数字参数可以指定任意数字。 Select an older stack frame. Defaults to moving one frame, a numeric argument can specify an arbitrary number.
v 显示当前堆栈框架的变量。 默认为作用域中的所有参数和局部变量。 可以指定参数名称,局部名称,文件静态名称和文件全局变量。 可以指定聚合变量的子级,例如var-> child.x。 如果存在frame variable中的->和[]运算符,则它们不会调用运算符重载,而是直接访问指定的元素。 如果要触发运算符重载,请使用expression命令来打印变量。
值得注意的是,除了重载运算符外,在打印局部变量'expr local_var'和'frame var local_var'时会产生相同的结果。 但是,frame variable效率更高,因为它直接使用调试信息和内存读取,而不是解析和评估表达式,这甚至可能涉及目标程序中的JIT和运行代码。
Show variables for the current stack frame. Defaults to all arguments and local variables in scope. Names of argument, local, file static and file global variables can be specified. Children of aggregate variables can be specified such as 'var->child.x'. The -> and [] operators in 'frame variable' do not invoke operator overloads if they exist, but directly access the specified element. If you want to trigger operator overloads use the expression command to print the variable instead.
It is worth noting that except for overloaded operators, when printing local variables'expr local_var' and 'frame var local_var' produce the same results. However, 'frame variable' is more efficient, since it uses debug information and memory reads directly, rather than parsing and evaluating an expression, which may even involve JITing and running code in the target program.
var 同上 同上
vo 同上 同上
x 从当前目标进程的内存中读取。 Read from the memory of the current target process.

有关任何命令的更多信息,请键入help <命令名称>

For more information on any command, type help <command-name>.


其中每个命令都可以得到更详细的帮助信息

例如输入help p将会显示

(lldb) help p
     Evaluate an expression on the current thread.  Displays any returned value
     with LLDB's default formatting.  Expects 'raw' input (see 'help
     raw-input'.)

Syntax: p <expr>

Command Options Usage:
  p <expr>


'p' is an abbreviation for 'expression --'