[lldb-dev] SBFunction::Invoke?

jingham at apple.com jingham at apple.com
Fri Sep 19 11:33:55 PDT 2014

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.


> On Sep 19, 2014, at 11:07 AM, Carlo Kok <ck at remobjects.com> wrote:
> Shouldn't there be some way to just invoke a function (SBFunction) given a set of values (SBValue)? I know there's an evaluate which is great for parsing an input string, but not if I already have the right function.
> If this is desirable I can provide a patch if someone can give me a hint at where to start the code for this.
> -- 
> Carlo Kok
> RemObjects Software
> _______________________________________________
> 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