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

Carlo Kok ck at remobjects.com
Thu Jul 17 00:03:46 PDT 2014


On Thu, 17 Jul 2014 00:45:09 +0200, <jingham at apple.com> wrote:

> 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.

I need that info for my own language frontend, would there be any interest  
in a patch that lets me find this information (and maybe the static  
vars/consts on a class once i figure out how to encode them) from the  
SBType side?

>
> 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...
>
>

I can try and build a patch for that.


-- 
Carlo Kok
RemObjects Software



More information about the lldb-dev mailing list