1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 14:05:08 +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:
Andreas Kling 2019-11-27 14:06:24 +01:00
parent 2d1bcce34a
commit 0adbacf59e
10 changed files with 44 additions and 9 deletions

View file

@ -502,7 +502,7 @@ Optional<KBuffer> procfs$pid_cwd(InodeIdentifier identifier)
Optional<KBuffer> procfs$self(InodeIdentifier)
{
char buffer[16];
ksprintf(buffer, "%u", current->pid());
sprintf(buffer, "%u", current->pid());
return KBuffer::copy((const u8*)buffer, strlen(buffer));
}
@ -1055,7 +1055,7 @@ bool ProcFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&)
}
for (auto pid_child : Process::all_pids()) {
char name[16];
int name_length = ksprintf(name, "%u", pid_child);
int name_length = sprintf(name, "%u", pid_child);
callback({ name, name_length, to_identifier(fsid(), PDI_Root, pid_child, FI_PID), 0 });
}
break;
@ -1100,7 +1100,7 @@ bool ProcFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&)
if (!description)
continue;
char name[16];
int name_length = ksprintf(name, "%u", i);
int name_length = sprintf(name, "%u", i);
callback({ name, name_length, to_identifier_with_fd(fsid(), pid, i), 0 });
}
} break;