mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 06:28:13 +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:
parent
422e5166f2
commit
f75a6b9daa
4 changed files with 27 additions and 14 deletions
21
AK/Demangle.h
Normal file
21
AK/Demangle.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <cxxabi.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
inline String demangle(const char* name)
|
||||
{
|
||||
int status = 0;
|
||||
auto* demangled_name = abi::__cxa_demangle(name, nullptr, nullptr, &status);
|
||||
auto string = String(status == 0 ? demangled_name : name);
|
||||
if (status == 0)
|
||||
kfree(demangled_name);
|
||||
return string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
using AK::demangle;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue