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
|
|
93
|
use warnings; no warnings 'redefine'; |
|
12
|
|
|
12
|
|
31
|
|
|
12
|
|
|
1
|
|
379
|
|
|
12
|
|
|
1
|
|
58
|
|
|
12
|
|
|
|
|
24
|
|
|
12
|
|
|
|
|
391
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
4
|
12
|
|
|
12
|
|
63
|
use rlib '../../../..'; |
|
12
|
|
|
1
|
|
24
|
|
|
12
|
|
|
|
|
67
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
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::Disable; |
12
|
12
|
|
|
12
|
|
4447
|
use if !@ISA, Devel::Trepan::CmdProcessor::Command ; |
|
12
|
|
|
1
|
|
28
|
|
|
12
|
|
|
|
|
66
|
|
|
1
|
|
|
|
|
356
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
13
|
12
|
|
|
12
|
|
1587
|
use strict; |
|
12
|
|
|
1
|
|
27
|
|
|
12
|
|
|
|
|
699
|
|
|
1
|
|
|
|
|
28
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
14
|
|
|
|
|
|
|
|
15
|
12
|
|
|
12
|
|
59
|
use vars qw(@ISA); |
|
12
|
|
|
1
|
|
39
|
|
|
12
|
|
|
|
|
1160
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
84
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
unless (@ISA) { |
18
|
12
|
|
|
12
|
|
85
|
eval <<"EOE"; |
|
12
|
|
|
12
|
|
28
|
|
|
12
|
|
|
12
|
|
714
|
|
|
12
|
|
|
12
|
|
81
|
|
|
12
|
|
|
12
|
|
71
|
|
|
12
|
|
|
|
|
586
|
|
|
12
|
|
|
|
|
72
|
|
|
12
|
|
|
|
|
30
|
|
|
12
|
|
|
|
|
554
|
|
|
12
|
|
|
|
|
72
|
|
|
12
|
|
|
|
|
27
|
|
|
12
|
|
|
|
|
552
|
|
|
12
|
|
|
|
|
66
|
|
|
12
|
|
|
|
|
26
|
|
|
12
|
|
|
|
|
478
|
|
19
|
|
|
|
|
|
|
use constant CATEGORY => 'breakpoints'; |
20
|
|
|
|
|
|
|
use constant SHORT_HELP => 'Disable some breakpoints'; |
21
|
|
|
|
|
|
|
use constant MIN_ARGS => 0; # Need at least this many |
22
|
|
|
|
|
|
|
use constant MAX_ARGS => undef; # Need at most this many - undef -> unlimited. |
23
|
|
|
|
|
|
|
use constant NEED_STACK => 0; |
24
|
|
|
|
|
|
|
EOE |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
@ISA = @CMD_ISA; |
28
|
12
|
|
|
12
|
|
73
|
use vars @CMD_VARS; # Value inherited from parent |
|
12
|
|
|
1
|
|
27
|
|
|
12
|
|
|
|
|
9436
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
686
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# require_relative '../breakpoint' |
31
|
|
|
|
|
|
|
# require_relative '../../app/util' |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
our $NAME = set_name(); |
34
|
|
|
|
|
|
|
=pod |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 Synopsis: |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
our $HELP = <<'HELP'; |
40
|
|
|
|
|
|
|
=pod |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
B<disable> I<bp-number> [I<bp-number> ...] |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Disables the breakpoints given as a space separated list of breakpoint |
45
|
|
|
|
|
|
|
numbers. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 Examples: |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
disable 1 2 # Enable breakpoint 1 and 2 |
50
|
|
|
|
|
|
|
disable b1 b2 # Same as above |
51
|
|
|
|
|
|
|
disable a4 # Enable action 4 |
52
|
|
|
|
|
|
|
disable w1 2 # Enable watch expression 1 and breakpoint 2 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 See also: |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
L<C<info break>|Devel::Trepan::CmdProcessor::Command::Info::Breakpoints> to |
57
|
|
|
|
|
|
|
get a list of breakpoints, and |
58
|
|
|
|
|
|
|
L<C<enable>|<Devel::Trepan::CmdProcessor::Command::Enable> to |
59
|
|
|
|
|
|
|
enable breakpoints. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
HELP |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
### FIXME: parameterize and combine these. Also combine with enable. |
65
|
|
|
|
|
|
|
sub disable_breakpoint($$) { |
66
|
0
|
|
|
0
|
0
|
|
my ($proc, $i) = @_; |
|
0
|
|
|
0
|
0
|
|
|
67
|
0
|
|
|
|
|
|
my $bp = $proc->{brkpts}->find($i); |
|
0
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my $msg; |
|
0
|
|
|
|
|
|
|
69
|
0
|
0
|
|
|
|
|
if ($bp) { |
|
0
|
0
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
if ($bp->enabled) { |
|
0
|
0
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
$bp->enabled(0); |
|
0
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
$msg = sprintf("Breakpoint %d disabled", $bp->id); |
|
0
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
$proc->msg($msg); |
|
0
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
} else { |
75
|
0
|
|
|
|
|
|
$msg = sprintf("Breakpoint %d already disabled", $bp->id); |
|
0
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
$proc->errmsg($msg); |
|
0
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} else { |
79
|
0
|
|
|
|
|
|
$msg = sprintf("No breakpoint %d found", $i); |
|
0
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
$proc->errmsg($msg); |
|
0
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub disable_watchpoint($$) { |
85
|
0
|
|
|
0
|
0
|
|
my ($proc, $i) = @_; |
|
0
|
|
|
0
|
0
|
|
|
86
|
0
|
|
|
|
|
|
my $wp = $proc->{dbgr}{watch}->find($i); |
|
0
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
my $msg; |
|
0
|
|
|
|
|
|
|
88
|
0
|
0
|
|
|
|
|
if ($wp) { |
|
0
|
0
|
|
|
|
|
|
89
|
0
|
0
|
|
|
|
|
if ($wp->enabled) { |
|
0
|
0
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
$wp->enabled(0); |
|
0
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
$msg = sprintf("Watch expression %d disabled", $wp->id); |
|
0
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
$proc->msg($msg); |
|
0
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
} else { |
94
|
0
|
|
|
|
|
|
$msg = sprintf("Watch expression %d already disabled", $wp->id); |
|
0
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
$proc->errmsg($msg); |
|
0
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} else { |
98
|
0
|
|
|
|
|
|
$msg = sprintf("No watchpoint %d found", $i); |
|
0
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
$proc->errmsg($msg); |
|
0
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub disable_action($$) { |
104
|
0
|
|
|
0
|
0
|
|
my ($proc, $i) = @_; |
|
0
|
|
|
0
|
0
|
|
|
105
|
0
|
|
|
|
|
|
my $act = $proc->{actions}->find($i); |
|
0
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
my $msg; |
|
0
|
|
|
|
|
|
|
107
|
0
|
0
|
|
|
|
|
if ($act) { |
|
0
|
0
|
|
|
|
|
|
108
|
0
|
0
|
|
|
|
|
if ($act->enabled) { |
|
0
|
0
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
$act->enabled(0); |
|
0
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
$msg = sprintf("Action %d disabled", $act->id); |
|
0
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
$proc->msg($msg); |
|
0
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
} else { |
113
|
0
|
|
|
|
|
|
$msg = sprintf("Action %d already disabled", $act->id); |
|
0
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
$proc->errmsg($msg); |
|
0
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
} else { |
117
|
0
|
|
|
|
|
|
$msg = sprintf("No action %d found", $i); |
|
0
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
$proc->errmsg($msg); |
|
0
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub run($$) |
123
|
|
|
|
|
|
|
{ |
124
|
0
|
|
|
0
|
0
|
|
my ($self, $args) = @_; |
|
0
|
|
|
0
|
0
|
|
|
125
|
0
|
|
|
|
|
|
my $proc = $self->{proc}; |
|
0
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
|
my @args = @{$args}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
127
|
0
|
0
|
|
|
|
|
if (scalar @args == 1) { |
|
0
|
0
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
$proc->errmsg('No breakpoint number given.'); |
|
0
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
return; |
|
0
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
} |
131
|
0
|
|
|
|
|
|
my $first = shift @args; |
|
0
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
for my $num_str (@args) { |
|
0
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
my $type = lc(substr($num_str,0,1)); |
|
0
|
|
|
|
|
|
|
134
|
0
|
0
|
|
|
|
|
if ($type !~ /[0-9baw]/) { |
|
0
|
0
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
$proc->errmsg("Invalid prefix $type. Argument $num_str ignored"); |
|
0
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
next; |
|
0
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
} |
138
|
0
|
0
|
|
|
|
|
if ($type =~ /[0-9]/) { |
|
0
|
0
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
$type='b'; |
|
0
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
} else { |
141
|
0
|
|
|
|
|
|
$num_str = substr($num_str, 1); |
|
0
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
} |
143
|
0
|
|
|
|
|
|
my $i = $proc->get_an_int($num_str); |
|
0
|
|
|
|
|
|
|
144
|
0
|
0
|
|
|
|
|
if (defined $i) { |
|
0
|
0
|
|
|
|
|
|
145
|
0
|
0
|
|
|
|
|
if ('a' eq $type) { |
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
146
|
0
|
|
|
|
|
|
disable_action($proc, $i); |
|
0
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
} elsif ('b' eq $type) { |
148
|
0
|
|
|
|
|
|
disable_breakpoint($proc, $i); |
|
0
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
} elsif ('w' eq $type) { |
150
|
0
|
|
|
|
|
|
disable_watchpoint($proc, $i); |
|
0
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
unless (caller) { |
157
|
|
|
|
|
|
|
# require_relative '../mock' |
158
|
|
|
|
|
|
|
# dbgr, cmd = MockDebugger::setup |
159
|
|
|
|
|
|
|
# cmd.run([cmd.name]) |
160
|
|
|
|
|
|
|
# cmd.run([cmd.name, '1']) |
161
|
|
|
|
|
|
|
# cmdproc = dbgr.core.processor |
162
|
|
|
|
|
|
|
# cmds = cmdproc.commands |
163
|
|
|
|
|
|
|
# break_cmd = cmds['break'] |
164
|
|
|
|
|
|
|
# break_cmd.run(['break', cmdproc.frame.source_location[0].to_s]) |
165
|
|
|
|
|
|
|
# # require_relative '../../lib/trepanning' |
166
|
|
|
|
|
|
|
# # Trepan.debug |
167
|
|
|
|
|
|
|
# cmd.run([cmd.name, '1']) |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
1; |