MCPcopy Create free account
hub / github.com/MJx0/KittyMemoryEx / detach

Method detach

KittyMemoryEx/KittyTrace.cpp:75–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75bool KittyTraceMgr::detach()
76{
77 _attached = false;
78
79 if (!isAttached())
80 return true;
81
82 while (true)
83 {
84 int status = 0;
85 if (waitpid(_pid, &status, __WALL | WNOHANG) <= 0)
86 break;
87 }
88
89 errno = 0;
90 if (ptrace(PTRACE_DETACH, _pid, nullptr, nullptr) == -1L)
91 {
92 KITTY_LOGE("PTRACE_DETACH failed for pid %d. \"%s\".", _pid, strerror(errno));
93 return false;
94 }
95
96 while (true)
97 {
98 int status = 0;
99 if (waitpid(_pid, &status, __WALL | WNOHANG) <= 0)
100 break;
101 }
102
103 return true;
104}
105
106bool KittyTraceMgr::stop()
107{

Callers 2

mainFunction · 0.80
mainFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected