CV-Bowen opened a new pull request, #22141:
URL: https://github.com/apache/nuttx/pull/22141

   ## Summary
   
   The crash dump in `sched/misc/assert.c` is printed with `_alert()`, i.e.
   at `LOG_ALERT`. Once an application lowers the log mask, for example
   with `setlogmask(LOG_UPTO(LOG_EMERG))` to keep the console quiet, the
   whole assertion output disappears and the crash cannot be debugged.
   
   - Add `_emerg()` to `include/nuttx/debug.h`, an unconditional
     `LOG_EMERG` counterpart of `_alert()` (macro, plus an out-of-line
     version in `libs/libc/misc/lib_debug.c` for compilers without variadic
     macros), and print the crash dump in `sched/misc/assert.c` with it.
     `LOG_EMERG` always passes the log mask.
   - The out-of-line `_alert()` logged at `LOG_EMERG` instead of
     `LOG_ALERT`; it now logs at `LOG_ALERT` like the macro.
   
   ## Impact
   
   - New `_emerg()` debug macro/function. Unlike `_alert()` it does not
     depend on `CONFIG_DEBUG_ALERT`.
   - Assertion and panic output is printed at `LOG_EMERG` instead of
     `LOG_ALERT`; with the default log mask nothing changes.
   - Compilers without variadic macros: `_alert()` output now has priority
     `LOG_ALERT` (was `LOG_EMERG`).
   
   ## Testing
   
   Host: Ubuntu 22.04.5 LTS x86_64, sim: cc (Ubuntu 13.1.0-8ubuntu1~22.04) 
13.1.0
   
   sim:nsh with `CONFIG_SYSTEM_SETLOGMASK=y`, `CONFIG_DEBUG_ASSERTIONS=y` and
   a test-only app that calls `DEBUGASSERT(argc < 0)`. In nsh:
   `setlogmask r` (mask `LOG_UPTO(LOG_EMERG)`), then run the app.
   
   | | master | this PR |
   |---|---|---|
   | default mask | `Assertion failed ...` and the dump printed | same |
   | after `setlogmask r` (3 runs each) | nothing printed, nsh just exits | 
`Assertion failed ...` and the dump printed |
   
   <details><summary>this PR, after setlogmask r</summary>
   
   ```
   nsh> setlogmask r
   nsh> p129crash
   dump_assert_info: Current Version: NuttX  13.1.1 ef9e2674919 Nov 21 2026 
19:40:04 sim
   dump_assert_info: Assertion failed argc < 0: at file: 
/examples/p129crash/p129crash_main.c:6 task: p129crash process: p129crash 
0x400b29d1
   ```
   </details>
   
   <details><summary>master, after setlogmask r</summary>
   
   ```
   nsh> setlogmask r
   nsh> p129crash
   (no output)
   ```
   </details>
   
   No regression: sim:rpserver/rpproxy and qemu-armv8a:rpserver/rpproxy boot 
and pass the fixed rpmsg cases (15/15), and every assert.c path still builds 
(sim:nsh, 0 warnings).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

  • [PR] sched/assert: use LOG_EM... CV-Bowen (via GitHub) via commits

Reply via email to