Thanks for the reminder again, the reason I couldn't run lldb's before was 
because the version of python I installed didn't match, now it works fine! I 
get the following error using the lldb debugger:
|
(lldb) Process 2444 launched: 'C:\demo/test.exe' (x86_64)
Process 2444 stopped
* thread #1, stop reason = Exception 0xc0000005 encountered at address 
0x7ff88ae8d14a: Access violation reading location 0x000001a0
    frame #0: 0x00007ff88ae8d14a objc.dll`objc_msgSend + 70
objc.dll`objc_msgSend:
->  0x7ff88ae8d14a <+70>: movq   0x8(%r10,%rbx,8), %r10
    0x7ff88ae8d14f <+75>: movzbl %al, %ebx
    0x7ff88ae8d152 <+78>: movq   -0x8(%rsp), %rax
    0x7ff88ae8d157 <+83>: movq   0x8(%r10,%rbx,8), %r10



|


Based on the debugging information I've determined that it's because of a 
pointer error, but I've checked that my code doesn't use pointers incorrectly, 
and the debugging information mentions objc_xxx, which suggests that it's an 
error in the objc itself possiblely. After testing the objc_ related runtime 
function really does not work properly, the test code and test results are as 
follows:
|
@interface LayoutManager : NSObject
- (void)display;
@end


@implementation LayoutManager
- (void)display {
printf("LayoutManager::display\n");
}
@end


void test() {


}


int main() {
// LayoutManager *relative = [[LayoutManager alloc]init];
// [relative display];


id aClassFromName = objc_getClass("LayoutManager");
NSLog(@"aClass = %@", aClassFromName); //! null
id aClassFromClass = [NSArray class]; //! error
NSLog(@"aClass = %@", aClassFromClass); // Never go through here.


return 0;
}
|




China Guy.

Reply via email to