【问题标题】:How do you run pre-written lldb commands?您如何运行预先编写的 lldb 命令?
【发布时间】:2018-09-14 07:19:22
【问题描述】:

我有这个文件,其中包含我想要运行的 lldb 命令。 有没有办法运行预先编写的 lldb 命令?

【问题讨论】:

    标签: debugging lldb


    【解决方案1】:

    lldb 的帮助系统是回答此类问题的好方法:

    (lldb) help command
         Commands for managing custom LLDB commands.
    
    Syntax: command <subcommand> [<subcommand-options>]
    
    The following subcommands are supported:
    
          alias   -- Define a custom command in terms of an existing command.  Expects 'raw' input (see 'help raw-input'.)
          delete  -- Delete one or more custom commands defined by 'command regex'.
          history -- Dump the history of commands in this session.
                     Commands in the history list can be run again using "!<INDEX>".   "!-<OFFSET>" will re-run the command that is <OFFSET> commands from the end of the list (counting the current command).
          regex   -- Define a custom command in terms of existing commands by matching regular expressions.
          script  -- Commands for managing custom commands implemented by interpreter scripts.
          source  -- Read and execute LLDB commands from the file <filename>.
          unalias -- Delete one or more custom commands defined by 'command alias'.
    
    For more help on any particular subcommand, type 'help <command> <subcommand>'.
    

    command source 看起来很有希望:

    (lldb) help command source 
         Read and execute LLDB commands from the file <filename>.
    
    Syntax: command source <cmd-options> <filename>
    
    Command Options Usage:
      command source [-e <boolean>] [-c <boolean>] [-s <boolean>] <filename>
    
           -c <boolean> ( --stop-on-continue <boolean> )
                If true, stop executing commands on continue.
    
           -e <boolean> ( --stop-on-error <boolean> )
                If true, stop executing commands on error.
    
           -s <boolean> ( --silent-run <boolean> )
                If true don't echo commands while executing.
    
         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.
    

    还有一个apropos 命令将在帮助中搜索关键字。不幸的是,apropos command 返回的点击次数过多,对您的情况特别有用。 apropos file 的噪音要小一些,但仅查看命令子命令可能是最简单的。 help 不带参数将列出顶级命令,这也可能有助于您入门。

    注意,当你从命令行启动它时,你也可以告诉 lldb 获取一个随机的命令文件(使用-s 选项)。要了解有关 lldb 命令行选项的更多信息,请运行:

     > lldb --help
    

    【讨论】:

      猜你喜欢
      • 2023-03-04
      • 1970-01-01
      • 2015-01-18
      • 1970-01-01
      • 1970-01-01
      • 2010-10-10
      • 2010-09-06
      • 2011-07-04
      • 2020-12-11
      相关资源
      最近更新 更多