I just spoke with Jim Ingham and he change my mind. If, every time you stop, you want to call a function, this feature could come in handy.Behind the curtains it should:- install a ClangFunction down in the host and leave it there so it can be called (we do this internally with a few functions) - allow it to be called with a SBValueList. All arguments will need to manually be supplied (the "this", and ObjC "cmd" and "selector" arguments, etc)- it should be able to be uninstalled from the target
That gives a patch like the attached patch. What I changed: * Target has a method to get & cache a selector * SBFunction has an ExecuteFunction api + lldb::SBValue ExecuteFunction(lldb::SBFrame &frame, + lldb::SBValueList arguments, + lldb::SBStream &errors, + lldb::SBExpressionOptions options, + bool reusable); * SBTypeMemberFunction has an ExecuteFunction api: + lldb::SBValue ExecuteFunction(lldb::SBFrame &frame, + lldb::SBValue self, + lldb::SBValueList arguments, + lldb::SBStream &errors, + lldb::SBExpressionOptions options, + bool reusable);Atm, it only supports ObjC methods and it prepares the selector for you, just requiring a "Self" valu and optional arguments, the reason I did this is because it's rather tricky to get a selector and wrap it in an SBValue from the calling side, and lldb itself allows for easier caching.
In ClangFunction I added GetCanonicalType() to the result & parameter types. This at least lets me use it with a selector like:
typedef int MyInteger; +(MyInteger)MyFunction;as it turns that into int instead of MyInteger. I'm still looking for a way to tell ClangFunction about the type aliases lldb knows about though (it's fully aware of MyInteger, it just fails on it when used from ClangFunction).
Feedback and ideas for the typedef issue appreciated. -- Carlo Kok RemObjects Software
lldb-execute-function-patch.patch
Description: Binary data
_______________________________________________ lldb-dev mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
