LLDB:等价于 python 中的进程连接

LLDB: Equivalent of process connect in python

我正在执行:

process connect <url>

从 lldb 命令行建立连接。我想做的是在 python 脚本中包含自动建立此连接。

我需要使用什么 python api?

在 SB API 这是 SBTarget::ConnectRemote。它不能是 SBProcess 方法,因为在调用此方法之前您没有进程...

请注意,您可能不想将自己的 SBListener 提供给 SBTarget::ConnectRemote。如果您提供 nil 侦听器,它(以及所有其他采用 SBListener 的进程创建调用)将使用调试器的侦听器。

例如,如果您正在编写一个 Python 命令来进行连接,那么您将希望在连接后让常规调试器的事件处理程序处理进程事件。

如果您想尝试自己处理流程事件,示例:

http://llvm.org/svn/llvm-project/lldb/trunk/examples/python/process_events.py

会让你开始。