Backout 2ea2669b53c3, Bug 917642 - [Helix] Please update the helix blobs
[gecko.git] / tools / rb / filter-log.pl
blob4a1f66741bc79d4d19c46a345c64f24f41abbec1
1 #!/usr/bin/perl -w
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 # Filter a refcount log to show only the entries for a single object.
8 # Useful when manually examining refcount logs containing multiple
9 # objects.
11 use 5.004;
12 use strict;
13 use Getopt::Long;
15 GetOptions("object=s");
17 $::opt_object ||
18 die qq{
19 usage: filter-log-for.pl < logfile
20 --object <obj> The address of the object to examine (required)
23 warn "object $::opt_object\n";
25 LINE: while (<>) {
26 next LINE if (! /^</);
27 my $line = $_;
28 my @fields = split(/ /, $_);
30 my $class = shift(@fields);
31 my $obj = shift(@fields);
32 next LINE unless ($obj eq $::opt_object);
33 my $sno = shift(@fields);
34 my $op = shift(@fields);
35 my $cnt = shift(@fields);
37 print $line;
39 # The lines in the stack trace
40 CALLSITE: while (<>) {
41 print;
42 last CALLSITE if (/^$/);