1#!/usr/bin/perl
2
3
4die <<EEE unless @ARGV;
5Usage: $0 func1 [func2 [ ...] ]
6
7This filter (stdin->stdout) removes lines from dbug trace that were generated
8by specified functions and all functions down the call stack. Produces the
9same effect as if the original source had DBUG_PUSH(""); right after
10DBUG_ENTER() and DBUG_POP(); right before DBUG_RETURN in every such a function.
11EEE
12
13$re=join('|', @ARGV);
14$skip='';
15
16while(<STDIN>) {
17  print unless $skip;
18  next unless /^(?:.*: )*((?:\| )*)([<>])($re)\n/o;
19  if ($2 eq '>') {
20    $skip=$1.$3 unless $skip;
21    next;
22  }
23  next if $skip ne $1.$3;
24  $skip='';
25  print;
26}
27