[lldb-dev] SBFunction::Invoke?

Carlo Kok ck at remobjects.com
Fri Sep 19 11:57:50 PDT 2014

On Fri, 19 Sep 2014 20:33:55 +0200, <jingham at apple.com> wrote:

> At present we use the expression parser to get around having to know the  
> argument and return value passing rules for a given platform in all  
> their gory details.
> We have a bug in with the llvm folks to get a way to tell us "given this  
> clang function type, where would all the individual arguments go, and  
> where would the return type go?"  When that is in place you could use it  
> to implement what you are asking for.  But I'd rather not code this up  
> by hand in lldb.  We did this for return values, just because folks  
> wanted it, and it's a tricky bit of code to write per ABI, and easy to  
> get wrong.  I don't want to also have to do this in full generality for  
> argument passing.
> At present, we have the ClangFunction class that does some of the job  
> you intend.  It still uses the expression parser, doesn't handle  
> variadic functions, and doesn't do things like type promotion.    But  
> for many cases it works fine, and you could probably use that at  
> present.  One of the nice things about the ClangFunction class is that  
> you can insert the code to call the function into the target and leave  
> it there, and then re-call it many times with different values.  We use  
> this internally for various nefarious purposes.  So it might be  
> worthwhile to have an SBFunction object cache the ClangFunction made for  
> it, so it could be reused.

I take it generating an SB* wrapper for ClangFunction makes no sense then?

I can wrap it on my side for my own purposes.

Carlo Kok
RemObjects Software

More information about the lldb-dev mailing list