tools/rb/filter-log.pl

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rwxr-xr-x

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 #!/usr/bin/perl -w
     2 #
     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)
    21 };
    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 (/^$/);
    43     }
    44 }

mercurial