美文网首页
LLDB调试命令

LLDB调试命令

作者: lsh_01 | 来源:发表于2019-02-24 20:54 被阅读0次

LLDB简介

LLDB 是 XCode 内置的调试工具。从 Xcode5 开始,LLDB 已经取代 GDB,成为 Xcode 默认调试器。

常用命令

  1. 打印变量值:callpprint
  2. 调用函数:call
  3. 修改变量值:expression
  4. 打印调用栈:thread backtrace
  5. 跳过当前函数:thread return
  6. 流程控制:continuenextsetpfinish
  7. 列出当前帧中的变量:frame variable
  8. 查找崩溃位置:image lookup -a
  9. 查看类的成员:image lookup –t
  10. 查看方法的来源:image lookup -n

命令大全

(笔者当前 lldb 版本为lldb-902.0.79.7,在 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.
  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.
  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.
  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.
  x         -- Read from the memory of the current target process.

相关文章

  • LLDB 使用

    LLDB 使用 LLDB(Low Lever Debug)命令结构 其中: (命令)和 (子命令):LLDB调试命...

  • iOS LLDB调试

    掌握以下lldb命令,够用. ### LLDB调试总结 eNSString*$str=@"test"...

  • 各种调试技巧

    断点调试并配合LLDB常用调试命令LLDB命令详见:http://www.jianshu.com/p/d14a25...

  • iOS之LLDB常用调试命令

    iOS之LLDB常用调试命令熟练使用 LLDB,让你调试事半功倍使用facebook开源的Chisel调试Home...

  • iOS开发技能之lldb常用命令

    lldb命令调试 首先我们创建一个简单工程来调试这些命令。打断点,下方就可以进行lldb调试。 p & po po...

  • LLDB调试命令初探

    LLDB调试命令初探 初识LLDB 你可能从未使用过LLDB,那让我们先来热热身。 在调试器中最常用到的命令是p(...

  • 【LLDB】高级运用与深入理解

    摘要 如何在调试中高级运用调试方法,减少重新运行 LLDB获取帮助 调用help命令来列出LLDB所有的顶层命令 ...

  • 知识点-LLDB调试命令

    lldb是我们平时在打断点时候,打印面板出现的。 lldb是Xcode自带的调试工具,下面是常用的lldb调试命令...

  • LLDB命令调试与断点调试

    [LLDB命令调试与断点调试] https://my.oschina.net/notting/blog/11529...

  • LLDB 命令和调试(一)

    LLDB 命令和调试(一) 为什么要学习 LLDB 调试 对于我们程序员来说,构建调试几乎是每天必做的工作。 你是...

网友评论

      本文标题:LLDB调试命令

      本文链接:https://www.haomeiwen.com/subject/vtwbyqtx.html