Bug 496271, automation config for Tb2.0.0.22 build1, p=joduinn, r=me
[mozilla-1.9.git] / tools / rb / filter-log.pl
blobd868b3390f1e68f5d68fcadeb05934b1a1706166
1 #!/usr/bin/perl -w
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
14 # License.
16 # The Original Code is make-tree.pl
18 # The Initial Developer of the Original Code is
19 # Netscape Communications Corporation.
20 # Portions created by the Initial Developer are Copyright (C) 1998
21 # the Initial Developer. All Rights Reserved.
23 # Contributor(s):
24 # Authors of make-tree.pl.
25 # L. David Baron <dbaron@dbaron.org>, Mozilla Corporation
26 # (made filter-log-for.pl from make-tree.pl)
28 # Alternatively, the contents of this file may be used under the terms of
29 # either the GNU General Public License Version 2 or later (the "GPL"), or
30 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 # in which case the provisions of the GPL or the LGPL are applicable instead
32 # of those above. If you wish to allow use of your version of this file only
33 # under the terms of either the GPL or the LGPL, and not to allow others to
34 # use your version of this file under the terms of the MPL, indicate your
35 # decision by deleting the provisions above and replace them with the notice
36 # and other provisions required by the GPL or the LGPL. If you do not delete
37 # the provisions above, a recipient may use your version of this file under
38 # the terms of any one of the MPL, the GPL or the LGPL.
40 # ***** END LICENSE BLOCK *****
42 # Filter a refcount log to show only the entries for a single object.
43 # Useful when manually examining refcount logs containing multiple
44 # objects.
46 use 5.004;
47 use strict;
48 use Getopt::Long;
50 GetOptions("object=s");
52 $::opt_object ||
53 die qq{
54 usage: filter-log-for.pl < logfile
55 --object <obj> The address of the object to examine (required)
58 warn "object $::opt_object\n";
60 LINE: while (<>) {
61 next LINE if (! /^</);
62 my $line = $_;
63 my @fields = split(/ /, $_);
65 my $class = shift(@fields);
66 my $obj = shift(@fields);
67 next LINE unless ($obj eq $::opt_object);
68 my $sno = shift(@fields);
69 my $op = shift(@fields);
70 my $cnt = shift(@fields);
72 print $line;
74 # The lines in the stack trace
75 CALLSITE: while (<>) {
76 print;
77 last CALLSITE if (/^$/);