首页 iOS.& Swift Books 高级Apple调试& Reverse Engineering

2
帮助& Apropos 由Derek Selander撰写

就像任何可爱的开发人员工具一样,LLDB船舶具有健康的文档。知道如何浏览此文档 - 包括一些更模糊的命令标志 - 对于掌握LLDB至关重要。

“帮助”命令

Open a Terminal window and type lldb. The LLDB prompt will appear. From there, simply type the help command:

(lldb) help 

This will dump out all available commands, including the custom commands loaded from your ~/.lldbinit — but more on that later.

有很多命令可以与LLDB一起使用。

但是,许多命令都有许多子命令,又可以具有子命令,该子命令也有自己的相关文档。我告诉过你这是一个健康的文件数量!

Take the breakpoint command for instance. Run the documentation for breakpoint by typing the following:

(lldb) help breakpoint

您将看到以下输出:

 Commands for operating on breakpoints (see 'help b' for shorthand.)

Syntax: breakpoint

The following subcommands are supported:

      clear   -- Delete or disable breakpoints matching the specified source file and line.
      command -- Commands for adding, removing and listing LLDB commands executed when a breakpoint is hit.
      delete  -- Delete the specified breakpoint(s).  If no breakpoints are specified, delete them all.
      disable -- Disable the specified breakpoint(s) without deleting them.  If none are specified, disable all breakpoints.
      enable  -- Enable the specified disabled breakpoint(s). If no breakpoints are specified, enable all of them.
      list    -- List some or all breakpoints at configurable levels of detail.
      modify  -- Modify the options on a breakpoint or set of breakpoints in the executable.  If no breakpoint is specified,
                 acts on the last created breakpoint.  With the exception of -e, -d and -i, passing an empty argument clears
                 the modification.
      name    -- Commands to manage name tags for breakpoints
      read    -- Read and set the breakpoints previously saved to a file with "breakpoint write".  
      set     -- Sets a breakpoint or set of breakpoints in the executable.
      write   -- Write the breakpoints listed to a file that can be read in with "breakpoint read".  If given no arguments,
                 writes all breakpoints.

For more help on any particular subcommand, type 'help <command> <subcommand>'.

From there, you can see several supported subcommands. Look up the documentation for breakpoint name by typing the following:

(lldb) help breakpoint name

您将看到以下输出:

   Commands to manage name tags for breakpoints

Syntax: breakpoint name

The following subcommands are supported:

      add       -- Add a name to the breakpoints provided.
      configure -- Configure the options for the breakpoint name provided.  If you provide a breakpoint ID, the options will be
                   copied from the breakpoint, otherwise only the options specified will be set on the name.
      delete    -- Delete a name from the breakpoints provided.
      list      -- List either the names for a breakpoint or info about a given name.  With no arguments, lists all names

For more help on any particular subcommand, type 'help <command> <subcommand>'.

If you don’t understand breakpoint name at the moment, don’t worry — you’ll become familiar with breakpoints and all of the subsequent commands soon. For now, the help command is the most important command you can remember.

“appos”命令

Sometimes you don’t know the name of the command you’re searching for, but you know a certain word or phrase that might point you in the right direction. The apropos command can do this for you; it’s a bit like using a search engine to find something on the web.

(lldb) apropos swift
The following commands may relate to 'swift':
  swift    -- A set of commands for operating on the Swift Language Runtime.
  demangle -- Demangle a Swift mangled name
  refcount -- Inspect the reference count data for a Swift object

The following settings variables may relate to 'swift':


  target.swift-framework-search-paths -- List of directories to be searched when locating frameworks for Swift.
  target.swift-module-search-paths -- List of directories to be searched when locating modules for Swift.
  target.use-all-compiler-flags -- Try to use compiler flags for all modules when setting up the Swift expression parser, not just the main executable.
  target.experimental.swift-create-module-contexts-in-parallel -- Create the per-module Swift AST contexts in parallel.
(lldb) apropos "reference count"
The following commands may relate to 'reference count':
  refcount -- Inspect the reference count data for a Swift object

然后去哪儿?

It’s easy to forget the onslaught of LLDB commands that will soon come, but try to commit these two commands, help and apropos, to heart. They’re the foundation for querying information on commands and you’ll be using them all the time as you master debugging.

有一个技术问题?想报告一个错误吗? 您可以向官方书籍论坛中的书籍作者提出问题和报告错误 这里.

有反馈分享在线阅读体验吗? 如果您有关于UI,UX,突出显示或我们在线阅读器的其他功能的反馈,您可以将其发送到设计团队,其中表格如下所示:

© 2021 Razeware LLC

您可以免费读取,本章的部分显示为 混淆了 文本。解锁这本书,以及我们整个书籍和视频目录,带有Raywenderlich.com的专业订阅。

现在解锁

要突出或记笔记,您需要在订阅中拥有这本书或自行购买。