]> granicus.if.org Git - strace/commitdiff
strace-graph: handle recent strace output
authorKeith Owens <kaos.ocs@gmail.com>
Mon, 18 Jan 2016 02:09:59 +0000 (13:09 +1100)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 5 Feb 2016 00:41:23 +0000 (00:41 +0000)
* strace-graph: Fix regex for --SIG.  Ignore '+++ exited with <n> +++'
lines.  Handle exit_group syscall as well as _exit.

strace-graph

index b09c92803269e0b477156bca04bc5ea2e692367b..ae355aa8516a8b6e4fbae09d0ce3308ebea03492 100755 (executable)
@@ -75,7 +75,7 @@ while (<>) {
        delete $unfinished{$pid};
     }
 
-    if (/^--- SIG(\S+) \(.*\) ---$/) {
+    if (/^--- SIG(\S+) (.*) ---$/) {
        # $pid received signal $1
        # currently we don't do anything with this
        next;
@@ -87,6 +87,12 @@ while (<>) {
        next;
     }
 
+    if (/^\+\+\+ exited with (\d+) \+\+\+$/) {
+       # $pid exited $1
+       # currently we don't do anything with this
+       next;
+    }
+
     ($call, $args, $result) = /(\S+)\((.*)\)\s+= (.*)$/;
     if ($result =~ /^(.*) <([0-9.]*)>$/) {
        ($result, $time_spent) = ($1, $2);
@@ -244,7 +250,7 @@ sub handle_trace {
        push @$seq, ['FORK', $result];
        $pr{$pid}{seq} = $seq;
        $pr{$result}{parent} = $pid;
-    } elsif ($call eq '_exit') {
+    } elsif ($call eq '_exit' || $call eq 'exit_group') {
        $pr{$pid}{end} = $time if defined $time;
     }
 }