【问题标题】:List source around break point in lldb列出lldb中断点周围的源代码
【发布时间】:2020-07-06 19:42:28
【问题描述】:

当我到达 lldb 中的断点时,我希望能够看到执行停止点附近的源代码。 l 命令似乎没有任何选项可以做到这一点:

help l
     List relevant source code using one of several shorthand formats.  Expects 'raw' input (see 'help raw-input'.)

Syntax:
_regexp-list <file>:<line>   // List around specific file/line
_regexp-list <line>          // List current file around specified line
_regexp-list <function-name> // List specified function
_regexp-list 0x<address>     // List around specified address
_regexp-list -[<count>]      // List previous <count> lines
_regexp-list                 // List subsequent lines

l 只是向下打印,而不是在执行停止的地方打印。获得所需视图的最简单方法是什么?

【问题讨论】:

  • 如果您使用命令行 lldb,当您遇到断点时,您应该会看到 stop pc 周围的行。你没看到吗?还是那不是你想要的?
  • 还要注意,单独使用f 别名作为命令将重做停止源列表。如果停止源列表不符合您的要求,这并没有太大帮助,但如果您一直在列出后续行,然后想要返回列出停止点,这将很有用。

标签: llvm lldb clang++


【解决方案1】:

你可以使用引用的:

_regexp-list 0x<address>     // List around specified address

像这样:

p/x $pc
(unsigned long) $5 = 0x00000001000008c7
l 0x00000001000008c7

pc 代表程序计数器。

【讨论】:

    猜你喜欢
    • 2013-07-03
    • 2016-10-13
    • 2021-04-22
    • 2019-12-10
    • 2016-08-26
    • 1970-01-01
    • 2017-03-20
    • 2013-03-21
    • 2019-02-15
    相关资源
    最近更新 更多