diff --git a/include/misc/__assert.h b/include/misc/__assert.h index b0c073d9e74..2c543cbbd2c 100644 --- a/include/misc/__assert.h +++ b/include/misc/__assert.h @@ -81,7 +81,7 @@ #if __ASSERT_ON #include -void assert_post_action(void); +void assert_post_action(const char *file, unsigned int line); #define __ASSERT_LOC(test) \ printk("ASSERTION FAIL [%s] @ %s:%d\n", \ @@ -93,7 +93,7 @@ void assert_post_action(void); do { \ if (!(test)) { \ __ASSERT_LOC(test); \ - assert_post_action(); \ + assert_post_action(__FILE__, __LINE__); \ } \ } while (false) @@ -102,7 +102,7 @@ void assert_post_action(void); if (!(test)) { \ __ASSERT_LOC(test); \ printk("\t" fmt "\n", ##__VA_ARGS__); \ - assert_post_action(); \ + assert_post_action(__FILE__, __LINE__); \ } \ } while (false) diff --git a/lib/os/assert.c b/lib/os/assert.c index b7dcfc56850..a9956f599a4 100644 --- a/lib/os/assert.c +++ b/lib/os/assert.c @@ -7,7 +7,25 @@ #include #include -void assert_post_action(void) + +/** + * + * @brief Assert Action Handler + * + * This routine implements the action to be taken when an assertion fails. + * + * System designers may wish to substitute this implementation to take other + * actions, such as logging program counter, line number, debug information + * to a persistent repository and/or rebooting the system. + * + * @param N/A + * + * @return N/A + */ +__weak void assert_post_action(const char *file, unsigned int line) { - k_panic(); + ARG_UNUSED(file); + ARG_UNUSED(line); + + k_panic(); }