1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:18:11 +00:00

Kernel: Symbolicate userspace backtraces using ELFLoader.

Stash away the ELFLoader used to load an executable in Process so we can use
it for symbolicating userspace addresses later on. This will make debugging
userspace programs a lot nicer. :^)
This commit is contained in:
Andreas Kling 2019-05-16 17:18:25 +02:00
parent e20aecefba
commit 174639b7f0
6 changed files with 56 additions and 11 deletions

View file

@ -2,6 +2,7 @@
#include "Process.h"
#include "Scheduler.h"
#include <Kernel/FileSystem/FileDescriptor.h>
#include <Kernel/ELF/ELFLoader.h>
static KSym* s_ksyms;
dword ksym_lowest_address;
@ -114,7 +115,11 @@ static void load_ksyms_from_data(const ByteBuffer& buffer)
if (!symbol.address)
break;
if (!symbol.ksym) {
dbgprintf("%p\n", symbol.address);
if (current->process().elf_loader()) {
dbgprintf("%p %s\n", symbol.address, current->process().elf_loader()->symbolicate(symbol.address).characters());
} else {
dbgprintf("%p (no ELF loader for process)\n", symbol.address);
}
continue;
}
unsigned offset = symbol.address - symbol.ksym->address;