core: panic: last instruction's address for assert
This commit is contained in:
parent
d7161b6d4b
commit
f3245cecac
@ -50,6 +50,11 @@ NORETURN void core_panic(core_panic_t crash_code, const char *message)
|
|||||||
crashed = 1;
|
crashed = 1;
|
||||||
puts("*** RIOT kernel panic");
|
puts("*** RIOT kernel panic");
|
||||||
puts(message);
|
puts(message);
|
||||||
|
#ifndef NDEBUG
|
||||||
|
if (crash_code == PANIC_ASSERT_FAIL) {
|
||||||
|
cpu_print_last_instruction();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#if DEVELHELP
|
#if DEVELHELP
|
||||||
#ifdef MODULE_PS
|
#ifdef MODULE_PS
|
||||||
ps();
|
ps();
|
||||||
|
|||||||
@ -55,7 +55,7 @@ void cpu_init(void);
|
|||||||
*/
|
*/
|
||||||
static inline void cpu_print_last_instruction(void)
|
static inline void cpu_print_last_instruction(void)
|
||||||
{
|
{
|
||||||
printf("n/a");
|
puts("n/a");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@ -109,7 +109,7 @@ static inline void cpu_print_last_instruction(void)
|
|||||||
{
|
{
|
||||||
register uint32_t *lr_ptr;
|
register uint32_t *lr_ptr;
|
||||||
__asm__ __volatile__("mov %0, lr" : "=r"(lr_ptr));
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr_ptr));
|
||||||
printf("%p", lr_ptr);
|
printf("%p\n", lr_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@ -50,7 +50,7 @@ static inline void cpu_print_last_instruction(void)
|
|||||||
{
|
{
|
||||||
register uint32_t *lr_ptr;
|
register uint32_t *lr_ptr;
|
||||||
__asm__ __volatile__("mov %0, lr" : "=r"(lr_ptr));
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr_ptr));
|
||||||
printf("%p", lr_ptr);
|
printf("%p\n", lr_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@ -174,7 +174,7 @@ void msp430_cpu_init(void);
|
|||||||
*/
|
*/
|
||||||
static inline void cpu_print_last_instruction(void)
|
static inline void cpu_print_last_instruction(void)
|
||||||
{
|
{
|
||||||
printf("n/a");
|
puts("n/a");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@ -37,7 +37,7 @@ static inline void cpu_print_last_instruction(void)
|
|||||||
{
|
{
|
||||||
void *p;
|
void *p;
|
||||||
__asm__("1: mov 1b, %0" : "=r" (p));
|
__asm__("1: mov 1b, %0" : "=r" (p));
|
||||||
printf("%p", p);
|
printf("%p\n", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@ -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
|
* @brief Prints the last instruction's address
|
||||||
*
|
|
||||||
* @todo: Not supported
|
|
||||||
*/
|
*/
|
||||||
static inline void cpu_print_last_instruction(void)
|
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
|
#ifdef __cplusplus
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user