jmpews / Dobby

a lightweight, multi-platform, multi-architecture hook framework.
Apache License 2.0
4.05k stars 849 forks source link

Thread 1: EXC_BAD_ACCESS (code=1, address=0x0) #251

Closed marlkiller closed 10 months ago

marlkiller commented 10 months ago

I created a new MacOS -> Command Line project with xcode 15.2, and then introduced libdobby.dylib in the project;

I wrote a demo and reported an error. Both of our mac (x86_64/arm) books are this exception Thread 1: EXC_BAD_ACCESS (code=1, address=0x0),

Request support~~

#import <Foundation/Foundation.h>
#import "dobby.h"

int sum(int a, int b) {
    return a+b;
}
static int (*sum_p)(int a, int b);
int mySum(int a,int b){
    return a * b;
}

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        // insert code here...
        NSLog(@"Hello, World!");
        NSLog(@"%d", sum(1, 2));
        DobbyHook(sum, mySum, (void *)&sum_p);
        NSLog(@"%d", sum(1, 2));

    }
    return 0;
}
1
marlkiller commented 10 months ago

Resolved~~~~