line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- coding: utf-8 -*- |
2
|
|
|
|
|
|
|
# Copyright (C) 2011-2012, 2014 Rocky Bernstein <rocky@cpan.org> |
3
|
|
|
|
|
|
|
|
4
|
12
|
|
|
12
|
|
101
|
use warnings; |
|
12
|
|
|
1
|
|
32
|
|
|
12
|
|
|
|
|
434
|
|
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
5
|
12
|
|
|
12
|
|
70
|
use rlib '../../../../..'; |
|
12
|
|
|
1
|
|
27
|
|
|
12
|
|
|
|
|
71
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Devel::Trepan::CmdProcessor::Command::Info::Watch; |
8
|
12
|
|
|
12
|
|
4764
|
use Devel::Trepan::CmdProcessor::Command::Subcmd::Core; |
|
12
|
|
|
1
|
|
32
|
|
|
12
|
|
|
|
|
480
|
|
|
1
|
|
|
|
|
389
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
35
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
@ISA = qw(Devel::Trepan::CmdProcessor::Command::Subcmd); |
11
|
|
|
|
|
|
|
# Values inherited from parent |
12
|
12
|
|
|
12
|
|
73
|
use vars @Devel::Trepan::CmdProcessor::Command::Subcmd::SUBCMD_VARS; |
|
12
|
|
|
1
|
|
33
|
|
|
12
|
|
|
|
|
2009
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
141
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
unless (@ISA) { |
15
|
|
|
|
|
|
|
eval <<"EOE"; |
16
|
|
|
|
|
|
|
use constant MAX_ARGS => undef; # Need at most this many - undef -> unlimited. |
17
|
|
|
|
|
|
|
EOE |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $CMD = 'info watch'; |
21
|
|
|
|
|
|
|
=pod |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head2 Synopsis: |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $HELP = <<'HELP'; |
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
B<info watch> [I<watchpoint1> I<watchpoint2> ...] |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
List watch information. If watchpoints are specified, only information |
33
|
|
|
|
|
|
|
about them is shown. If no watchpoints are specified, show information |
34
|
|
|
|
|
|
|
about all watchpoints. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 See also: |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
L<C<watch>|<Devel::Trepan::CmdProcessor::Command::Watch> |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
HELP |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
our $MIN_ABBREV = length('wa'); |
44
|
|
|
|
|
|
|
our $SHORT_HELP = "Show watchpoint information"; |
45
|
|
|
|
|
|
|
|
46
|
12
|
|
|
12
|
|
91
|
no warnings 'redefine'; |
|
12
|
|
|
1
|
|
35
|
|
|
12
|
|
|
|
|
4050
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
345
|
|
47
|
|
|
|
|
|
|
# sub complete($$) { |
48
|
|
|
|
|
|
|
# { |
49
|
|
|
|
|
|
|
# my ($self, $prefix) = @_; |
50
|
|
|
|
|
|
|
# my @cmds = sort keys %{$proc->{macros}}; |
51
|
|
|
|
|
|
|
# Trepan::Complete.complete_token(@cmds, $prefix); |
52
|
|
|
|
|
|
|
# } |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# sub save_command($) |
55
|
|
|
|
|
|
|
# { |
56
|
|
|
|
|
|
|
# my $self = shift; |
57
|
|
|
|
|
|
|
# my $proc = $self->{proc}; |
58
|
|
|
|
|
|
|
# my $wpmgr = $proc->{dbgr}{watch}; |
59
|
|
|
|
|
|
|
# my @res = (); |
60
|
|
|
|
|
|
|
# for my $bp ($wpmgr->list) { |
61
|
|
|
|
|
|
|
# push @res, "watch ${loc}"; |
62
|
|
|
|
|
|
|
# } |
63
|
|
|
|
|
|
|
# return @res; |
64
|
|
|
|
|
|
|
# } |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub wpprint($$;$) |
67
|
|
|
|
|
|
|
{ |
68
|
0
|
|
|
0
|
|
|
my ($self, $wp, $verbose) = @_; |
|
0
|
|
|
0
|
|
|
|
69
|
0
|
|
|
|
|
|
my $proc = $self->{proc}; |
|
0
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
my $disp = $wp->enabled ? 'y ' : 'n '; |
|
0
|
0
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $mess = sprintf('%-4dwatchpoint %s %s', $wp->id, $disp, $wp->expr); |
|
0
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
$proc->msg($mess); |
|
0
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
|
if ($wp->hits > 0) { |
|
0
|
0
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
|
my $ss = ($wp->hits > 1) ? 's' : ''; |
|
0
|
0
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
my $msg = sprintf("\twatchpoint already hit %d time%s", |
|
0
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
$wp->hits, $ss); |
79
|
0
|
|
|
|
|
|
$proc->msg($msg); |
|
0
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub run($$) { |
84
|
0
|
|
|
0
|
|
|
my ($self, $args) = @_; |
|
0
|
|
|
0
|
|
|
|
85
|
0
|
|
|
|
|
|
my $proc = $self->{proc}; |
|
0
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my $watchmgr = $proc->{dbgr}{watch}; |
|
0
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
my @args = @$args; |
|
0
|
|
|
|
|
|
|
88
|
0
|
0
|
|
|
|
|
if (scalar(@args) > 2) { |
|
0
|
0
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
shift @args; shift @args; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
for my $wp_name (@args) { |
|
0
|
|
|
|
|
|
|
91
|
0
|
0
|
|
|
|
|
if ($watchmgr->find_by_name({$wp_name})) { |
|
0
|
0
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
$self->wpprint($wp_name); |
|
0
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
} else { |
94
|
0
|
|
|
|
|
|
$proc->msg("$wp_name is not a defined watchpoint"); |
|
0
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} else { |
98
|
0
|
|
|
|
|
|
my @watchpoints = $watchmgr->list; |
|
0
|
|
|
|
|
|
|
99
|
0
|
0
|
|
|
|
|
if (scalar @watchpoints == 0) { |
|
0
|
0
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
$proc->msg("No watch expressions defined."); |
|
0
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
} else { |
102
|
|
|
|
|
|
|
# There's at least one |
103
|
0
|
|
|
|
|
|
$proc->section("Num Type Enb Expression"); |
|
0
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
for my $wp (@watchpoints) { |
|
0
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
$self->wpprint($wp); |
|
0
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
unless(caller) { |
112
|
|
|
|
|
|
|
# Demo it. |
113
|
|
|
|
|
|
|
# require_relative '../../mock'; |
114
|
|
|
|
|
|
|
# my $cmd = MockDebugger::sub_setup(__PACKAGE__); |
115
|
|
|
|
|
|
|
# my $cmd->run($cmd->{prefix} + %w(u foo)); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
1; |