1#import <Foundation/Foundation.h> 2#include <stdlib.h> 3 4// A function with this signature will be called by LLDB to retrieve the 5// Objective-C class list. We shouldn't call this function that is defined 6// by the user if possible. 7Class *objc_copyRealizedClassList_nolock(unsigned int *outCount) { 8 // Don't try to implement this properly but just abort. 9 abort(); 10} 11 12// Define some custom class that makes LLDB read the Objective-C class list. 13@interface CustomClass : NSObject { 14}; 15@end 16@implementation CustomClass 17@end 18 19int main(int argc, char **argv) { 20 id custom_class = [[CustomClass alloc] init]; 21 // Make sure our trap function is emitted but never called (the test doesn't 22 // launch the executable with any args). 23 if (argc == 123) { 24 objc_copyRealizedClassList_nolock(0); 25 } 26 return 0; // break here 27} 28