MCPcopy Create free account
hub / github.com/beefytech/Beef / Detach

Method Detach

IDEHelper/WinDebugger.cpp:1546–1652  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1544static int gDebugUpdateCnt = 0;
1545
1546void WinDebugger::Detach()
1547{
1548 BfLogDbg("Debugger Detach\n");
1549
1550 mDebugManager->mNetManager->CancelAll();
1551 while ((mIsRunning) || (mDebuggerThreadId != 0))
1552 {
1553 mShuttingDown = true;
1554 Sleep(1);
1555 }
1556
1557 for (auto profiler : mProfilerSet)
1558 profiler->Stop();
1559
1560 BfLogDbg("Debugger Detach - thread finished\n");
1561
1562 mPendingProfilerMap.Clear();
1563 for (auto profiler : mNewProfilerList)
1564 delete profiler;
1565 mNewProfilerList.Clear();
1566
1567 mPendingImageLoad.Clear();
1568 mPendingDebugInfoLoad.Clear();
1569
1570 RemoveTempBreakpoints();
1571 mContinueEvent.Reset();
1572 if (mDebugTarget != mEmptyDebugTarget)
1573 delete mDebugTarget;
1574 mDebugTarget = mEmptyDebugTarget;
1575
1576 mShuttingDown = false;
1577 mStepSP = 0;
1578 ClearCallStack();
1579 mRunState = RunState_NotStarted;
1580 mStepType = StepType_None;
1581 mHadImageFindError = false;
1582 mIsPartialCallStack = true;
1583
1584 delete mDebugPendingExpr;
1585 mDebugPendingExpr = NULL;
1586
1587 for (auto threadPair : mThreadMap)
1588 {
1589 auto threadInfo = threadPair.mValue;
1590 delete threadInfo;
1591 }
1592 mThreadMap.Clear();
1593 mThreadList.Clear();
1594 mHotTargetMemory.Clear();
1595
1596 // We don't need to close the hThread when we have attached to a process
1597 if (mDbgProcessId == 0)
1598 {
1599 CloseHandle(mProcessInfo.hThread);
1600 CloseHandle(mProcessInfo.hProcess);
1601 }
1602
1603 for (auto breakpoint : mBreakpoints)

Callers 1

Debugger_DetachFunction · 0.45

Calls 6

IsHandleValidFunction · 0.70
SleepFunction · 0.50
CancelAllMethod · 0.45
StopMethod · 0.45
ClearMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected