static void objc_updateDtableForClassContainingMethod(Method m) { Class nextClass = Nil; void *state = NULL; SEL sel = method_getName(m); while (Nil != (nextClass = objc_next_class(&state))) { if (class_getInstanceMethodNonrecursive(nextClass, sel) == m) { objc_update_dtable_for_class(nextClass); return; } } }
void printMethodsForClass(Class cls) { unsigned int totalCount; Method *methods __attribute__((cleanup(free_methods))) = class_copyMethodList(cls, &totalCount); printf("=> List Methods For Class: %s (%u)\n", class_getName(cls), totalCount); for (unsigned int i = 0; i<totalCount; i++) { Method method = methods[i]; SEL sel = method_getName(method); IMP imp = method_getImplementation(method); printf(" method<%p>: %s \n", imp, sel_getName(sel)); } printf("\n"); }