line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ref::Store::Dumper; |
2
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
127
|
|
4
|
1
|
|
|
1
|
|
8
|
use Scalar::Util qw(isweak looks_like_number); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
5
|
1
|
|
|
1
|
|
6
|
use Log::Fu; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $IndentChar = ' '; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
0
|
|
|
0
|
0
|
|
my $cls = shift; |
11
|
0
|
|
|
|
|
|
my $self = { Indent => 0, Buf => "" }; |
12
|
0
|
|
|
|
|
|
bless $self, $cls; |
13
|
0
|
|
|
|
|
|
return $self; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub print { |
17
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
18
|
0
|
|
|
|
|
|
$self->{Buf} .= $IndentChar x $self->{Indent}; |
19
|
0
|
|
|
|
|
|
my $fmt = shift @_; |
20
|
0
|
|
|
|
|
|
$self->{Buf} .= sprintf($fmt, @_); |
21
|
0
|
|
|
|
|
|
$self->{Buf} .= "\n"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub fmt_ptr { |
25
|
0
|
0
|
|
0
|
0
|
|
shift @_ if @_ == 2; |
26
|
0
|
|
|
|
|
|
my $s = ""; |
27
|
0
|
|
|
|
|
|
my $ptr = $_[0]; |
28
|
0
|
0
|
0
|
|
|
|
if (ref $ptr || looks_like_number($ptr)) { |
29
|
0
|
|
|
|
|
|
$s .= sprintf("[%d 0x%x]", $ptr+0, $ptr+0); |
30
|
|
|
|
|
|
|
} |
31
|
0
|
0
|
|
|
|
|
if(ref $ptr) { |
|
|
0
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
$s .= sprintf(" SV=0x%x WEAK=%d ISA=%s", \$_[0], isweak($_[0]), ref $ptr); |
33
|
|
|
|
|
|
|
} elsif(!looks_like_number($ptr)) { |
34
|
0
|
|
|
|
|
|
$s .= $ptr; |
35
|
|
|
|
|
|
|
} |
36
|
0
|
|
|
|
|
|
return $s; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub flush { |
40
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
41
|
0
|
|
|
|
|
|
print $self->{Buf}; |
42
|
0
|
|
|
|
|
|
$self->{Buf} = ""; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub iprint { |
46
|
0
|
|
|
0
|
0
|
|
my ($self,@pargs) = @_; |
47
|
0
|
|
|
|
|
|
$self->{Indent}++; |
48
|
0
|
|
|
|
|
|
$self->print(@pargs); |
49
|
0
|
|
|
|
|
|
$self->{Indent}--; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub hdr { |
53
|
0
|
|
|
0
|
0
|
|
my ($self,@pargs) = @_; |
54
|
0
|
|
|
|
|
|
my $old_indent = $self->{Indent}; |
55
|
0
|
0
|
|
|
|
|
$self->{Indent}-- if $old_indent; |
56
|
0
|
|
|
|
|
|
$self->{Buf} .= "\n"; |
57
|
0
|
|
|
|
|
|
$self->print(@pargs); |
58
|
0
|
|
|
|
|
|
$self->{Buf} .= "\n"; |
59
|
0
|
|
|
|
|
|
$self->{Indent}++; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub dump { |
63
|
0
|
|
|
0
|
0
|
|
my ($self,$table) = @_; |
64
|
0
|
|
|
|
|
|
$self->hdr("Values"); |
65
|
0
|
|
|
|
|
|
while ( my($v,$rhash) = each %{$table->reverse}) { |
|
0
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
$self->print("V: %s", $self->fmt_ptr($v)); |
67
|
0
|
|
|
|
|
|
while (my ($lk,$lo) = each %$rhash) { |
68
|
0
|
|
|
|
|
|
$self->iprint("L: %s, %s", $lo->kstring, |
69
|
|
|
|
|
|
|
$self->fmt_ptr($rhash->{$lk})); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
$self->hdr("Forward Lookups"); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
while ( my ($k,$vobj) = each %{$table->forward}) { |
|
0
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
$self->iprint("L: %s", $self->fmt_ptr($k)); |
78
|
0
|
|
|
|
|
|
$self->{Indent}++; |
79
|
0
|
|
|
|
|
|
$self->iprint("V: %s", $self->fmt_ptr($table->forward->{$k})); |
80
|
0
|
|
|
|
|
|
$self->{Indent}--; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
$self->hdr("Scalar to key object mappings"); |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
while (my ($ustr,$ko) = each %{$table->scalar_lookup}) { |
|
0
|
|
|
|
|
|
|
86
|
0
|
0
|
|
|
|
|
if(!defined $ko) { |
87
|
0
|
|
|
|
|
|
$self->iprint("UKEY=%s, KO=undef", $self->fmt_ptr($ustr)); |
88
|
0
|
|
|
|
|
|
next; |
89
|
|
|
|
|
|
|
} |
90
|
0
|
|
|
|
|
|
$self->iprint("UKEY=%s KO=%s", |
91
|
|
|
|
|
|
|
$self->fmt_ptr($ustr), |
92
|
|
|
|
|
|
|
$self->fmt_ptr($table->scalar_lookup->{$ustr})); |
93
|
|
|
|
|
|
|
|
94
|
0
|
0
|
|
|
|
|
if($ko->can("dump")) { |
95
|
0
|
|
|
|
|
|
$self->{Indent}++; |
96
|
0
|
|
|
|
|
|
$ko->dump($self); |
97
|
0
|
|
|
|
|
|
$self->{Indent}--; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
$self->hdr("Attribute mappings"); |
102
|
0
|
|
|
|
|
|
while (my ($astr,$aobj) = each %{$table->attr_lookup}) { |
|
0
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
$self->iprint("ASTR=%s ATTR=%s", $astr, |
104
|
|
|
|
|
|
|
$self->fmt_ptr($table->attr_lookup->{$astr})); |
105
|
0
|
0
|
|
|
|
|
if($aobj->can("dump")) { |
106
|
0
|
|
|
|
|
|
$self->{Indent}++; |
107
|
0
|
|
|
|
|
|
$aobj->dump($self); |
108
|
0
|
|
|
|
|
|
$self->{Indent}--; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
1; |