summaryrefslogtreecommitdiff
path: root/Kernel/Thread.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-07-27 12:01:14 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-07-27 12:02:56 +0200
commita79d8d8ae54a1a1dc971df8c24754f2a52feb142 (patch)
tree7a2ffe6ce6727751c6f0582cfff7c0073de784eb /Kernel/Thread.cpp
parent7cd2e739f23856223abf91304e0a35294161d67f (diff)
downloadserenity-a79d8d8ae54a1a1dc971df8c24754f2a52feb142.zip
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. :^)
Diffstat (limited to 'Kernel/Thread.cpp')
-rw-r--r--Kernel/Thread.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp
index 71194807c1..e2370135e0 100644
--- a/Kernel/Thread.cpp
+++ b/Kernel/Thread.cpp
@@ -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;