From: Keith Owens Date: Mon, 18 Jan 2016 02:12:26 +0000 (+1100) Subject: strace-graph: cope with clone immediately followed by exit X-Git-Tag: v4.12~592 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e0ba4bdcc874d06ffdacc15d782078096c056b1;p=strace strace-graph: cope with clone immediately followed by exit * 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. --- diff --git a/strace-graph b/strace-graph index ae355aa8..680eb5f1 100755 --- a/strace-graph +++ b/strace-graph @@ -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; }