MCPcopy Create free account
hub / github.com/Vector35/debugger / Reset

Method Reset

core/adapters/dbgengttdadapter.cpp:196–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194
195
196void DbgEngTTDAdapter::Reset()
197{
198 m_aboutToBeKilled = false;
199
200 if (!this->m_debugActive)
201 return;
202
203 // Free up the resources if the dbgsrv is launched by the adapter. Otherwise, the dbgsrv is launched outside BN,
204 // we should keep everything active.
205 SAFE_RELEASE(this->m_debugControl);
206 SAFE_RELEASE(this->m_debugDataSpaces);
207 SAFE_RELEASE(this->m_debugRegisters);
208 SAFE_RELEASE(this->m_debugSymbols);
209 SAFE_RELEASE(this->m_debugSystemObjects);
210
211 if (this->m_debugClient)
212 {
213 this->m_debugClient->EndSession(DEBUG_END_PASSIVE);
214 m_server = 0;
215 }
216
217 // There seems to be an internal ref-counting issue in the DbgEng TTD engine, that the reference for the debug
218 // client is not properly freed after the target has exited. To properly free the debug client instance, here we
219 // are calling Release() a few more times to ensure the ref count goes down to 0. Luckily this would not cause
220 // a UAF or crash.
221 // This might be related to the weird behavior of not terminating the target when we call TerminateProcesses(),
222 // (see comment in `DbgEngTTDAdapter::Quit()`).
223 // The same issue is not observed when we do forward debugging using the regular DbgEng. Also, I cannot reproduce
224 // the issue using my script https://github.com/xusheng6/dbgeng_test.
225 for (size_t i = 0; i < 100; i++)
226 m_debugClient->Release();
227
228 SAFE_RELEASE(this->m_debugClient);
229
230 this->m_debugActive = false;
231}
232
233
234bool DbgEngTTDAdapter::Quit()

Callers 2

StartMethod · 0.95

Calls 1

ReleaseMethod · 0.45

Tested by

no test coverage detected