mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 04:45:58 +01:00
fixup backtrace curpath
This commit is contained in:
parent
ecd0156265
commit
0eee57aab9
1 changed files with 6 additions and 13 deletions
|
@ -61,22 +61,15 @@ void CrashReporter::createAndSaveCrash() {
|
|||
|
||||
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 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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue