[lldb-dev] writing an extension command in Python

Caroline Tice ctice at apple.com
Tue Jan 4 15:26:32 PST 2011


Hi Cameron,

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?

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).

If you can give me more details as to what you are trying to do, I can probably answer your question.

-- Caroline
ctice at apple.com


On Jan 4, 2011, at 3:11 PM, Cameron McCormack wrote:

> Hi.
> 
> I guess this is more of a user question than a dev question, but since
> there is no user mailing list I hope that it’s OK to post here!
> 
> I want to write an extension command in Python that would work something
> like this:
> 
>  (lldb) showimage 300 200 <some-expr-that-evaluates-to-a-pointer>
> 
> which grabs the data at the pointer and goes off and writes it to a file
> as a PNG, or pops up a window showing the image, or something like that.
> 
> How do I go about writing the extension?  I see there is this disasm.py
> example, but that seems to be controlling lldb from Python rather than
> registering an extension to be called from the lldb prompt.
> 
> Also, is there documentation yet on how to use the API?  The C++ headers
> in include/lldb/API don’t seem to have doxygen comments.  (I can
> probably fumble my way through working out the Python API from the C++
> one, if it is documented.)
> 
> Thanks!
> 
> Cameron
> 
> -- 
> Cameron McCormack ≝ http://mcc.id.au/
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev





More information about the lldb-dev mailing list