diff options
author | Till Straumann <strauman@slac.stanford.edu> | 2009-10-20 14:51:37 +0000 |
---|---|---|
committer | Till Straumann <strauman@slac.stanford.edu> | 2009-10-20 14:51:37 +0000 |
commit | 020363de10aa687f7d14e61b6873c49f7187d009 (patch) | |
tree | d1f35e3b4dbf43c5c1bda6d02dbe87e1900e88b2 | |
parent | 2009-10-20 Till Straumann <strauman@slac.stanford.edu> (diff) | |
download | rtems-020363de10aa687f7d14e61b6873c49f7187d009.tar.bz2 |
2009-10-20 Till Straumann <strauman@slac.stanford.edu>
* score/cpu/i386/cpu.c, score/cpu/i386/cpu.h: let the default
exception handler print a stack trace.
-rw-r--r-- | cpukit/ChangeLog | 5 | ||||
-rw-r--r-- | cpukit/score/cpu/i386/cpu.c | 21 | ||||
-rw-r--r-- | cpukit/score/cpu/i386/rtems/score/cpu.h | 4 |
3 files changed, 26 insertions, 4 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 77997f126a..5310c0606d 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,5 +1,10 @@ 2009-10-20 Till Straumann <strauman@slac.stanford.edu> + * score/cpu/i386/cpu.c, score/cpu/i386/cpu.h: let the default + exception handler print a stack trace. + +2009-10-20 Till Straumann <strauman@slac.stanford.edu> + PR1424/networking * libnetworking/net/rtsock.c: (merged from BSD) copy information out to user buffer. 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); } } diff --git a/cpukit/score/cpu/i386/rtems/score/cpu.h b/cpukit/score/cpu/i386/rtems/score/cpu.h index e4ef9efbc3..d91a9474f1 100644 --- a/cpukit/score/cpu/i386/rtems/score/cpu.h +++ b/cpukit/score/cpu/i386/rtems/score/cpu.h @@ -300,10 +300,10 @@ uint32_t _CPU_ISR_Get_level( void ); if ( (_isr) ) (_the_context)->eflags = CPU_EFLAGS_INTERRUPTS_OFF; \ else (_the_context)->eflags = CPU_EFLAGS_INTERRUPTS_ON; \ \ - _stack = ((uint32_t)(_stack_base)) + (_size) - 4; \ + _stack = ((uint32_t)(_stack_base)) + (_size) - sizeof(proc_ptr*); \ \ *((proc_ptr *)(_stack)) = (_entry_point); \ - (_the_context)->ebp = (void *) _stack; \ + (_the_context)->ebp = (void *) 0; \ (_the_context)->esp = (void *) _stack; \ } while (0) |