[lldb-dev] Getting the instance/static methods on an objc class

jingham at apple.com jingham at apple.com
Wed Jul 16 15:45:09 PDT 2014


llvm doesn't include method definitions in the type DIEs for an ObjC class, just the properties and ivars(neither did gcc.)  The method table for ObjC is dynamic so I'm not sure it would make sense to do this.  

lldb currently looks up method invocations one by one when it needs them (mostly in the expression parser) from the subroutine DIEs at the definition sites of the methods if we have debug information for them, or from the ObjC runtime as a fallback. Since there's no reason to do so and it would be fairly expensive, lldb doesn't try to gather all the methods into its type representation for the class by hand.

The internal API's have FindSymbols & FindFunctions APIs that take regular expression search patterns.  You could get all the symbols & functions matching "^-[MyClass" and "^+[MyClass", that would get you the methods whose names we know about (though not necessarily which method would actually get invoked when a given selector is sent.)  A lookup by regexp on SBTarget wouldn't be a bad addition either...


Jim

> On Jul 16, 2014, at 7:01 AM, Carlo Kok <ck at remobjects.com> wrote:
> 
> How do I get a list of the methods (and the signatures) if I have the SBType for a given objc type?
> 
> If that can't be derived from the objc type info, what do I need to do to expose it from the llvm side?
> 
> -- 
> 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