mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:48:14 +00:00
Kernel: Demangle userspace ELF symbols in backtraces
Turns out we can use abi::__cxa_demangle() for this, and all we need to provide is sprintf(), realloc() and free(), so this patch exposes them. We now have fully demangled C++ backtraces :^)
This commit is contained in:
parent
2d1bcce34a
commit
0adbacf59e
10 changed files with 44 additions and 9 deletions
|
@ -184,6 +184,25 @@ void kfree(void* ptr)
|
|||
#endif
|
||||
}
|
||||
|
||||
void* krealloc(void* ptr, size_t new_size)
|
||||
{
|
||||
if (!ptr)
|
||||
return kmalloc(new_size);
|
||||
|
||||
InterruptDisabler disabler;
|
||||
|
||||
auto* a = (allocation_t*)((((u8*)ptr) - sizeof(allocation_t)));
|
||||
size_t old_size = a->nchunk * CHUNK_SIZE;
|
||||
|
||||
if (old_size == new_size)
|
||||
return ptr;
|
||||
|
||||
auto* new_ptr = kmalloc(new_size);
|
||||
memcpy(new_ptr, ptr, min(old_size, new_size));
|
||||
kfree(ptr);
|
||||
return new_ptr;
|
||||
}
|
||||
|
||||
void* operator new(size_t size)
|
||||
{
|
||||
return kmalloc(size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue