kernel: panic: Option ASSERT_NO_FILE_INFO controls panic or oops print

Use option ASSERT_NO_FILE_INFO to control panic or oops location print.
The cause of the exception can be backtraced using the stackframe
instead, which would give the user a way to reduce the footprint of the
panic implementation.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2019-12-20 15:42:38 +01:00 committed by Alberto Escolar
commit e04e4c27e8

View file

@ -4930,6 +4930,12 @@ extern void z_sys_power_save_idle_exit(s32_t ticks);
#define z_except_reason(reason) ARCH_EXCEPT(reason) #define z_except_reason(reason) ARCH_EXCEPT(reason)
#else #else
#if !defined(CONFIG_ASSERT_NO_FILE_INFO)
#define __EXCEPT_LOC() __ASSERT_PRINT("@ %s:%d\n", __FILE__, __LINE__)
#else
#define __EXCEPT_LOC()
#endif
/* NOTE: This is the implementation for arches that do not implement /* NOTE: This is the implementation for arches that do not implement
* ARCH_EXCEPT() to generate a real CPU exception. * ARCH_EXCEPT() to generate a real CPU exception.
* *
@ -4938,7 +4944,7 @@ extern void z_sys_power_save_idle_exit(s32_t ticks);
* the fatal error handler. * the fatal error handler.
*/ */
#define z_except_reason(reason) do { \ #define z_except_reason(reason) do { \
printk("@ %s:%d:\n", __FILE__, __LINE__); \ __EXCEPT_LOC(); \
z_fatal_error(reason, NULL); \ z_fatal_error(reason, NULL); \
} while (false) } while (false)