You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Failed to override Cocoa functions like NSLog, objc_msgSend #24
Thank you for this project. I successfully use mach_override to replace local functions and stdio functions.
However I failed to override cocoa functions, for example, objc_msgSend and NSLog. The error is below
mach_override: some instructions unknown! Need to update mach_override.c
err = f8000001 /Volumes/Data/rentzsch-mach_star-b5c0803/mach_override/mach_override.c:226
err = f8000001 /Volumes/Data/rentzsch-mach_star-b5c0803/mach_override/mach_override.c:239
err = f8000001 /Volumes/Data/rentzsch-mach_star-b5c0803/mach_override/mach_override.c:245
err = f8000001 /Volumes/Data/rentzsch-mach_star-b5c0803/mach_override/mach_override.c:259
err = f8000001 /Volumes/Data/rentzsch-mach_star-b5c0803/mach_override/mach_override.c:264
I am using Xcode 4.2 and Mac OS X Lion 10.7.2, 64bit kernel and app. Can you please look into it? Many thanks.
Activity
szcoder commentedon Oct 27, 2011
Below is the source of my test.m file
#import "objc/objc.h"
#import "objc/runtime.h"
#import "objc/message.h"
#include "stdio.h"
#include "mach_override.h"
id (*savedFuncPtr)(id obj, SEL sel, ...);
id my_msgSend(id obj, SEL sel, ...) {
printf("my_msgSend Called\n");
return nil;
}
int main(int argc, const char* argv[]) {
mach_override_ptr(objc_msgSend, my_msgSend, (void**)&savedFuncPtr);
//objc_msgSend(nil, nil);
return 0;
}