[lldb-dev] writing an extension command in Python
Cameron McCormack
cam at mcc.id.au
Tue Jan 4 15:33:49 PST 2011
Hi Caroline.
Caroline Tice:
> Could you elaborate a bit more on what you are trying to do?
>
> "showimage ..." is not an lldb command. Is it a Python function that
> you have defined in a Python module and wish to import/call?
Yes. I want to be able to type “showimage …” at the lldb prompt and
have that run some Python code that does the image showing.
> lldb include a fairly complete embedded Python interpreter. To get
> to the Python interpreter from the lldb command line prompt you
> can either type "script <some-python-command>" to execute a one
> line Python command, or you can just type "script" to drop into an
> interactive Python interpreter (with the lldb API pre-loaded).
Ah, I see: so I would write a Python function and then set up an alias
so that “showimage” would call it? How do I ensure that my Python
function is available to the Python interpreter within lldb? Should I
put it in a particular directory?
> If you can give me more details as to what you are trying to do, I can
> probably answer your question.
I also need to know how my Python script can get access to the debugger.
Is there some global variable that is an SBDebugger object for the
debugger that is running, which my script can use?
Thanks,
Cameron
--
Cameron McCormack ≝ http://mcc.id.au/
More information about the lldb-dev
mailing list