in Exdi/exdigdbsrv/ExdiGdbSrv/LiveExdiGdbSrvServer.cpp [1574:1617]
HRESULT STDMETHODCALLTYPE CLiveExdiGdbSrvServer::PerformKeepaliveChecks(void)
{
if (m_pKeepaliveInterface == nullptr)
{
return S_FALSE;
}
AsynchronousGdbSrvController * pController = GetGdbSrvController();
if (pController == nullptr)
{
return E_POINTER;
}
// Get the GdbServer connection status
bool isGdbServerDown = false;
HRESULT gdbServerError = S_OK;;
if (pController->CheckGdbSrvAlive(gdbServerError))
{
if (gdbServerError == ERROR_OPERATION_ABORTED)
{
// Close the connection with the GdbServer
pController->ShutdownGdbSrv();
isGdbServerDown = true;
}
}
HRESULT result = m_pKeepaliveInterface->IsDebugSessionAlive();
if (FAILED(result) || isGdbServerDown)
{
TCHAR fileName[MAX_PATH];
bool lostConnection = ((gdbServerError == ERROR_OPERATION_ABORTED) || HRESULT_FACILITY(result) == FACILITY_WIN32 &&
((HRESULT_CODE(result) == RPC_S_CALL_FAILED) || (HRESULT_CODE(result) == RPC_S_SERVER_UNAVAILABLE)));
if (lostConnection && GetModuleFileName(GetModuleHandle(0), fileName, _countof(fileName)))
{
TCHAR *pLastSlash = _tcsrchr(fileName, '\\');
if (pLastSlash && !_tcsicmp(pLastSlash + 1, _T("dllhost.exe")))
{
ExitProcess(result);
}
}
}
return S_OK;
}