@@ -62,14 +62,17 @@ typedef CFTypeRef AuthorizationRef;
6262
6363bool (*original_SMJobSubmit)(CFStringRef domain, CFDictionaryRef job, AuthorizationRef auth, CFErrorRef _Nullable *error);
6464
65+ static NSString *systemDebugserverPath;
66+
6567bool hooked_SMJobSubmit (CFStringRef domain, CFDictionaryRef job, AuthorizationRef auth, CFErrorRef _Nullable *error) {
6668 LOG (@" Enter hooked_SMJobSubmit %@ " , job);
6769 NSMutableDictionary *newJobInfo = [NSMutableDictionary dictionaryWithDictionary: (__bridge NSDictionary *)job];
6870 NSMutableArray *programArgs = [newJobInfo[@" ProgramArguments" ] mutableCopy ];
6971 NSString *program = programArgs[0 ];
7072 if (enabled) {
71- if ([program isEqualToString: @" /Developer/usr/bin/debugserver" ]) {
72- LOG (" Found launch /Developer/usr/bin/debugserver" );
73+ if ([program isEqualToString: @" /Developer/usr/bin/debugserver" ] || [program isEqualToString: @" /usr/libexec/debugserver" ]) {
74+ LOG (" Found launch %@" , program);
75+ systemDebugserverPath = [program copy ];
7376 if (debugserverPath.length > 0 && access (debugserverPath.UTF8String , F_OK) == 0 ){
7477 LOG (" Change to launch %@" , debugserverPath);
7578 programArgs[0 ] = debugserverPath;
@@ -96,9 +99,9 @@ bool hooked_SMJobSubmit(CFStringRef domain, CFDictionaryRef job, AuthorizationRe
9699 }
97100 } else {
98101 if ([program isEqualToString: debugserverPath]) {
99- LOG (" Found launch %@" ,debugserverPath);
100- LOG (" Restore launch /Developer/usr/bin/ debugserver with mobile" );
101- programArgs[0 ] = @" /Developer/usr/bin/debugserver " ;
102+ LOG (" Found launch %@" , debugserverPath);
103+ LOG (" Restore launch system debugserver at %@ with mobile" , systemDebugserverPath );
104+ programArgs[0 ] = systemDebugserverPath ;
102105 newJobInfo[@" ProgramArguments" ] = programArgs;
103106 newJobInfo[@" UserName" ] = @" mobile" ;
104107 LOG (@" Now SMJobSubmit %@ " , newJobInfo);
0 commit comments