lldb命令跳转:在当前函数外恢复?

lldb command jump: resume outside the current function?

LLDB 命令jump 允许我在程序停止的不同位置恢复程序执行,但它似乎仅限于当前函数内的地址:

(lldb) jump CLI.cpp:15
error: CLI.cpp:15 is outside the current function.

我对此很好奇,因为 lldb 的帮助中没有记录此限制,并且语法 jump <file>:<line> 不知何故表明可以使用任意入口点:

(lldb) help jump
     ('_regexp-jump')  Set the program counter to a new address.  Expects 'raw'
     input (see 'help raw-input'.)

Syntax: 
_regexp-jump <line>
_regexp-jump +<line-offset> | -<line-offset>
_regexp-jump <file>:<line>
_regexp-jump *<addr>

'jump' is an abbreviation for '_regexp-jump'

我知道在不同的 frame/stack 中恢复可能会使程序进入不一致状态并产生 "wonderful" 副作用。

如何跳转到 lldb 中当前函数之外的行(忽略可能的副作用)?

jump 是一个包装命令,它将底层 thread jump 的一些常见用途打包成一个紧凑的形式。这就是 lldb 中所有 _regex- 命令的内容。做:

(lldb) help command regex

如果您想了解有关此正则表达式命令的更多详细信息,当然

(lldb) help thread jump

了解您可以使用该命令执行的所有操作。

包装器不允许跳出当前函数,因为这绝对不是一个安全的操作,所以默认是假设您在输入行或文件名时犯了错误...

底层命令确实有一个 --force 选项,允许您将 pc 移出当前函数。