mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-29 17:25:59 +01:00
fixup backtrace curpath
This commit is contained in:
parent
ecd0156265
commit
0eee57aab9
1 changed files with 6 additions and 13 deletions
|
@ -59,23 +59,16 @@ void CrashReporter::createAndSaveCrash() {
|
||||||
size_t btSize;
|
size_t btSize;
|
||||||
char** btSymbols;
|
char** btSymbols;
|
||||||
|
|
||||||
btSize = backtrace(bt, 1024);
|
btSize = backtrace(bt, 1024);
|
||||||
btSymbols = backtrace_symbols(bt, btSize);
|
btSymbols = backtrace_symbols(bt, btSize);
|
||||||
|
const auto FPATH = std::filesystem::canonical("/proc/self/exe");
|
||||||
|
|
||||||
for (size_t i = 0; i < btSize; ++i) {
|
for (size_t i = 0; i < btSize; ++i) {
|
||||||
finalCrashReport += getFormat("\t#%i | %s\n", i, btSymbols[i]);
|
finalCrashReport += getFormat("\t#%i | %s\n", i, btSymbols[i]);
|
||||||
|
|
||||||
std::string btSymbol = btSymbols[i];
|
const auto CMD = getFormat("addr2line -e %s -f 0x%lx", FPATH.c_str(), (uint64_t)bt[i]);
|
||||||
size_t hlPos = 0;
|
const auto ADDR2LINE = replaceInString(execAndGet(CMD.c_str()), "\n", "\n\t\t");
|
||||||
while (btSymbol.find("Hyprland", hlPos + 1) != std::string::npos) {
|
finalCrashReport += "\t\t" + ADDR2LINE.substr(0, ADDR2LINE.length() - 2);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(btSymbols);
|
free(btSymbols);
|
||||||
|
|
Loading…
Reference in a new issue