Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to override Cocoa functions like NSLog, objc_msgSend #24

Open
szcoder opened this issue Oct 27, 2011 · 1 comment
Open

Failed to override Cocoa functions like NSLog, objc_msgSend #24

szcoder opened this issue Oct 27, 2011 · 1 comment

Comments

@szcoder
Copy link

szcoder commented Oct 27, 2011

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.

@szcoder
Copy link
Author

szcoder commented 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;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant