1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 16:05:06 +00:00

Kernel: Demangle kernel C++ symbols correctly again

I broke this while implementing module linking. Also move the actual
demangling work to AK, in AK::demangle(const char*)
This commit is contained in:
Andreas Kling 2019-11-29 14:55:07 +01:00
parent 422e5166f2
commit f75a6b9daa
4 changed files with 27 additions and 14 deletions

View file

@ -1,7 +1,7 @@
#include "ELFLoader.h"
#include <AK/Demangle.h>
#include <AK/QuickSort.h>
#include <AK/kstdio.h>
#include <cxxabi.h>
#ifdef KERNEL
#include <Kernel/VM/MemoryManager.h>
@ -139,12 +139,7 @@ String ELFLoader::symbolicate(u32 address) const
if (i == 0)
return "!!";
auto& symbol = sorted_symbols[i - 1];
int status = 0;
auto* demangled_name = abi::__cxa_demangle(symbol.name, nullptr, nullptr, &status);
auto string = String::format("%s +%u", status == 0 ? demangled_name : symbol.name, address - symbol.address);
if (status == 0)
kfree(demangled_name);
return string;
return String::format("%s +%u", demangle(symbol.name).characters(), address - symbol.address);
}
}
return "??";