[lldb-dev] How do you call complex methods from python?

jingham at apple.com jingham at apple.com
Mon Oct 6 11:47:43 PDT 2014


There is a type map in the type maps that goes from C "void *, size_t" -> Python string.  So you should be able to do:

buffer = ""

then pass that in for the first "two" arguments...

Jim

> On Oct 6, 2014, at 11:42 AM, Zachary Turner <zturner at google.com> wrote:
> 
> +enrico
> 
> I actually didn't even get that far, because it was failing on the second argument, the void* buffer.  I tried using ctypes.create_string_buffer and passing that in, but that wasn't working either.  
> 
> On Mon, Oct 6, 2014 at 11:29 AM, <jingham at apple.com> wrote:
> Enrico is the man for this sort of thing, but as I understand it, fancy argument conversions from the SB API's into Python methods are governed by %typemap swig directives, there are a bunch of these in scripts/Python/python-typemaps.swig.  But swig has default handling for C++ references, so I would imagine that you just make a python variable initialized to some ConnectionStatus enum value, and then pass that in.  Does that not work?
> 
> Jim
> 
> 
> 
> 
> > On Oct 2, 2014, at 6:00 PM, Zachary Turner <zturner at google.com> wrote:
> >
> > When public methods take complex arguments like char*'s that get written into, parameters passed by reference, etc, how do we know what syntax to call them with from Python?
> >
> > For example, consider this method:
> >
> > size_t
> > SBCommunication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, ConnectionStatus &status)
> >
> > The first argument is a buffer that gets written to.  The last argument is a ConnectionStatus that gets passed by reference.  In lldb, I'm doing the following:
> >
> > >>> comm = lldb.SBCommunication("test")
> > >>> comm.Connect("file://d:\\file1.cpp")
> > >>> comm.Read(?????)
> >
> > How do I write this so that it works?
> > _______________________________________________
> > 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