Skip to content

Commit

Permalink
Temporary workaround for WeChat debug freezing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wutian committed Mar 29, 2017
1 parent 1b59e6e commit 6589581
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions IPAPatch/IPAPatchBypassAntiDebugging.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,22 @@ int hooked_sysctl(int * arg0, u_int arg1, void * arg2, size_t * arg3, void * arg

if (modify_needed) {

ipa_kinfo_proc info;
int ret = original_sysctl(arg0, arg1, &info, arg3, arg4, arg5);
info.kp_proc.p_flag ^= P_TRACED;
bool original_p_traced = false;
{
ipa_kinfo_proc * pointer = arg2;
ipa_kinfo_proc info = *pointer;
original_p_traced = (info.kp_proc.p_flag & P_TRACED) != 0;
}

ipa_kinfo_proc * pointer = arg2;
*pointer = info;
int ret = original_sysctl(arg0, arg1, arg2, arg3, arg4, arg5);

// keep P_TRACED if input value contains it
if (!original_p_traced) {
ipa_kinfo_proc * pointer = arg2;
ipa_kinfo_proc info = *pointer;
info.kp_proc.p_flag ^= P_TRACED;
*pointer = info;
}

return ret;

Expand Down

0 comments on commit 6589581

Please sign in to comment.