[lldb-dev] Python API
daniel.malea at intel.com
Wed Oct 9 08:20:15 PDT 2013
I too have been working on a terminal UI for LLDB (but not GDB) with some
colleagues (CC'd). I will commit what we have thus far shortly and you can
see what we did, and maybe share some efforts/ideas.
BTW, in terms of listeners, we initialize them like so:
self.listener = debugger.GetListener()
On 2013-10-09 10:13 AM, "snare at ho.ax" <snare at ho.ax> wrote:
>I've been working on a terminal-based UI for LLDB (and GDB) recently
>and I have a few questions about the Python API.
>The way this tool works currently is by registering a new command that
>sends updates to client views, and then registering a stop-hook that
>calls that command whenever the debugger stops.
>From looking at the sample python code and the LLDB source I think maybe
>I could do the same thing using SBListener/SBBroadcaster/etc.
>I've tried stuff like this:
>listener = lldb.SBListener()
> if listener.WaitForEvent(1, event):
> print('got event: ' + event.GetDataFlavor())
>But I don't get notifications for processes starting and stopping.
>I've also tried stealing lldb.debugger's listener:
>listener = lldb.debugger.GetListener()
>Š but that hangs when I get the first event. I suspect maybe that's a
>terrible idea, and not how it's meant to be done when the LLDB CLI has
>created the SBDebugger instance and its listener.
>Is it possible to do this from a script run within an existing LLDB
>instance? It seems like all the sample code doing things like this is
>actually instantiating the SBDebugger itself and fully automating the
>debugging session, rather than being imported into LLDB and running from
>I'd also like to receive notifications for the following events:
>- a new file being loaded
>- a target being run
>- a target exiting
>lldb-dev mailing list
>lldb-dev at cs.uiuc.edu
More information about the lldb-dev