This is an automated email from the ASF dual-hosted git repository. GUIDINGLI pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 21522748e58775e3be2ec8dda19df7f35bb9fab5 Author: Yongrong Wang <[email protected]> AuthorDate: Tue Mar 17 14:33:03 2026 +0800 assert/rptun: add PANIC_WITH_MSG() and name the remote core in its panic A core that panics because its peer did logged "FATAL: Panic by remote core: <cpu>" with syslog and then called PANIC(), so the assertion report itself only said "panic" and could not be told apart from a local panic. Add PANIC_WITH_MSG(msg), PANIC() with a caller supplied message, and use it in rptun_check_peer_status() with "Panic by remote core: <cpu>". Signed-off-by: Yongrong Wang <[email protected]> Signed-off-by: Bowen Wang <[email protected]> --- drivers/rptun/rptun.c | 8 +++++--- include/assert.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/rptun/rptun.c b/drivers/rptun/rptun.c index 939f9a62ed0..72a1d90a664 100644 --- a/drivers/rptun/rptun.c +++ b/drivers/rptun/rptun.c @@ -940,9 +940,11 @@ static void rptun_check_peer_status(FAR struct rptun_priv_s *priv) if (RPTUN_STATUS_CHECK(status, BOARDIOC_SOFTRESETCAUSE_PANIC)) { - syslog(LOG_EMERG, "FATAL: Panic by remote core: %s\n", - RPTUN_GET_CPUNAME(priv->dev)); - PANIC(); + char msg[64]; + + snprintf(msg, sizeof(msg), "Panic by remote core: %s", + RPTUN_GET_CPUNAME(priv->dev)); + PANIC_WITH_MSG(msg); } else if(status != 0u) { diff --git a/include/assert.h b/include/assert.h index cbe7f68577d..d5c3b422a5e 100644 --- a/include/assert.h +++ b/include/assert.h @@ -47,6 +47,7 @@ #ifndef NUTTX_NO_EXTENSIONS #undef PANIC /* Unconditional abort */ +#undef PANIC_WITH_MSG /* Unconditional abort with a message */ #undef ASSERT /* Assert if the condition is not true */ #undef VERIFY /* Assert if a function returns a negative value */ #undef DEBUGPANIC /* Like PANIC, but only if CONFIG_DEBUG_ASSERTIONS is defined */ @@ -86,6 +87,7 @@ #ifndef NUTTX_NO_EXTENSIONS #define PANIC() __assert(__ASSERT_FILE__, __ASSERT_LINE__, "panic") +#define PANIC_WITH_MSG(msg) __assert(__ASSERT_FILE__, __ASSERT_LINE__, msg) #define PANIC_WITH_REGS(msg, regs) _assert(__ASSERT_FILE__, \ __ASSERT_LINE__, msg, regs) #endif
