Skip to content

Instantly share code, notes, and snippets.

@ohnit
Last active December 11, 2019 17:26
Show Gist options
  • Save ohnit/dbce2cdeefd432e813c0 to your computer and use it in GitHub Desktop.
Save ohnit/dbce2cdeefd432e813c0 to your computer and use it in GitHub Desktop.
LLDB Scripts
# print out names of a class's methods by using the class's name.
# change the name of the class on the first line. Copy, paste, and press enter
po NSString *$className = @"UIView";
po id $myClass = objc_getClass((const char *)[$className cStringUsingEncoding:4]); unsigned int $outCount; Method *$methods = (Method *)class_copyMethodList ($myClass, &$outCount); NSMutableArray *$array = [[NSMutableArray alloc] init];
po for(NSUInteger $i = 0; $i < $outCount; $i++) { Method $method = $methods[$i];NSString *$methodName = [NSString stringWithCString:(char *)sel_getName((SEL)method_getName($method))];[$array addObject:$methodName]; }
po $array
# print out properties of a class by using the class's name.
# change the name of the class on the first line. Copy, paste, and press enter
po NSString *$className = @"UIView";
po id $myClass = objc_getClass((const char *)[$className cStringUsingEncoding:4]); unsigned int $outCount; objc_property_t *$props = (objc_property_t *)class_copyPropertyList($myClass, &$outCount); NSMutableArray *$array = [[NSMutableArray alloc] init];
po for(NSUInteger $i = 0; $i < $outCount; $i++) { objc_property_t $prop = $props[$i];NSString *$propName = [NSString stringWithCString:(char *)property_getName($prop)];[$array addObject:$propName]; }
po $array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment