Check if PDB file can be found as it seem people either don't install it or windbg doesn't always use it?
This commit is contained in:
parent
3a179ec1c6
commit
3cf479fff8
1 changed files with 28 additions and 0 deletions
|
|
@ -26,6 +26,7 @@
|
|||
#include <mutex>
|
||||
#include <thread>
|
||||
#include "i_mainwindow.h"
|
||||
#include "version.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <dbghelp.h>
|
||||
|
|
@ -444,8 +445,32 @@ public:
|
|||
T* Ptr;
|
||||
};
|
||||
|
||||
static std::wstring GetPdbFilename()
|
||||
{
|
||||
wchar_t exeFilename[1024] = {};
|
||||
if (GetModuleFileName(0, exeFilename, 1024) == FALSE)
|
||||
return {};
|
||||
std::wstring pdbFilename = exeFilename;
|
||||
pdbFilename.resize(pdbFilename.size() - 3);
|
||||
pdbFilename += L"pdb";
|
||||
return pdbFilename;
|
||||
}
|
||||
|
||||
static bool IsPdbFileMissing()
|
||||
{
|
||||
std::wstring pdbFilename = GetPdbFilename();
|
||||
HANDLE filehandle = CreateFile(pdbFilename.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
if (filehandle == INVALID_HANDLE_VALUE)
|
||||
return true;
|
||||
CloseHandle(filehandle);
|
||||
return false;
|
||||
}
|
||||
|
||||
void I_AddMinidumpCallstack(const FString& minidumpFilename, FString& text, FString& logText)
|
||||
{
|
||||
if (IsPdbFileMissing())
|
||||
logText.AppendFormat("\nWarning: could not find " GAMENAMELOWERCASE ".pdb - No call stack will be displayed for the crash.\n");
|
||||
|
||||
DbgPtr<IDebugClient5> client;
|
||||
HRESULT result = DebugCreate(client.GetIID(), client.InitPtr());
|
||||
if (FAILED(result))
|
||||
|
|
@ -476,6 +501,9 @@ void I_AddMinidumpCallstack(const FString& minidumpFilename, FString& text, FStr
|
|||
{
|
||||
std::string description(descriptionText, descriptionSize - 1);
|
||||
size_t uselessInfoPos = description.find(" (first/second chance not available)");
|
||||
if (uselessInfoPos != std::string::npos)
|
||||
description.resize(uselessInfoPos);
|
||||
uselessInfoPos = description.find(" - code");
|
||||
if (uselessInfoPos != std::string::npos)
|
||||
description.resize(uselessInfoPos);
|
||||
text = description;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue