Add 'build_id' to crash log

Also performed light cleanup.
This commit is contained in:
Kawe Mazidjatari 2022-12-26 23:35:41 +01:00
parent cd3a80479e
commit 5502dcb8f1
4 changed files with 24 additions and 7 deletions

View File

@ -105,8 +105,14 @@ inline CModule g_GameDll = CModule("r5apex.exe");
inline CModule g_RadVideoToolsDll = CModule("bink2w64.dll");
inline CModule g_RadAudioDecoderDll = CModule("binkawin64.dll");
inline CModule g_RadAudioSystemDll = CModule("mileswin64.dll");
#if !defined (CLIENT_DLL)
inline CModule g_SDKDll = CModule("gamesdk.dll");
#else // This dll is loaded from 'bin/x64_retail//'
inline CModule g_SDKDll = CModule("client.dll");
#endif // !CLIENT_DLL
#else // No DirectX and Miles imports.
inline CModule g_GameDll = CModule("r5apex_ds.exe");
inline CModule g_SDKDll = CModule("dedicated.dll");
#endif // !DEDICATED
inline CSigCache g_SigCache;

View File

@ -97,7 +97,7 @@ void CCrashHandler::FormatSystemInfo()
const CPUInformation& pi = GetCPUInformation();
m_svBuffer.append(fmt::format("\tcpu_brand = \"{:s}\"\n", pi.m_szProcessorBrand));
m_svBuffer.append(fmt::format("\tcpu_model = \"{:s}\"\n", pi.m_szProcessorBrand));
m_svBuffer.append(fmt::format("\tcpu_speed = {:d} // clock cycles\n", pi.m_Speed));
for (int i = 0; ; i++)
@ -113,7 +113,7 @@ void CCrashHandler::FormatSystemInfo()
{
char szDeviceName[128];
wcstombs(szDeviceName, dd.DeviceString, sizeof(szDeviceName));
m_svBuffer.append(fmt::format("\tgpu_brand = \"{:s}\"\n", szDeviceName));
m_svBuffer.append(fmt::format("\tgpu_model = \"{:s}\"\n", szDeviceName));
m_svBuffer.append(fmt::format("\tgpu_flags = 0x{:08X} // primary device\n", dd.StateFlags));
}
}
@ -123,13 +123,21 @@ void CCrashHandler::FormatSystemInfo()
if (GlobalMemoryStatusEx(&statex))
{
m_svBuffer.append(fmt::format("\tram_total = [ [{:d}], [{:d}] ] // physical/virtual (MiB)\n", (statex.ullTotalPhys / 1024) / 1024, (statex.ullTotalVirtual / 1024) / 1024));
m_svBuffer.append(fmt::format("\tram_avail = [ [{:d}], [{:d}] ] // physical/virtual (MiB)\n", (statex.ullAvailPhys / 1024) / 1024, (statex.ullAvailVirtual / 1024) / 1024));
m_svBuffer.append(fmt::format("\tram_total = [ {:d}, {:d} ] // physical/virtual (MiB)\n", (statex.ullTotalPhys / 1024) / 1024, (statex.ullTotalVirtual / 1024) / 1024));
m_svBuffer.append(fmt::format("\tram_avail = [ {:d}, {:d} ] // physical/virtual (MiB)\n", (statex.ullAvailPhys / 1024) / 1024, (statex.ullAvailVirtual / 1024) / 1024));
}
m_svBuffer.append("}\n");
}
//-----------------------------------------------------------------------------
// Purpose: formats the build information
//-----------------------------------------------------------------------------
void CCrashHandler::FormatBuildInfo()
{
m_svBuffer.append(fmt::format("build_id: {:d}\n", g_SDKDll.m_pNTHeaders->FileHeader.TimeDateStamp));
}
//-----------------------------------------------------------------------------
// Purpose: formats the module, address and exception
// Input : pExceptionAddress -
@ -267,7 +275,7 @@ void CCrashHandler::FormatFPU(const char* pszRegister, M128A* pxContent)
*reinterpret_cast<float*>(&nVec[3])));
const char* pszVectorFormat = ", [{:d}, {:d}, {:d}, {:d}] ]\n";
int nHighest = *std::max_element(nVec, nVec + 4);
int nHighest = *std::max_element(nVec, nVec + SDK_ARRAYSIZE(nVec));
if (nHighest >= 1000000)
{
@ -371,6 +379,7 @@ long __stdcall ExceptionFilter(EXCEPTION_POINTERS* exceptionInfo)
g_CrashHandler->FormatCallstack();
g_CrashHandler->FormatRegisters();
g_CrashHandler->FormatSystemInfo();
g_CrashHandler->FormatBuildInfo();
g_CrashHandler->WriteFile();
g_CrashHandler->Unlock();

View File

@ -17,6 +17,7 @@ public:
void FormatCallstack();
void FormatRegisters();
void FormatSystemInfo();
void FormatBuildInfo();
const char* ExceptionToString() const;

View File

@ -36,6 +36,9 @@ public:
string GetModuleName(void) const;
uintptr_t GetRVA(const uintptr_t nAddress) const;
IMAGE_NT_HEADERS64* m_pNTHeaders = nullptr;
IMAGE_DOS_HEADER* m_pDOSHeader = nullptr;
ModuleSections_t m_ExecutableCode;
ModuleSections_t m_ExceptionTable;
ModuleSections_t m_RunTimeData;
@ -47,8 +50,6 @@ private:
string m_svModuleName;
uintptr_t m_pModuleBase{};
DWORD m_nModuleSize{};
IMAGE_NT_HEADERS64* m_pNTHeaders = nullptr;
IMAGE_DOS_HEADER* m_pDOSHeader = nullptr;
vector<ModuleSections_t> m_vModuleSections;
};