line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Devel::SubBreaker; |
2
|
|
|
|
|
|
|
our $VERSION = 0.02; |
3
|
|
|
|
|
|
|
sub import { |
4
|
1
|
|
|
1
|
|
9
|
our @patterns = @_[1..$#_]; |
5
|
1
|
|
|
|
|
12
|
require "perl5db.pl"; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
CHECK { # expect compile-time mods have been loaded before CHECK phase |
8
|
|
|
|
|
|
|
foreach my $sub (sort keys %DB::sub) { |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# exclude some pragmas, core modules, and modules integral to the |
11
|
|
|
|
|
|
|
# debugger, as breaking inside these modules can cause problems |
12
|
|
|
|
|
|
|
# This list is constructed by trial-and-error so that it does |
13
|
|
|
|
|
|
|
# not cause any problems for perl v5.08 through v5.26. |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# If you encounter any additional modules and pragmas that must |
16
|
|
|
|
|
|
|
# be excluded for this module to function, submit a bug report to |
17
|
|
|
|
|
|
|
# http://rt.cpan.org/NoAuth/Bugs.html?Dist=Devel-ModuleBreaker |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
next if $sub =~ /^warnings::/; |
21
|
|
|
|
|
|
|
next if $sub =~ /^Carp::/; |
22
|
|
|
|
|
|
|
next if $sub =~ /^Config::/; |
23
|
|
|
|
|
|
|
next if $sub =~ /^IO::/; |
24
|
|
|
|
|
|
|
next if $sub =~ /^DB::/; |
25
|
|
|
|
|
|
|
next if $sub =~ /^Devel::\w+Breaker::/; |
26
|
|
|
|
|
|
|
next if $sub =~ /^Exporter::/; |
27
|
|
|
|
|
|
|
next if $sub =~ /^Symbol::/; |
28
|
|
|
|
|
|
|
next if $sub =~ /^XSLoader::/; |
29
|
|
|
|
|
|
|
next if $sub =~ /^base::/; |
30
|
|
|
|
|
|
|
next if $sub =~ /^bytes::/; |
31
|
|
|
|
|
|
|
next if $sub =~ /^feature::/; |
32
|
|
|
|
|
|
|
next if $sub =~ /^overload::/; |
33
|
|
|
|
|
|
|
next if $sub =~ /^lib::/; |
34
|
|
|
|
|
|
|
next if $sub =~ /^strict::/; |
35
|
|
|
|
|
|
|
next if $sub =~ /^vars::/; |
36
|
|
|
|
|
|
|
next if $sub =~ /^dumpvar::/; |
37
|
|
|
|
|
|
|
next if $sub eq 'main::BEGIN'; |
38
|
|
|
|
|
|
|
next if $sub =~ /t.bptracker.pl/; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
for (our @patterns) { |
41
|
|
|
|
|
|
|
if ($sub =~ qr/$_/) { |
42
|
|
|
|
|
|
|
DB::cmd_b_sub($sub); |
43
|
|
|
|
|
|
|
last; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 NAME |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Devel::SubBreaker - set breakpoints in many arbitrary subroutines simultaneously |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 VERSION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
0.02 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SYNOPSIS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
$ perl -d:SubBreaker=sub1,sub2,Module3,regexp4 script_to_debug.pl |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 DESCRPITION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
C seeks to simplify the process of settings breakpoints |
65
|
|
|
|
|
|
|
in a collection of subroutines from a distribution, a single module, or |
66
|
|
|
|
|
|
|
just any subroutine name that matches an arbitrary pattern. It does not |
67
|
|
|
|
|
|
|
require the debugger user to enumerate the subroutines to be stepped through, |
68
|
|
|
|
|
|
|
so it is useful for unfamiliar distributions or distributions under development |
69
|
|
|
|
|
|
|
where subroutine names may be in flux. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This module was inspired by a |
72
|
|
|
|
|
|
|
L. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 USAGE |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
To use this module, pass this command-line argument to C |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
-d:SubBreaker=pattern[,pattern2[,...]] |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
where C, C, etc. are any valid perl regular expressions. |
81
|
|
|
|
|
|
|
In the L<< C phase|perlmod/"BEGIN,-UNITCHECK,-CHECK,-INIT-and-END" >> |
82
|
|
|
|
|
|
|
of the program, a breakpoint will be set at the start of any subroutine |
83
|
|
|
|
|
|
|
whose fully qualified subroutine name (given by |
84
|
|
|
|
|
|
|
L<< C<%DB::sub>|DB/"%DB::sub" >>) matches one of the given regular expressions. |
85
|
|
|
|
|
|
|
This includes anonymous subroutines that are known at compile time. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 EXAMPLES |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=over 4 |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item * Set a breakpoint in all subs in module C and all |
92
|
|
|
|
|
|
|
C submodules: |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
perl -d:SubBreaker=^Floop::Blert ... |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * Set a breakpoint in all subs just in module C: |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
perl -d:SubBreaker=^Floop::Blert::\\w+$ ... |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * Set a breakpoint in every known subroutine: |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
perl -d:SubBreaker=^ ... |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * Set a breakpoint in all anonymous subroutines |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
perl -d:SubBreaker=__ANON__ ... |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=back |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 SUPPORT |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This module is part of the L distribution. |
113
|
|
|
|
|
|
|
See L for support information about this module. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 SEE ALSO |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L, L |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 AUTHOR |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Marty O'Brien, Emob at cpan.orgE |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Copyright 2018 Marty O'Brien |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
128
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
129
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |