| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Devel::Trace::Method; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
103492
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
67
|
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
75
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.08'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
9
|
use Exporter 'import'; |
|
|
2
|
|
|
|
|
14
|
|
|
|
2
|
|
|
|
|
11390
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @ISA = qw( Exporter ); |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
|
13
|
|
|
|
|
|
|
all => [ qw( |
|
14
|
|
|
|
|
|
|
track_object_methods |
|
15
|
|
|
|
|
|
|
track_method |
|
16
|
|
|
|
|
|
|
fetch_trace |
|
17
|
|
|
|
|
|
|
) |
|
18
|
|
|
|
|
|
|
], |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{ all } }, ) ; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my @track_functions = qw( |
|
23
|
|
|
|
|
|
|
CODEFLOW |
|
24
|
|
|
|
|
|
|
STACK_TRACING |
|
25
|
|
|
|
|
|
|
); |
|
26
|
0
|
|
|
0
|
|
0
|
sub _track_functions { return @track_functions; } |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my @fetch_functions = qw( |
|
29
|
|
|
|
|
|
|
codeflow |
|
30
|
|
|
|
|
|
|
stacktrace |
|
31
|
|
|
|
|
|
|
); |
|
32
|
1
|
|
|
1
|
|
747
|
sub _fetch_functions { return @fetch_functions; } |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
{ # create the tracking/retrieving functions |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $debugging_functions; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
{ # CODEFLOW |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $codeflow_storage; |
|
41
|
|
|
|
|
|
|
my $call_count = 0; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub CODEFLOW { |
|
44
|
5
|
|
|
5
|
0
|
9
|
my $self = shift; |
|
45
|
|
|
|
|
|
|
|
|
46
|
5
|
50
|
|
|
|
16
|
return $codeflow_storage if @_; |
|
47
|
|
|
|
|
|
|
|
|
48
|
5
|
|
|
|
|
8
|
$call_count++; |
|
49
|
|
|
|
|
|
|
|
|
50
|
5
|
|
|
|
|
45
|
$codeflow_storage->{$call_count} = (caller(2))[3]; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
$debugging_functions->{CODEFLOW} = \&CODEFLOW; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub codeflow { |
|
55
|
|
|
|
|
|
|
|
|
56
|
3
|
|
|
3
|
0
|
7
|
my $self = shift; |
|
57
|
|
|
|
|
|
|
|
|
58
|
3
|
|
|
|
|
8
|
my @sorted_codeflow; |
|
59
|
|
|
|
|
|
|
|
|
60
|
3
|
|
|
|
|
22
|
foreach my $key (sort { ($a) <=> ($b) } keys %$codeflow_storage) { |
|
|
7
|
|
|
|
|
21
|
|
|
61
|
8
|
|
|
|
|
25
|
push @sorted_codeflow, "$key => $codeflow_storage->{$key}"; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
3
|
|
|
|
|
16
|
return \@sorted_codeflow; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
$debugging_functions->{codeflow} = \&codeflow; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
{ # STACK_TRACING |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my @stack; |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub STACK_TRACING { |
|
74
|
|
|
|
|
|
|
|
|
75
|
5
|
|
|
5
|
0
|
9
|
my $self = shift; |
|
76
|
|
|
|
|
|
|
|
|
77
|
5
|
50
|
|
|
|
16
|
return @stack if @_; |
|
78
|
|
|
|
|
|
|
|
|
79
|
5
|
|
50
|
|
|
33
|
my $caller = (caller(3))[3] || 0; |
|
80
|
|
|
|
|
|
|
|
|
81
|
5
|
|
|
|
|
104
|
push @stack, { |
|
82
|
|
|
|
|
|
|
caller => $caller, |
|
83
|
|
|
|
|
|
|
package => (caller(1))[0], |
|
84
|
|
|
|
|
|
|
filename => (caller(1))[1], |
|
85
|
|
|
|
|
|
|
line => (caller(1))[2], |
|
86
|
|
|
|
|
|
|
sub => (caller(2))[3], |
|
87
|
|
|
|
|
|
|
}; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
$debugging_functions->{STACK_TRACING} = \&STACK_TRACING; |
|
90
|
|
|
|
|
|
|
|
|
91
|
2
|
|
|
2
|
0
|
8
|
sub stacktrace { return \@stack; } |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
$debugging_functions->{stacktrace} = \&stacktrace; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
12
|
|
|
12
|
0
|
70
|
sub DEBUGGING_FUNCTIONS { return $debugging_functions; } |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub track_object_methods { |
|
100
|
|
|
|
|
|
|
|
|
101
|
3
|
|
|
3
|
1
|
512
|
my $self = shift; |
|
102
|
|
|
|
|
|
|
|
|
103
|
3
|
|
|
|
|
11
|
for my $function ( @track_functions ){ |
|
104
|
6
|
|
|
|
|
17
|
$self->{ DTM_functions }{ track }{ $function } |
|
105
|
|
|
|
|
|
|
= DEBUGGING_FUNCTIONS()->{ $function }; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
3
|
|
|
|
|
9
|
for my $function ( @fetch_functions ){ |
|
108
|
6
|
|
|
|
|
14
|
$self->{ DTM_functions }{ fetch }{ $function } |
|
109
|
|
|
|
|
|
|
= DEBUGGING_FUNCTIONS()->{ $function }; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
3
|
|
|
|
|
8
|
return $self; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub track_method { |
|
116
|
|
|
|
|
|
|
|
|
117
|
5
|
|
|
5
|
1
|
2611
|
my $self = shift; |
|
118
|
|
|
|
|
|
|
|
|
119
|
5
|
|
|
|
|
11
|
for my $track_function ( @track_functions ){ |
|
120
|
10
|
|
|
|
|
32
|
$self->{ DTM_functions }{ track }{ $track_function }(); |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
5
|
|
|
|
|
15
|
return 0; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub fetch_trace { |
|
127
|
|
|
|
|
|
|
|
|
128
|
4
|
|
|
4
|
1
|
1095
|
my $self = shift; |
|
129
|
4
|
|
|
|
|
7
|
my $param = shift; |
|
130
|
|
|
|
|
|
|
|
|
131
|
4
|
100
|
|
|
|
13
|
if ( ! $param ){ |
|
132
|
1
|
|
|
|
|
1
|
my $return_href; |
|
133
|
1
|
|
|
|
|
3
|
for my $data ( @fetch_functions ){ |
|
134
|
2
|
|
|
|
|
11
|
$return_href->{ $data } = $self->{ DTM_functions }{ fetch }{ $data }(); |
|
135
|
|
|
|
|
|
|
} |
|
136
|
1
|
|
|
|
|
4
|
return $return_href; |
|
137
|
|
|
|
|
|
|
} |
|
138
|
3
|
|
|
|
|
587
|
return $self->{ DTM_functions }{ fetch }{ $param }(); |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
1; |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
__END__ |