Skip to content

Commit

Permalink
Explicitly add the executable directory to the windbg search path
Browse files Browse the repository at this point in the history
  • Loading branch information
dpjudas committed Jan 2, 2025
1 parent 3cf479f commit e5648ea
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/common/platform/win32/i_crash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,27 @@ class DbgPtr
T* Ptr;
};

static std::wstring GetPdbFilename()
static std::wstring GetExeFilename()
{
wchar_t buffer[1024] = {};
if (GetModuleFileName(0, buffer, 1024) == FALSE)
return {};
return buffer;
}

static std::wstring GetExePath()
{
wchar_t exeFilename[1024] = {};
if (GetModuleFileName(0, exeFilename, 1024) == FALSE)
std::wstring exePath = GetExeFilename();
size_t pos = exePath.find_last_of(L"/\\");
if (pos == std::wstring::npos)
return {};
std::wstring pdbFilename = exeFilename;
exePath.resize(pos);
return exePath;
}

static std::wstring GetPdbFilename()
{
std::wstring pdbFilename = GetExeFilename();
pdbFilename.resize(pdbFilename.size() - 3);
pdbFilename += L"pdb";
return pdbFilename;
Expand Down Expand Up @@ -486,6 +501,8 @@ void I_AddMinidumpCallstack(const FString& minidumpFilename, FString& text, FStr
if (FAILED(result))
return;

symbols->AppendSymbolPathWide(GetExePath().c_str());

result = client->OpenDumpFileWide(minidumpFilename.WideString().c_str(), 0);
if (FAILED(result))
return;
Expand Down

0 comments on commit e5648ea

Please sign in to comment.