mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-05 16:14:38 +00:00
Kernel: Add (expensive) but valuable userspace symbols to stacks.
This is expensive because we have to page in the entire executable for every process up front for this to work. This is due to the page fault code not being strong enough to run while another process is active. Note that we already had userspace symbols in *crash* stacks. This patch adds them generally, so they show up in /proc, Process Manager, etc. There's room for improvement here, but the debugging benefits way overshadow the performance penalty right now. :^)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#include <AK/ELF/ELFLoader.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/Process.h>
|
||||
@@ -570,7 +571,12 @@ String Thread::backtrace(ProcessInspectionHandle&) const
|
||||
if (!symbol.address)
|
||||
break;
|
||||
if (!symbol.ksym) {
|
||||
builder.appendf("%p\n", symbol.address);
|
||||
#ifdef EXPENSIVE_USERSPACE_STACKS
|
||||
if (!Scheduler::is_active() && process.elf_loader() && process.elf_loader()->has_symbols())
|
||||
builder.appendf("%p %s\n", symbol.address, process.elf_loader()->symbolicate(symbol.address).characters());
|
||||
else
|
||||
#endif
|
||||
builder.appendf("%p\n", symbol.address);
|
||||
continue;
|
||||
}
|
||||
unsigned offset = symbol.address - symbol.ksym->address;
|
||||
|
||||
Reference in New Issue
Block a user