line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Devel::ebug::Wx::View::Breakpoints; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1730
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
4
|
1
|
|
|
1
|
|
7
|
use base qw(Wx::ScrolledWindow Devel::ebug::Wx::View::Base); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
744
|
|
5
|
|
|
|
|
|
|
use Devel::ebug::Wx::Plugin qw(:plugin); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( qw(panes sizer) ); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Wx qw(:sizer); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub tag { 'breakpoints' } |
12
|
|
|
|
|
|
|
sub description { 'Breakpoints' } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new : View { |
15
|
|
|
|
|
|
|
my( $class, $parent, $wxebug, $layout_state ) = @_; |
16
|
|
|
|
|
|
|
my $self = $class->SUPER::new( $parent, -1 ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$self->wxebug( $wxebug ); |
19
|
|
|
|
|
|
|
$self->panes( [] ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$self->subscribe_ebug( 'break_point', sub { $self->_add_bp( @_ ) } ); |
22
|
|
|
|
|
|
|
$self->subscribe_ebug( 'break_point_delete', sub { $self->_del_bp( @_ ) } ); |
23
|
|
|
|
|
|
|
$self->subscribe_ebug( 'load_program_state', sub { $self->load_all_breakpoints } ); |
24
|
|
|
|
|
|
|
$self->set_layout_state( $layout_state ) if $layout_state; |
25
|
|
|
|
|
|
|
$self->register_view; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $sizer = Wx::BoxSizer->new( wxVERTICAL ); |
28
|
|
|
|
|
|
|
$self->SetSizer( $sizer ); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$self->sizer( $sizer ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$self->load_all_breakpoints if $wxebug->ebug->is_running; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$self->SetSize( $self->default_size ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return $self; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub load_all_breakpoints { |
40
|
|
|
|
|
|
|
my( $self ) = @_; |
41
|
|
|
|
|
|
|
my $wxebug = $self->wxebug; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
foreach my $pane ( @{$self->panes} ) { |
44
|
|
|
|
|
|
|
$self->sizer->Detach( $pane ); |
45
|
|
|
|
|
|
|
$pane->Destroy; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
$self->{panes} = []; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$self->_add_bp( $wxebug->ebug, undef, |
50
|
|
|
|
|
|
|
file => $_->{filename}, |
51
|
|
|
|
|
|
|
line => $_->{line}, |
52
|
|
|
|
|
|
|
condition => $_->{condition}, |
53
|
|
|
|
|
|
|
) foreach $wxebug->ebug->all_break_points_with_condition; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub _compare { |
57
|
|
|
|
|
|
|
my( $x, $y ) = @_; |
58
|
|
|
|
|
|
|
my $fc = $x->{file} cmp $y->{file}; |
59
|
|
|
|
|
|
|
return $fc if $fc != 0; |
60
|
|
|
|
|
|
|
return $x->{line} <=> $y->{line}; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _add_bp { |
64
|
|
|
|
|
|
|
my( $self, $ebug, $event, %params ) = @_; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my( $index, $order ); |
67
|
|
|
|
|
|
|
for( $index = 0; $index < @{$self->panes}; ++$index ) { |
68
|
|
|
|
|
|
|
$order = _compare( \%params, $self->panes->[$index] ); |
69
|
|
|
|
|
|
|
return if $order == 0; |
70
|
|
|
|
|
|
|
last if $order < 0; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
my $pane = Devel::ebug::Wx::Breakpoints::Pane->new( $self, \%params ); |
73
|
|
|
|
|
|
|
splice @{$self->panes}, $index, 0, $pane; |
74
|
|
|
|
|
|
|
$self->sizer->Insert( $index, $pane, 0, wxGROW ); |
75
|
|
|
|
|
|
|
$self->SetScrollRate( 0, $pane->GetSize->y ); |
76
|
|
|
|
|
|
|
# force relayout and reset virtual size |
77
|
|
|
|
|
|
|
$self->Layout; |
78
|
|
|
|
|
|
|
$self->SetSize( $self->GetSize ); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub _del_bp { |
82
|
|
|
|
|
|
|
my( $self, $ebug, $event, %params ) = @_; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $index; |
85
|
|
|
|
|
|
|
for( $index = 0; $index < @{$self->panes}; ++$index ) { |
86
|
|
|
|
|
|
|
last if _compare( \%params, $self->panes->[$index] ) == 0; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
my $pane = $self->panes->[$index]; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
splice @{$self->panes}, $index, 1; |
91
|
|
|
|
|
|
|
$self->sizer->Detach( $pane ); |
92
|
|
|
|
|
|
|
$pane->Destroy; |
93
|
|
|
|
|
|
|
# force relayout and reset virtual size |
94
|
|
|
|
|
|
|
$self->Layout; |
95
|
|
|
|
|
|
|
$self->SetSize( $self->GetSize ); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub delete { |
99
|
|
|
|
|
|
|
my( $self, $pane ) = @_; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
$self->ebug->break_point_delete( $pane->file, $pane->line ); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub go_to { |
105
|
|
|
|
|
|
|
my( $self, $pane ) = @_; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
$self->wxebug->code_display_service |
108
|
|
|
|
|
|
|
->highlight_line( $pane->file, $pane->line ); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub set_condition { |
112
|
|
|
|
|
|
|
my( $self, $pane, $condition ) = @_; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
$self->ebug->ebug->break_point( $pane->file, $pane->line, $condition ); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
package Devel::ebug::Wx::Breakpoints::Pane; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
use strict; |
120
|
|
|
|
|
|
|
use base qw(Wx::Panel Class::Accessor::Fast); |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( qw(controls file line) ); |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
use File::Basename qw(basename); |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
use Wx qw(:sizer); |
127
|
|
|
|
|
|
|
use Wx::Event qw(EVT_BUTTON EVT_TEXT); |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub new { |
130
|
|
|
|
|
|
|
my( $class, $parent, $args ) = @_; |
131
|
|
|
|
|
|
|
my $self = $class->SUPER::new( $parent ); |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
my $bp_label = Wx::StaticText->new( $self, -1, '' ); |
134
|
|
|
|
|
|
|
my $goto = Wx::Button->new( $self, -1, 'Go to' ); |
135
|
|
|
|
|
|
|
my $delete = Wx::Button->new( $self, -1, 'Delete' ); |
136
|
|
|
|
|
|
|
my $cnd_label = Wx::StaticText->new( $self, -1, 'Cond:' ); |
137
|
|
|
|
|
|
|
my $condition = Wx::TextCtrl->new( $self, -1, '' ); |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
$self->{controls} = { label => $bp_label, |
140
|
|
|
|
|
|
|
condition => $condition, |
141
|
|
|
|
|
|
|
}; |
142
|
|
|
|
|
|
|
$self->{file} = $args->{file}; |
143
|
|
|
|
|
|
|
$self->{line} = $args->{line}; |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
$self->display_bp( $args ); |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
my $topsz = Wx::BoxSizer->new( wxVERTICAL ); |
148
|
|
|
|
|
|
|
my $fsz = Wx::BoxSizer->new( wxHORIZONTAL ); |
149
|
|
|
|
|
|
|
my $ssz = Wx::BoxSizer->new( wxHORIZONTAL ); |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
$fsz->Add( $bp_label, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 2 ); |
152
|
|
|
|
|
|
|
$fsz->Add( $delete, 0, 0 ); |
153
|
|
|
|
|
|
|
$fsz->Add( $goto, 0, wxRIGHT, 2 ); |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
$ssz->Add( $cnd_label, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 2 ); |
156
|
|
|
|
|
|
|
$ssz->Add( $condition, 1, wxRIGHT, 2 ); |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
$topsz->Add( $fsz, 0, wxGROW ); |
159
|
|
|
|
|
|
|
$topsz->Add( $ssz, 0, wxGROW ); |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
$self->SetSizerAndFit( $topsz ); |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
EVT_BUTTON( $self, $goto, sub { $self->GetParent->go_to( $self ) } ); |
164
|
|
|
|
|
|
|
EVT_BUTTON( $self, $delete, sub { $self->GetParent->delete( $self ) } ); |
165
|
|
|
|
|
|
|
EVT_TEXT( $self, $condition, sub { $self->GetParent->set_condition( $self, $condition->GetValue ) } ); |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
return $self; |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
sub display_bp { |
171
|
|
|
|
|
|
|
my( $self, $args ) = @_; |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
my $text = basename( $args->{file} ) . ': ' . $args->{line}; |
174
|
|
|
|
|
|
|
my $cond = $args->{condition} || ''; |
175
|
|
|
|
|
|
|
$self->controls->{label}->SetLabel( $text ); |
176
|
|
|
|
|
|
|
$self->controls->{condition}->SetValue( $cond eq '1' ? '' : $cond ); |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
1; |