]> granicus.if.org Git - strace/commitdiff
strace-graph: cope with clone immediately followed by exit
authorKeith Owens <kaos.ocs@gmail.com>
Mon, 18 Jan 2016 02:12:26 +0000 (13:12 +1100)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 5 Feb 2016 00:41:23 +0000 (00:41 +0000)
* strace-graph: A clone() followed by exit() with no intervening fork
or execve resulted in the new pid having no seq key.  That breaks when
trying to use seq as an array reference.  Ensure that clone populates
the new pid with an empty seq entry.

strace-graph

index ae355aa8516a8b6e4fbae09d0ce3308ebea03492..680eb5f1ee54854ba7bad063040ce391df0da1f5 100755 (executable)
@@ -212,7 +212,7 @@ my $depth = "";
 # process info, indexed by pid.
 # fields:
 #    parent         pid number
-#    seq            forks and execs for this pid, in sequence  (array)
+#    seq            clones, forks and execs for this pid, in sequence  (array)
 
 #  filename and argv (from latest exec)
 #  basename (derived from filename)
@@ -250,6 +250,7 @@ sub handle_trace {
        push @$seq, ['FORK', $result];
        $pr{$pid}{seq} = $seq;
        $pr{$result}{parent} = $pid;
+       $pr{$result}{seq} = [];
     } elsif ($call eq '_exit' || $call eq 'exit_group') {
        $pr{$pid}{end} = $time if defined $time;
     }