feat(core): improve task post-mortem debug messages
What changed, and why it matters
This commit only changes debug log messages shown when a task ends. It makes the messages clearer and skips printing details when a task ended normally with no error. There is no change to how the device operates or to any security behavior.
No security action needed; this is a cosmetic debug-output improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies systask_print_pminfo() in core/embed/sys/task/unix/systask.c, which is wrapped in USE_DBG_CONSOLE. It adds an early return for clean exits (reason == TASK_TERM_REASON_EXIT && exit.code == 0) and reformats the printed post-mortem output. No task lifecycle, error handling, memory access, or control flow outside debug printing is altered.
Changed components
core/embed/sys/task/unix/systask.cInspect captured patch +15 / −10
diff --git a/core/embed/sys/task/unix/systask.c b/core/embed/sys/task/unix/systask.c
index 6fe67777..481b3bdb 100644
--- a/core/embed/sys/task/unix/systask.c
+++ b/core/embed/sys/task/unix/systask.c
@@ -332,36 +332,41 @@ void systask_exit_fatal(systask_t* task, const char* message,
void systask_print_pminfo(systask_t* task) {
#ifdef USE_DBG_CONSOLE
- dbg_printf("Task #%u terminated.\n", task->id);
- dbg_printf(" Post-mortem info:\n");
const systask_postmortem_t* pminfo = &task->pminfo;
+ if (pminfo->reason == TASK_TERM_REASON_EXIT && pminfo->exit.code == 0) {
+ dbg_printf("Task #%u terminated cleanly\n", task->id);
+ return;
+ }
+
+ dbg_printf("Task #%u terminated.\n", task->id);
+
switch (pminfo->reason) {
case TASK_TERM_REASON_EXIT:
- dbg_printf(" EXIT: %d\n", pminfo->exit.code);
+ dbg_printf("Exit code: %d\n", pminfo->exit.code);
break;
case TASK_TERM_REASON_ERROR:
- dbg_printf(" ERROR: %s\n", pminfo->error.message);
+ dbg_printf("Error: %s\n", pminfo->error.message);
if (pminfo->error.title[0] != '\0') {
- dbg_printf(" Title: %s\n", pminfo->error.title);
+ dbg_printf("Title: %s\n", pminfo->error.title);
}
if (pminfo->error.footer[0] != '\0') {
- dbg_printf(" Footer: %s\n", pminfo->error.footer);
+ dbg_printf("Footer: %s\n", pminfo->error.footer);
}
break;
case TASK_TERM_REASON_FATAL:
- dbg_printf(" FATAL: %s\n", pminfo->fatal.expr);
+ dbg_printf("Fatal: %s", pminfo->fatal.expr);
if (pminfo->fatal.file[0] != '\0') {
- dbg_printf(" at %s:%u\n", pminfo->fatal.file,
- (unsigned int)pminfo->fatal.line);
+ dbg_printf(" at %s:%u", pminfo->fatal.file, pminfo->fatal.line);
}
+ dbg_printf("\n");
break;
case TASK_TERM_REASON_FAULT:
- dbg_printf(" FAULT\n");
+ dbg_printf("Fault\n");
break;
}
#endif // USE_DBG_CONSOLE
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.