even more printf debugging :P

develop
Petr Mrázek 2009-10-29 17:52:40 +00:00
parent 9db0d5490a
commit 63582a7a70
1 changed files with 27 additions and 9 deletions

@ -139,16 +139,34 @@ bool Process::attach()
bool Process::detach() bool Process::detach()
{ {
// TODO: check for errors. int result = 0;
ptrace(PTRACE_DETACH, my_handle, NULL, NULL); cout << "detach: start" << endl;
result = close(g_ProcessMemFile);// close /proc/PID/mem
if(result == -1)
{
cerr << "couldn't close /proc/"<< my_handle <<"/mem" << endl;
return false;
}
else
{
cout << "detach: after closing /proc/"<< my_handle <<"/mem" << endl;
g_ProcessMemFile = -1;
result = ptrace(PTRACE_DETACH, my_handle, NULL, NULL);
if(result == -1)
{
cerr << "couldn't detach from process pid" << my_handle << endl;
return false;
}
else
{
cout << "detach: after detaching from "<< my_handle << endl;
attached = false; attached = false;
g_pProcess = NULL; g_pProcess = NULL;
g_ProcessHandle = 0; g_ProcessHandle = 0;
close(g_ProcessMemFile);// close /proc/PID/mem
g_ProcessMemFile = -1;
return true; return true;
} }
}
}
void Process::freeResources() void Process::freeResources()