diff options
-rw-r--r-- | docs/ISSUE_GUIDELINES.md | 2 | ||||
-rw-r--r-- | src/debug/CrashReporter.cpp | 55 |
2 files changed, 28 insertions, 29 deletions
diff --git a/docs/ISSUE_GUIDELINES.md b/docs/ISSUE_GUIDELINES.md index 0de63991..359c8259 100644 --- a/docs/ISSUE_GUIDELINES.md +++ b/docs/ISSUE_GUIDELINES.md @@ -59,7 +59,7 @@ coredumpctl info [PID] where `[PID]` is the PID you remembered. ## Obtaining the Hyprland Crash Report (v0.22.0beta and up) -Go to `~/.hyprland/` and you should find a file named `.hyprlandCrashReport[XXXX]` where `[XXXX]` is the PID of the process that crashed. +Go to `~/.hyprland/` and you should find a file named `hyprlandCrashReport[XXXX].txt` where `[XXXX]` is the PID of the process that crashed. If you do not see it, make sure you have "show hidden files" enabled in your file manager. diff --git a/src/debug/CrashReporter.cpp b/src/debug/CrashReporter.cpp index 084e44ad..5b8c8a40 100644 --- a/src/debug/CrashReporter.cpp +++ b/src/debug/CrashReporter.cpp @@ -10,22 +10,21 @@ #include <sys/sysctl.h> #endif - std::string getRandomMessage() { const std::vector<std::string> MESSAGES = {"Sorry, didn't mean to...", - "This was an accident, I swear!", - "Calm down, it was a misinput! MISINPUT!", - "Oops", - "Vaxry is going to be upset.", - "Who tried dividing by zero?!", - "Maybe you should try dusting your PC in the meantime?", - "I tried so hard, and got so far...", - "I don't feel so good...", - "*thud*", - "Well this is awkward.", - "\"stable\"", - "I hope you didn't have any unsaved progress."}; + "This was an accident, I swear!", + "Calm down, it was a misinput! MISINPUT!", + "Oops", + "Vaxry is going to be upset.", + "Who tried dividing by zero?!", + "Maybe you should try dusting your PC in the meantime?", + "I tried so hard, and got so far...", + "I don't feel so good...", + "*thud*", + "Well this is awkward.", + "\"stable\"", + "I hope you didn't have any unsaved progress."}; std::random_device dev; std::mt19937 engine(dev()); @@ -80,25 +79,25 @@ void CrashReporter::createAndSaveCrash() { size_t btSize; char** btSymbols; - btSize = backtrace(bt, 1024); - btSymbols = backtrace_symbols(bt, btSize); + btSize = backtrace(bt, 1024); + btSymbols = backtrace_symbols(bt, btSize); #if defined(KERN_PROC_PATHNAME) int mib[] = { - CTL_KERN, + CTL_KERN, #if defined(__NetBSD__) - KERN_PROC_ARGS, - -1, - KERN_PROC_PATHNAME, + KERN_PROC_ARGS, + -1, + KERN_PROC_PATHNAME, #else - KERN_PROC, - KERN_PROC_PATHNAME, - -1, + KERN_PROC, + KERN_PROC_PATHNAME, + -1, #endif }; - u_int miblen = sizeof(mib) / sizeof(mib[0]); - char exe[PATH_MAX] = ""; - size_t sz = sizeof(exe); + u_int miblen = sizeof(mib) / sizeof(mib[0]); + char exe[PATH_MAX] = ""; + size_t sz = sizeof(exe); sysctl(mib, miblen, &exe, &sz, NULL, 0); const auto FPATH = std::filesystem::canonical(exe); #elif defined(__OpenBSD__) @@ -112,9 +111,9 @@ void CrashReporter::createAndSaveCrash() { finalCrashReport += getFormat("\t#%i | %s\n", i, btSymbols[i]); #ifdef __clang__ - const auto CMD = getFormat("llvm-addr2line -e %s -f 0x%lx", FPATH.c_str(), (uint64_t)bt[i]); + const auto CMD = getFormat("llvm-addr2line -e %s -f 0x%lx", FPATH.c_str(), (uint64_t)bt[i]); #else - const auto CMD = getFormat("addr2line -e %s -f 0x%lx", FPATH.c_str(), (uint64_t)bt[i]); + const auto CMD = getFormat("addr2line -e %s -f 0x%lx", FPATH.c_str(), (uint64_t)bt[i]); #endif const auto ADDR2LINE = replaceInString(execAndGet(CMD.c_str()), "\n", "\n\t\t"); finalCrashReport += "\t\t" + ADDR2LINE.substr(0, ADDR2LINE.length() - 2); @@ -132,7 +131,7 @@ void CrashReporter::createAndSaveCrash() { std::filesystem::permissions(std::string(HOME) + "/.hyprland", std::filesystem::perms::all, std::filesystem::perm_options::replace); } - std::ofstream ofs(std::string(HOME) + "/.hyprland/.hyprlandCrashReport" + std::to_string(PID), std::ios::trunc); + std::ofstream ofs(std::string(HOME) + "/.hyprland/hyprlandCrashReport" + std::to_string(PID) + ".txt", std::ios::trunc); ofs << finalCrashReport; |