[lldb-dev] SBFunction::Invoke?

jingham at apple.com jingham at apple.com
Fri Sep 19 12:06:35 PDT 2014


I think it would make more sense to have this be something that hangs off of SBFunction, and have the implementation opaque to the SB API's.  To do that' you're probably going to have to stash the ClangFunction away in the lldb_private::Function, since you can't change the size of SBFunction (another of our API promises...) and it is just one pointer big, so life-time would be hard to manage.

Jim


> On Sep 19, 2014, at 11:57 AM, Carlo Kok <ck at remobjects.com> wrote:
> 
> 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