From 02dff7ba5ca3b8e8af77786426e6cf525dd464bc Mon Sep 17 00:00:00 2001 From: Xusheng Date: Tue, 19 Sep 2023 10:35:26 +0800 Subject: [PATCH] Add more debug output in DbgEngAdapter::ConnectToDebugServerInternal --- core/adapters/dbgengadapter.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/adapters/dbgengadapter.cpp b/core/adapters/dbgengadapter.cpp index 40ea11d..8649893 100644 --- a/core/adapters/dbgengadapter.cpp +++ b/core/adapters/dbgengadapter.cpp @@ -180,7 +180,10 @@ bool DbgEngAdapter::ConnectToDebugServerInternal(const std::string& connectionSt { auto handle = GetModuleHandleA("dbgeng.dll"); if (handle == nullptr) - false; + { + LogWarn("Failed to get module handle for dbgeng.dll"); + return false; + } // HRESULT DebugCreate( // [in] REFIID InterfaceId, @@ -189,11 +192,17 @@ bool DbgEngAdapter::ConnectToDebugServerInternal(const std::string& connectionSt typedef HRESULT(__stdcall * pfunDebugCreate)(REFIID, PVOID*); auto DebugCreate = (pfunDebugCreate)GetProcAddress(handle, "DebugCreate"); if (DebugCreate == nullptr) + { + LogWarn("Failed to get the address of DebugCreate function"); return false; + } if (const auto result = DebugCreate(__uuidof(IDebugClient7), reinterpret_cast(&this->m_debugClient)); result != S_OK) - throw std::runtime_error("Failed to create IDebugClient7"); + { + LogWarn("Failed to create IDebugClient7"); + return false; + } QUERY_DEBUG_INTERFACE(IDebugControl7, &this->m_debugControl); QUERY_DEBUG_INTERFACE(IDebugDataSpaces, &this->m_debugDataSpaces); @@ -214,6 +223,7 @@ bool DbgEngAdapter::ConnectToDebugServerInternal(const std::string& connectionSt std::this_thread::sleep_for(std::chrono::milliseconds(100)); } + LogWarn("ConnectToDebugServerInternal timeout"); return false; }