captured stacktrace is printed in unwind_tcb_fin if tcp->queue is not
empty. This should happen before printing detached message, so
unwind_tcb_fin is moved to the top of droptcb.
This is implicitly suggested by Dmitry Levin in patch review process.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
if (tcp->pid == 0)
return;
+#ifdef USE_LIBUNWIND
+ if (stack_trace_enabled) {
+ unwind_tcb_fin(tcp);
+ }
+#endif
+
nprocs--;
if (debug_flag)
fprintf(stderr, "dropped tcb for pid %d, %d remain\n", tcp->pid, nprocs);
if (printing_tcp == tcp)
printing_tcp = NULL;
-#ifdef USE_LIBUNWIND
- if (stack_trace_enabled) {
- unwind_tcb_fin(tcp);
- }
-#endif
memset(tcp, 0, sizeof(*tcp));
}