aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-02-20 10:28:16 +0000
committervaxerski <[email protected]>2023-02-20 10:28:16 +0000
commit0eee57aab9df98e6fe16df94da0fdfaf4f350504 (patch)
tree67c06dde45c1c7b5c8fe5d05307151f90fd0fd70
parentecd015626546e28e759afde606e63d71d2fae181 (diff)
downloadHyprland-0eee57aab9df98e6fe16df94da0fdfaf4f350504.tar.gz
Hyprland-0eee57aab9df98e6fe16df94da0fdfaf4f350504.zip
fixup backtrace curpath
-rw-r--r--src/debug/CrashReporter.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/debug/CrashReporter.cpp b/src/debug/CrashReporter.cpp
index 20e9b48e..6876e390 100644
--- a/src/debug/CrashReporter.cpp
+++ b/src/debug/CrashReporter.cpp
@@ -59,23 +59,16 @@ 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);
+ const auto FPATH = std::filesystem::canonical("/proc/self/exe");
for (size_t i = 0; i < btSize; ++i) {
finalCrashReport += getFormat("\t#%i | %s\n", i, btSymbols[i]);
- std::string btSymbol = btSymbols[i];
- size_t hlPos = 0;
- while (btSymbol.find("Hyprland", hlPos + 1) != std::string::npos) {
- hlPos = btSymbol.find("Hyprland", hlPos + 1);
- }
-
- if (hlPos != 0) {
- const auto CMD = getFormat("addr2line -e %s -f 0x%lx", btSymbol.substr(0, hlPos + 8).c_str(), (uint64_t)bt[i]);
- const auto ADDR2LINE = replaceInString(execAndGet(CMD.c_str()), "\n", "\n\t\t");
- finalCrashReport += "\t\t" + ADDR2LINE.substr(0, ADDR2LINE.length() - 2);
- }
+ const auto CMD = getFormat("addr2line -e %s -f 0x%lx", FPATH.c_str(), (uint64_t)bt[i]);
+ const auto ADDR2LINE = replaceInString(execAndGet(CMD.c_str()), "\n", "\n\t\t");
+ finalCrashReport += "\t\t" + ADDR2LINE.substr(0, ADDR2LINE.length() - 2);
}
free(btSymbols);