Skip to content

Commit

Permalink
Add more debug output in DbgEngAdapter::ConnectToDebugServerInternal
Browse files Browse the repository at this point in the history
  • Loading branch information
xusheng6 committed Sep 19, 2023
1 parent 089b147 commit 02dff7b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions core/adapters/dbgengadapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<void**>(&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);
Expand All @@ -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;
}

Expand Down

0 comments on commit 02dff7b

Please sign in to comment.