]> granicus.if.org Git - strace/commitdiff
unwind: call unwind_tcb_fin before printing detached message
authorMasatake YAMATO <yamato@redhat.com>
Wed, 16 Apr 2014 06:33:08 +0000 (15:33 +0900)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 30 May 2014 22:56:38 +0000 (22:56 +0000)
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>
strace.c

index f8d5cb7f352a84ddfe9bf581d230d0cf96b6dc07..fe197e5d3ea0705282a369ffe27a21141da46728 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -724,6 +724,12 @@ droptcb(struct tcb *tcp)
        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);
@@ -745,11 +751,6 @@ droptcb(struct tcb *tcp)
        if (printing_tcp == tcp)
                printing_tcp = NULL;
 
-#ifdef USE_LIBUNWIND
-       if (stack_trace_enabled) {
-               unwind_tcb_fin(tcp);
-       }
-#endif
        memset(tcp, 0, sizeof(*tcp));
 }