From 020363de10aa687f7d14e61b6873c49f7187d009 Mon Sep 17 00:00:00 2001 From: Till Straumann Date: Tue, 20 Oct 2009 14:51:37 +0000 Subject: 2009-10-20 Till Straumann * score/cpu/i386/cpu.c, score/cpu/i386/cpu.h: let the default exception handler print a stack trace. --- cpukit/score/cpu/i386/cpu.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'cpukit/score/cpu/i386/cpu.c') diff --git a/cpukit/score/cpu/i386/cpu.c b/cpukit/score/cpu/i386/cpu.c index 46c12c5ae5..a3622d3156 100644 --- a/cpukit/score/cpu/i386/cpu.c +++ b/cpukit/score/cpu/i386/cpu.c @@ -85,6 +85,11 @@ void *_CPU_Thread_Idle_body( uintptr_t ignored ) return NULL; } +struct Frame_ { + struct Frame_ *up; + uintptr_t pc; +}; + void _defaultExcHandler (CPU_Exception_frame *ctx) { unsigned int faultAddr = 0; @@ -119,12 +124,24 @@ void _defaultExcHandler (CPU_Exception_frame *ctx) _CPU_Fatal_halt(faultAddr); } else { + struct Frame_ *fp = (struct Frame_*)ctx->ebp; + int i; + + printk("Call Stack Trace of EIP:\n"); + if ( fp ) { + for ( i=1; fp->up; fp=fp->up, i++ ) { + printk("0x%08x ",fp->pc); + if ( ! (i&3) ) + printk("\n"); + } + } + printk("\n"); /* * OK I could probably use a simplified version but at least this * should work. */ - printk(" ************ FAULTY THREAD WILL BE DELETED **************\n"); - rtems_task_delete(_Thread_Executing->Object.id); + printk(" ************ FAULTY THREAD WILL BE SUSPENDED **************\n"); + rtems_task_suspend(_Thread_Executing->Object.id); } } -- cgit v1.2.3