summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-06-19 18:50:02 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-19 18:51:17 +0200
commit15bea7153a55f149c3c3c97ff78ab0f5740bfbd2 (patch)
tree80d07f5cf596608d2c4fc64c4c36b037af233567 /Kernel
parentc5d623e04847d06ae4ee5c9bcc441ab80e4f6b8f (diff)
downloadserenity-15bea7153a55f149c3c3c97ff78ab0f5740bfbd2.zip
Kernel: Symbolicate the crash address too, not just the call stack.
Also print it in shiny red to make it extra easy to spot. :^) Fixes #244.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Arch/i386/CPU.cpp12
-rw-r--r--Kernel/Process.cpp4
-rw-r--r--Kernel/Process.h2
3 files changed, 11 insertions, 7 deletions
diff --git a/Kernel/Arch/i386/CPU.cpp b/Kernel/Arch/i386/CPU.cpp
index a1a7ec5177..d1f5beb717 100644
--- a/Kernel/Arch/i386/CPU.cpp
+++ b/Kernel/Arch/i386/CPU.cpp
@@ -171,14 +171,14 @@ void exception_6_handler(RegisterDump& regs)
current->pid());
dump(regs);
- dump_backtrace();
if (current->process().is_ring0()) {
kprintf("Oh shit, we've crashed in ring 0 :(\n");
+ dump_backtrace();
hang();
}
- current->process().crash(SIGILL);
+ current->process().crash(SIGILL, regs.eip);
}
// 7: FPU not available exception
@@ -224,10 +224,11 @@ void exception_0_handler(RegisterDump& regs)
if (current->process().is_ring0()) {
kprintf("Oh shit, we've crashed in ring 0 :(\n");
+ dump_backtrace();
hang();
}
- current->process().crash(SIGFPE);
+ current->process().crash(SIGFPE, regs.eip);
}
// 13: General Protection Fault
@@ -240,10 +241,11 @@ void exception_13_handler(RegisterDumpWithExceptionCode& regs)
if (current->process().is_ring0()) {
kprintf("Oh shit, we've crashed in ring 0 :(\n");
+ dump_backtrace();
hang();
}
- current->process().crash();
+ current->process().crash(SIGSEGV, regs.eip);
}
// 14: Page Fault
@@ -285,7 +287,7 @@ void exception_14_handler(RegisterDumpWithExceptionCode& regs)
regs.exception_code & 2 ? "write" : "read",
faultAddress);
dump(regs);
- current->process().crash();
+ current->process().crash(SIGSEGV, regs.eip);
} else if (response == PageFaultResponse::Continue) {
#ifdef PAGE_FAULT_DEBUG
dbgprintf("Continuing after resolved page fault\n");
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index f388e42251..7af8e97426 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -740,11 +740,13 @@ void Process::sys$sigreturn()
ASSERT_NOT_REACHED();
}
-void Process::crash(int signal)
+void Process::crash(int signal, dword eip)
{
ASSERT_INTERRUPTS_DISABLED();
ASSERT(!is_dead());
+ if (m_elf_loader && ksyms_ready)
+ dbgprintf("\033[31;1m%p %s\033[0m\n", eip, m_elf_loader->symbolicate(eip).characters());
dump_backtrace();
m_termination_signal = signal;
diff --git a/Kernel/Process.h b/Kernel/Process.h
index 90b685d582..46f5b895a1 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -204,7 +204,7 @@ public:
static void initialize();
- [[noreturn]] void crash(int signal = SIGSEGV);
+ [[noreturn]] void crash(int signal, dword eip);
[[nodiscard]] static int reap(Process&);
const TTY* tty() const { return m_tty; }