不知为什么我hook这类sub_xxx的函数后,app运行就会崩溃。下面是我hook的代码,我是没看出有什么不对的地方,有同学能帮忙看下问题出在哪么。
NSData* (old_sub_1014b5324)(int, NSData);
NSData* new_sub_1014b5324(int platform, NSData* data);
NSData* new_sub_1014b5324(int platform, NSData* data)
{
NSLog(@“wxq this is new_sub_1014b5324”);
return old_sub_1014b5324(platform, data);
}
%ctor
{
%init;
unsigned long _sub_1014b5324 = (_dyld_get_image_vmaddr_slide(0) + 0x1014b5324) | 0x1;
if(_sub_1014b5324){
NSLog(@“wxq found _sub_1014b5324”);
}
MSHookFunction((void*)_sub_1014b5324, (void*)&new_sub_1014b5324, (void**)&old_sub_1014b5324);
NSLog(@"wxq hook sub_1014b5324 success");
}
那么问题来了,怎样在lldb或者cycript中手动的调用这个sub_1014b5324函数呢?