line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (C) 2011-2012, 2014 Rocky Bernstein <rocky@cpan.org> |
2
|
|
|
|
|
|
|
# -*- coding: utf-8 -*- |
3
|
12
|
|
|
12
|
|
101
|
use warnings; no warnings 'redefine'; |
|
12
|
|
|
12
|
|
36
|
|
|
12
|
|
|
1
|
|
455
|
|
|
12
|
|
|
1
|
|
76
|
|
|
12
|
|
|
|
|
31
|
|
|
12
|
|
|
|
|
429
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
12
|
|
|
12
|
|
73
|
use rlib '../../../..'; |
|
12
|
|
|
1
|
|
30
|
|
|
12
|
|
|
|
|
82
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# disable breakpoint command. The difference however is that the |
7
|
|
|
|
|
|
|
# parameter to @proc.en_disable_breakpoint_by_number is different (set |
8
|
|
|
|
|
|
|
# as ENABLE_PARM below). |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# NOTE: The enable command subclasses this, so beware when changing! |
11
|
|
|
|
|
|
|
package Devel::Trepan::CmdProcessor::Command::Enable; |
12
|
12
|
|
|
12
|
|
4322
|
use if !@ISA, Devel::Trepan::CmdProcessor::Command ; |
|
12
|
|
|
1
|
|
29
|
|
|
12
|
|
|
|
|
70
|
|
|
1
|
|
|
|
|
322
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
8
|
|
13
|
|
|
|
|
|
|
unless (@ISA) { |
14
|
12
|
|
|
12
|
|
87
|
eval <<"EOE"; |
|
12
|
|
|
12
|
|
35
|
|
|
12
|
|
|
12
|
|
743
|
|
|
12
|
|
|
12
|
|
84
|
|
|
12
|
|
|
|
|
28
|
|
|
12
|
|
|
|
|
583
|
|
|
12
|
|
|
|
|
82
|
|
|
12
|
|
|
|
|
33
|
|
|
12
|
|
|
|
|
544
|
|
|
12
|
|
|
|
|
73
|
|
|
12
|
|
|
|
|
30
|
|
|
12
|
|
|
|
|
428
|
|
15
|
|
|
|
|
|
|
use constant CATEGORY => 'breakpoints'; |
16
|
|
|
|
|
|
|
use constant SHORT_HELP => 'Enable some breakpoints'; |
17
|
|
|
|
|
|
|
use constant MIN_ARGS => 0; # Need at least this many |
18
|
|
|
|
|
|
|
use constant MAX_ARGS => undef; # Need at most this many - undef -> unlimited. |
19
|
|
|
|
|
|
|
EOE |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
12
|
|
|
12
|
|
2104
|
use strict; |
|
12
|
|
|
1
|
|
39
|
|
|
12
|
|
|
|
|
284
|
|
|
1
|
|
|
|
|
87
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
30
|
|
23
|
12
|
|
|
12
|
|
61
|
use vars qw(@ISA); |
|
12
|
|
|
1
|
|
27
|
|
|
12
|
|
|
|
|
606
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
72
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
@ISA = @CMD_ISA; |
26
|
12
|
|
|
12
|
|
73
|
use vars @CMD_VARS; # Value inherited from parent |
|
12
|
|
|
1
|
|
31
|
|
|
12
|
|
|
|
|
9110
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
712
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# require_relative '../breakpoint' |
29
|
|
|
|
|
|
|
# require_relative '../../app/util' |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our $NAME = set_name(); |
32
|
|
|
|
|
|
|
=pod |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 Synopsis: |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
our $HELP = <<"HELP"; |
38
|
|
|
|
|
|
|
=pod |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
B<enable> I<num> [I<num> ...] |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Enables breakpoints, watch expressions or actions given as a space |
43
|
|
|
|
|
|
|
separated list of numbers which may be prefaces with an 'a', 'b', or 'w'. |
44
|
|
|
|
|
|
|
The prefaces are interpreted as follows: |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=over |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item a E<mdash> action number |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item b E<mdash> breakpoint number |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item w E<mdash> expression number |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=back |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
If I<num> is starts with a digit, I<num> is taken to be a breakpoint number. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 Examples: |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
enable 1 2 # Enable breakpoint 1 and 2 |
61
|
|
|
|
|
|
|
enable b1 b2 # Same as above |
62
|
|
|
|
|
|
|
enable a4 # Enable action 4 |
63
|
|
|
|
|
|
|
enable w1 2 # Enable watch expression 1 and breakpoint 2 |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 See also: |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
L<C<info break>|Devel::Trepan::CmdProcessor::Command::Info::Break> to |
68
|
|
|
|
|
|
|
get a list of breakpoints, and |
69
|
|
|
|
|
|
|
L<C<disable>|<Devel::Trepan::CmdProcessor::Command::Disable> to |
70
|
|
|
|
|
|
|
disable breakpoints. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
HELP |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
### FIXME: parameterize and combine these. Also combine with disable. |
76
|
|
|
|
|
|
|
sub enable_breakpoint($$) { |
77
|
0
|
|
|
0
|
0
|
|
my ($proc, $i) = @_; |
|
0
|
|
|
0
|
0
|
|
|
78
|
0
|
|
|
|
|
|
my $bp = $proc->{brkpts}->find($i); |
|
0
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
my $msg; |
|
0
|
|
|
|
|
|
|
80
|
0
|
0
|
|
|
|
|
if ($bp) { |
|
0
|
0
|
|
|
|
|
|
81
|
0
|
0
|
|
|
|
|
if ($bp->enabled) { |
|
0
|
0
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
$msg = sprintf("Breakpoint %d already enabled", $bp->id); |
|
0
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
$proc->errmsg($msg); |
|
0
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
} else { |
85
|
0
|
|
|
|
|
|
$bp->enabled(1); |
|
0
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
$msg = sprintf("Breakpoint %d enabled", $bp->id); |
|
0
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
$proc->msg($msg); |
|
0
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} else { |
90
|
0
|
|
|
|
|
|
$msg = sprintf("No breakpoint %d found", $i); |
|
0
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
$proc->errmsg($msg); |
|
0
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub enable_watchpoint($$) { |
96
|
0
|
|
|
0
|
0
|
|
my ($proc, $i) = @_; |
|
0
|
|
|
0
|
0
|
|
|
97
|
0
|
|
|
|
|
|
my $wp = $proc->{dbgr}{watch}->find($i); |
|
0
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
my $msg; |
|
0
|
|
|
|
|
|
|
99
|
0
|
0
|
|
|
|
|
if ($wp) { |
|
0
|
0
|
|
|
|
|
|
100
|
0
|
0
|
|
|
|
|
if ($wp->enabled) { |
|
0
|
0
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
$msg = sprintf("Watch expression %d already enabled", $wp->id); |
|
0
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
$proc->errmsg($msg); |
|
0
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
} else { |
104
|
0
|
|
|
|
|
|
$wp->enabled(1); |
|
0
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
$msg = sprintf("Watch expression %d enabled", $wp->id); |
|
0
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
$proc->msg($msg); |
|
0
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
} else { |
109
|
0
|
|
|
|
|
|
$msg = sprintf("No watchpoint %d found", $i); |
|
0
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
$proc->errmsg($msg); |
|
0
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub enable_action($$) { |
115
|
0
|
|
|
0
|
0
|
|
my ($proc, $i) = @_; |
|
0
|
|
|
0
|
0
|
|
|
116
|
0
|
|
|
|
|
|
my $act = $proc->{actions}->find($i); |
|
0
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
my $msg; |
|
0
|
|
|
|
|
|
|
118
|
0
|
0
|
|
|
|
|
if ($act) { |
|
0
|
0
|
|
|
|
|
|
119
|
0
|
0
|
|
|
|
|
if ($act->enabled) { |
|
0
|
0
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
$msg = sprintf("Action %d already enabled", $act->id); |
|
0
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
$proc->errmsg($msg); |
|
0
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
} else { |
123
|
0
|
|
|
|
|
|
$act->enabled(1); |
|
0
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
$msg = sprintf("Action %d enabled", $act->id); |
|
0
|
|
|
|
|
|
|
125
|
0
|
|
|
|
|
|
$proc->msg($msg); |
|
0
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
} else { |
128
|
0
|
|
|
|
|
|
$msg = sprintf("No action %d found", $i); |
|
0
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
$proc->errmsg($msg); |
|
0
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub run($$) |
134
|
|
|
|
|
|
|
{ |
135
|
0
|
|
|
0
|
0
|
|
my ($self, $args) = @_; |
|
0
|
|
|
0
|
0
|
|
|
136
|
0
|
|
|
|
|
|
my $proc = $self->{proc}; |
|
0
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
my @args = @{$args}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
138
|
0
|
0
|
|
|
|
|
if (scalar @args == 1) { |
|
0
|
0
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
$proc->errmsg('No breakpoint number given.'); |
|
0
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
return; |
|
0
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
} |
142
|
0
|
|
|
|
|
|
my $first = shift @args; |
|
0
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
for my $num_str (@args) { |
|
0
|
|
|
|
|
|
|
144
|
0
|
|
|
|
|
|
my $type = lc(substr($num_str,0,1)); |
|
0
|
|
|
|
|
|
|
145
|
0
|
0
|
|
|
|
|
if ($type !~ /[0-9baw]/) { |
|
0
|
0
|
|
|
|
|
|
146
|
0
|
|
|
|
|
|
$proc->errmsg("Invalid prefix $type. Argument $num_str ignored"); |
|
0
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
|
next; |
|
0
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
} |
149
|
0
|
0
|
|
|
|
|
if ($type =~ /[0-9]/) { |
|
0
|
0
|
|
|
|
|
|
150
|
0
|
|
|
|
|
|
$type='b'; |
|
0
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
} else { |
152
|
0
|
|
|
|
|
|
$num_str = substr($num_str, 1); |
|
0
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
} |
154
|
0
|
|
|
|
|
|
my $i = $proc->get_an_int($num_str); |
|
0
|
|
|
|
|
|
|
155
|
0
|
0
|
|
|
|
|
if (defined $i) { |
|
0
|
0
|
|
|
|
|
|
156
|
0
|
0
|
|
|
|
|
if ('a' eq $type) { |
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
157
|
0
|
|
|
|
|
|
enable_action($proc, $i); |
|
0
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
} elsif ('b' eq $type) { |
159
|
0
|
|
|
|
|
|
enable_breakpoint($proc, $i); |
|
0
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
} elsif ('w' eq $type) { |
161
|
0
|
|
|
|
|
|
enable_watchpoint($proc, $i); |
|
0
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
unless (caller) { |
168
|
|
|
|
|
|
|
# require_relative '../mock' |
169
|
|
|
|
|
|
|
# dbgr, cmd = MockDebugger::setup |
170
|
|
|
|
|
|
|
# cmd.run([cmd.name]) |
171
|
|
|
|
|
|
|
# cmd.run([cmd.name, '1']) |
172
|
|
|
|
|
|
|
# cmdproc = dbgr.core.processor |
173
|
|
|
|
|
|
|
# cmds = cmdproc.commands |
174
|
|
|
|
|
|
|
# break_cmd = cmds['break'] |
175
|
|
|
|
|
|
|
# break_cmd.run(['break', cmdproc.frame.source_location[0].to_s]) |
176
|
|
|
|
|
|
|
# # require_relative '../../lib/trepanning' |
177
|
|
|
|
|
|
|
# # Trepan.debug |
178
|
|
|
|
|
|
|
# cmd.run([cmd.name, '1']) |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
1; |