Skip to content

Commit 9ee2355

Browse files
committed
Fix crash when trying to attach to a process but the dbgeng fails to initialize. Fix #1009
1 parent d55e7bf commit 9ee2355

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

core/adapters/dbgengadapter.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,16 @@ bool DbgEngAdapter::AttachInternal(std::uint32_t pid)
788788
auto adapterSettings = GetAdapterSettings();
789789
auto attachPID = adapterSettings->Get<uint64_t>("attach.pid", data, &scope);
790790

791-
this->Start();
791+
if (!this->Start())
792+
{
793+
this->Reset();
794+
DebuggerEvent event;
795+
event.type = LaunchFailureEventType;
796+
event.data.errorData.error = fmt::format("Failed to initialize DbgEng");
797+
event.data.errorData.shortError = fmt::format("Failed to initialize DbgEng");
798+
PostDebuggerEvent(event);
799+
return false;
800+
}
792801

793802
if (const auto result = this->m_debugControl->SetEngineOptions(DEBUG_ENGOPT_INITIAL_BREAK); result != S_OK)
794803
{
@@ -1049,7 +1058,10 @@ std::vector<DebugProcess> DbgEngAdapter::GetProcessList()
10491058
if (!m_dbgengInitialized)
10501059
{
10511060
if (!Start())
1061+
{
1062+
LogWarn("Failed to initialize DbgEn");
10521063
return {};
1064+
}
10531065
}
10541066

10551067
ULONG Count = 0;

0 commit comments

Comments
 (0)