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.
This commit is contained in:
Till Straumann
2009-10-20 14:51:37 +00:00
parent f8397280ae
commit 020363de10
3 changed files with 26 additions and 4 deletions

View File

@@ -1,3 +1,8 @@
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

View File

@@ -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);
}
}

View File

@@ -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)