Browse Source

core: panic: last instruction's address for assert

dev/timer
Oleg Hahm 8 years ago
parent
commit
f3245cecac
  1. 5
      core/panic.c
  2. 2
      cpu/atmega_common/include/cpu.h
  3. 2
      cpu/cortexm_common/include/cpu.h
  4. 2
      cpu/lpc2387/include/cpu.h
  5. 2
      cpu/msp430-common/include/cpu.h
  6. 2
      cpu/native/include/cpu.h
  7. 6
      cpu/x86/include/cpu.h

5
core/panic.c

@ -50,6 +50,11 @@ NORETURN void core_panic(core_panic_t crash_code, const char *message)
crashed = 1;
puts("*** RIOT kernel panic");
puts(message);
#ifndef NDEBUG
if (crash_code == PANIC_ASSERT_FAIL) {
cpu_print_last_instruction();
}
#endif
#if DEVELHELP
#ifdef MODULE_PS
ps();

2
cpu/atmega_common/include/cpu.h

@ -55,7 +55,7 @@ void cpu_init(void);
*/
static inline void cpu_print_last_instruction(void)
{
printf("n/a");
puts("n/a");
}
#ifdef __cplusplus

2
cpu/cortexm_common/include/cpu.h

@ -109,7 +109,7 @@ static inline void cpu_print_last_instruction(void)
{
register uint32_t *lr_ptr;
__asm__ __volatile__("mov %0, lr" : "=r"(lr_ptr));
printf("%p", lr_ptr);
printf("%p\n", lr_ptr);
}
#ifdef __cplusplus

2
cpu/lpc2387/include/cpu.h

@ -50,7 +50,7 @@ static inline void cpu_print_last_instruction(void)
{
register uint32_t *lr_ptr;
__asm__ __volatile__("mov %0, lr" : "=r"(lr_ptr));
printf("%p", lr_ptr);
printf("%p\n", lr_ptr);
}
#ifdef __cplusplus

2
cpu/msp430-common/include/cpu.h

@ -174,7 +174,7 @@ void msp430_cpu_init(void);
*/
static inline void cpu_print_last_instruction(void)
{
printf("n/a");
puts("n/a");
}
#ifdef __cplusplus

2
cpu/native/include/cpu.h

@ -37,7 +37,7 @@ static inline void cpu_print_last_instruction(void)
{
void *p;
__asm__("1: mov 1b, %0" : "=r" (p));
printf("%p", p);
printf("%p\n", p);
}
#ifdef __cplusplus

6
cpu/x86/include/cpu.h

@ -135,12 +135,12 @@ bool x86_get_memory_region(uint64_t *start, uint64_t *len, unsigned long *cnt);
/**
* @brief Prints the last instruction's address
*
* @todo: Not supported
*/
static inline void cpu_print_last_instruction(void)
{
printf("n/a");
void *p;
__asm__("1: mov 1b, %0" : "=r" (p));
printf("%p\n", p);
}
#ifdef __cplusplus

Loading…
Cancel
Save