Skip to content

Commit 232f55b

Browse files
committed
feat: add compiler information to crashdumps
1 parent f623b8e commit 232f55b

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

core/shared/src/implementation/engine/engine.cpp

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ static std::unordered_map<std::string, std::shared_ptr<pragma::console::PtrConVa
6767
}
6868

6969
std::unordered_map<std::string, std::shared_ptr<pragma::console::PtrConVar>> &pragma::Engine::GetConVarPtrs() { return get_convar_ptrs(); }
70-
pragma::console::ConVarHandle pragma::Engine::GetConVarHandle(std::string scvar)
71-
{
72-
return CVarHandler::GetConVarHandle(get_convar_ptrs(), scvar);
73-
}
70+
pragma::console::ConVarHandle pragma::Engine::GetConVarHandle(std::string scvar) { return CVarHandler::GetConVarHandle(get_convar_ptrs(), scvar); }
7471

7572
static pragma::Engine *g_engine = nullptr;
7673

@@ -87,7 +84,7 @@ pragma::Engine::Engine(int argc, char *argv[]) : CVarHandler(), m_logFile(nullpt
8784
g_engine = this;
8885

8986
static auto registeredGlobals = false;
90-
if (!registeredGlobals) {
87+
if(!registeredGlobals) {
9188
registeredGlobals = true;
9289
datasystem::register_base_types();
9390
datasystem::Texture::register_type();
@@ -1024,7 +1021,8 @@ void pragma::Engine::Start()
10241021

10251022
void pragma::Engine::UpdateTickCount() { m_ctTick.Update(); }
10261023

1027-
static void add_zip_file(uzip::ZIPFile &zip, const std::string &fileName, const std::string &zipFileName) {
1024+
static void add_zip_file(uzip::ZIPFile &zip, const std::string &fileName, const std::string &zipFileName)
1025+
{
10281026
std::string path;
10291027
if(!pragma::fs::find_absolute_path(fileName, path))
10301028
return;
@@ -1106,6 +1104,38 @@ void pragma::Engine::DumpDebugInformation(uzip::ZIPFile &zip) const
11061104
}
11071105
zip.AddFile("engine.txt", engineInfo.str());
11081106

1107+
std::stringstream compilerInfo;
1108+
#if defined(__clang__)
1109+
1110+
#if defined(_MSC_VER)
1111+
compilerInfo << "Compiler: Clang-cl (MSVC Emulator)\n";
1112+
compilerInfo << "Emulating MSVC version: " << (_MSC_VER / 100) << '.' << (_MSC_VER % 100) << '\n';
1113+
#else
1114+
compilerInfo << "Compiler: Clang\n";
1115+
#endif
1116+
1117+
compilerInfo << "Version string: " << __clang_version__ << '\n';
1118+
compilerInfo << "Version: " << __clang_major__ << '.' << __clang_minor__ << '.' << __clang_patchlevel__ << '\n';
1119+
#elif defined(__GNUC__) || defined(__GNUG__)
1120+
compilerInfo << "Version string: " << __VERSION__ << '\n';
1121+
compilerInfo << "Version: " << __GNUC__ << '.' << __GNUC_MINOR__ << '.' << __GNUC_PATCHLEVEL__ << '\n';
1122+
#elif defined(_MSC_VER)
1123+
compilerInfo << "Compiler: MSVC\n";
1124+
// _MSC_VER encodes major*100 + minor (e.g. 1928 -> 19.28)
1125+
int msc = _MSC_VER;
1126+
int major = msc / 100;
1127+
int minor = msc % 100;
1128+
compilerInfo << "Version: " << major << '.' << minor << '\n';
1129+
#ifdef _MSC_FULL_VER
1130+
// full build number (format is vendor-specific)
1131+
compilerInfo << "Full: " << _MSC_FULL_VER << '\n';
1132+
#endif
1133+
1134+
#else
1135+
compilerInfo << "Compiler: Unknown\n";
1136+
#endif
1137+
zip.AddFile("compiler.txt", compilerInfo.str());
1138+
11091139
add_zip_file(zip, "git_info.txt", "git_info.txt");
11101140

11111141
auto fWriteConvars = [&zip](const std::map<std::string, std::shared_ptr<console::ConConf>> &cvarMap, const std::string &fileName) {

0 commit comments

Comments
 (0)