|
|
@ -86,6 +86,7 @@ bool Process::attach()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << "Attach_start" << endl;
|
|
|
|
// can we attach?
|
|
|
|
// can we attach?
|
|
|
|
if (ptrace(PTRACE_ATTACH , my_handle, NULL, NULL) == -1)
|
|
|
|
if (ptrace(PTRACE_ATTACH , my_handle, NULL, NULL) == -1)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -94,6 +95,7 @@ bool Process::attach()
|
|
|
|
cerr << "attach failed on pid" << my_handle << endl;
|
|
|
|
cerr << "attach failed on pid" << my_handle << endl;
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << "Attach_after_ptrace" << endl;
|
|
|
|
int status;
|
|
|
|
int status;
|
|
|
|
while(true)
|
|
|
|
while(true)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -113,12 +115,13 @@ bool Process::attach()
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//cout << "Managed to attach to pid " << my_handle << endl;
|
|
|
|
cout << "Managed to attach to pid " << my_handle << endl;
|
|
|
|
|
|
|
|
|
|
|
|
attached = true;
|
|
|
|
attached = true;
|
|
|
|
g_pProcess = this;
|
|
|
|
g_pProcess = this;
|
|
|
|
g_ProcessHandle = my_handle;
|
|
|
|
g_ProcessHandle = my_handle;
|
|
|
|
g_ProcessMemFile = open(memFile.c_str(),O_RDONLY);
|
|
|
|
g_ProcessMemFile = open(memFile.c_str(),O_RDONLY);
|
|
|
|
|
|
|
|
cout << "Attach_after_opening /proc/PID/mem" << endl;
|
|
|
|
return true; // we are attached
|
|
|
|
return true; // we are attached
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|