From 1c3b15f73411b54f9531d756c9d88824bf301165 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Mon, 28 Oct 2019 00:52:27 +0900 Subject: [PATCH] Print the address and pid of the executing context when an exception occurs --- kernel/arch/interrupt.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/arch/interrupt.c b/kernel/arch/interrupt.c index d751b0c..7cee95f 100644 --- a/kernel/arch/interrupt.c +++ b/kernel/arch/interrupt.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "cpu.h" #include "defs.h" @@ -124,7 +125,12 @@ void _int_handle(stack_frame_t ctx) void _exc_handle(stack_frame_t ctx) { + process_t *cproc; + + cproc = process_get_current(); + dbg_printf("Exception %u [%s] occurred. Error code 0x%08x.\n", ctx.intn, ctx.intn < EXC_MAX ? _exc_name[ctx.intn] : 0, ctx.error); + dbg_printf("In context %p [pid %u]\n", cproc, process_get_id(cproc)); dbg_printf("Fault in 0x%02x:%08x; EFLAGS = 0x%08x\n", ctx.cs, ctx.eip, ctx.eflags); if(ctx.intn == EXC_PAGEFAULT) { -- 2.47.3