]> granicus.if.org Git - strace/blobdiff - strace-graph
Use XLAT_END macro
[strace] / strace-graph
index a157a54ca304447841c4d0177b739b4f524750f1..d57e76863e585b3a0fdf61ad6b7e8032e99476a4 100755 (executable)
 # It will add elapsed time for each process in that case.
 
 # This script is Copyright (C) 1998 by Richard Braakman <dark@xs4all.nl>.
-# It is distributed under the GNU General Public License version 2 or,
-# at your option, any later version published by the Free Software Foundation.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 my %unfinished;
 
@@ -93,7 +113,7 @@ sub parse_str {
            return (undef, $in);
        }
     }
-}    
+}
 
 sub parse_one {
     my ($in) = @_;
@@ -166,19 +186,19 @@ sub parseargs {
        unless (length($in) == 0 or $in =~ s/^, //) {
            print STDERR "$0: $ARGV: $.: missing comma.\n";
            return undef;
-       }           
+       }
     }
     return @args;
 }
-           
+
 
 my $depth = "";
 
 # process info, indexed by pid.
-# fields: 
+# fields:
 #    parent         pid number
 #    seq            forks and execs for this pid, in sequence  (array)
+
 #  filename and argv (from latest exec)
 #  basename (derived from filename)
 # argv[0] is modified to add the basename if it differs from the 0th argument.
@@ -207,7 +227,7 @@ sub handle_trace {
        push @$seq, ['EXEC', $filename, $argv];
 
        $pr{$pid}{seq} = $seq;
-    } elsif ($call eq 'fork') {
+    } elsif ($call eq 'fork' || $call eq 'clone' || $call eq 'vfork') {
        return if $result == 0;
 
        my $seq = $pr{$pid}{seq};
@@ -286,9 +306,9 @@ sub display_pid_trace {
        } elsif ($$elem[0] eq 'FORK') {
            if ($i == 1) {
                 if ($lead =~ /-$/) {
-                   display_pid_trace($$elem[1], "$lead--+--");
+                   display_pid_trace($$elem[1], "$lead--+--");
                 } else {
-                   display_pid_trace($$elem[1], "$lead  +--");
+                   display_pid_trace($$elem[1], "$lead  +--");
                 }
            } elsif ($i == @seq) {
                display_pid_trace($$elem[1], "$lead  `--");
@@ -314,4 +334,3 @@ sub display_trace {
 
     display_pid_trace($startpid, "");
 }
-