line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
1018
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
49
|
|
2
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
80
|
|
3
|
|
|
|
|
|
|
package Devel::Debug::Server::Client; |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
589
|
use Devel::Debug::Server; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#Abstract the client module pour the GUI or CLI client |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head2 refreshData |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
return all data necessary to display screen |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
sub refreshData { |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $req = { type => $Devel::Debug::Server::DEBUG_GUI_TYPE |
17
|
|
|
|
|
|
|
}; |
18
|
|
|
|
|
|
|
return sendCommand($req); #we just send a void command |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 sendCommand |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
send a command to the debug server to process whose pid is $pid. |
24
|
|
|
|
|
|
|
Returns the debug informations of the server. |
25
|
|
|
|
|
|
|
The command is of the form: |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
{ |
28
|
|
|
|
|
|
|
command => $commandCode, |
29
|
|
|
|
|
|
|
arg1 => $firstArg, #if needed |
30
|
|
|
|
|
|
|
arg2 => $secondArg,#if needed |
31
|
|
|
|
|
|
|
arg3 => $thirdArg,#if needed |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
36
|
|
|
|
|
|
|
sub sendCommand { |
37
|
|
|
|
|
|
|
my($pid,$command)= @_; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Devel::Debug::Server::initZeroMQ(); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $req = { type => $Devel::Debug::Server::DEBUG_GUI_TYPE, |
42
|
|
|
|
|
|
|
command => $command, |
43
|
|
|
|
|
|
|
pid=> $pid, |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
my $answer = Devel::Debug::Server::send($req); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
return $answer; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 step |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
step($pid) : send the step command to the processus of pid $pid |
54
|
|
|
|
|
|
|
Return the debug informations |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
sub step { |
58
|
|
|
|
|
|
|
my ($pid) = @_; |
59
|
|
|
|
|
|
|
return Devel::Debug::Server::Client::sendCommand($pid, |
60
|
|
|
|
|
|
|
{ |
61
|
|
|
|
|
|
|
command => $Devel::Debug::Server::STEP_COMMAND, |
62
|
|
|
|
|
|
|
}); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 breakpoint |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
breakpoint($file,$line) : set breakpoint |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
sub breakPoint { |
72
|
|
|
|
|
|
|
my ($filePath,$lineNumber) = @_; |
73
|
|
|
|
|
|
|
return Devel::Debug::Server::Client::sendCommand(undef, |
74
|
|
|
|
|
|
|
{ |
75
|
|
|
|
|
|
|
command => $Devel::Debug::Server::SET_BREAKPOINT_COMMAND, |
76
|
|
|
|
|
|
|
arg1 => $filePath, |
77
|
|
|
|
|
|
|
arg2 => $lineNumber, |
78
|
|
|
|
|
|
|
}); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 removeBreakPoint |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
removeBreakPoint($file,$line) |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
sub removeBreakPoint { |
87
|
|
|
|
|
|
|
my ($file,$line) = @_; |
88
|
|
|
|
|
|
|
return Devel::Debug::Server::Client::sendCommand(undef, |
89
|
|
|
|
|
|
|
{ |
90
|
|
|
|
|
|
|
command => $Devel::Debug::Server::REMOVE_BREAKPOINT_COMMAND, |
91
|
|
|
|
|
|
|
arg1 => $file, |
92
|
|
|
|
|
|
|
arg2 => $line, |
93
|
|
|
|
|
|
|
}); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 run |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
run() : continue program execution until breakpoint |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
101
|
|
|
|
|
|
|
sub run { |
102
|
|
|
|
|
|
|
my ($pid) = @_; |
103
|
|
|
|
|
|
|
return Devel::Debug::Server::Client::sendCommand($pid, |
104
|
|
|
|
|
|
|
{ command => $Devel::Debug::Server::RUN_COMMAND, }); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 suspend |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
suspend the running process |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
sub suspend { |
113
|
|
|
|
|
|
|
my ($pid) = @_; |
114
|
|
|
|
|
|
|
return Devel::Debug::Server::Client::sendCommand($pid, |
115
|
|
|
|
|
|
|
{ command => $Devel::Debug::Server::SUSPEND_COMMAND }); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
=head2 return |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
return($pid,$returnedValue) : cause script of pid $pid to return of current subroutine. Optionnaly you can specify the value returned with $returnedValue. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |
122
|
|
|
|
|
|
|
sub return { |
123
|
|
|
|
|
|
|
my ($pid,$returnedValue) = @_; |
124
|
|
|
|
|
|
|
my $command = { command => $Devel::Debug::Server::RETURN_COMMAND} ; |
125
|
|
|
|
|
|
|
if (defined $returnedValue){ |
126
|
|
|
|
|
|
|
$command ={ command => $Devel::Debug::Server::RETURN_COMMAND, |
127
|
|
|
|
|
|
|
arg1 => $returnedValue}; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
return Devel::Debug::Server::Client::sendCommand($pid,$command); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 eval |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
eval($pid,$expression) : eval perl code contained into $expression in the script of pid $pid and returns the result |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |
138
|
|
|
|
|
|
|
sub eval { |
139
|
|
|
|
|
|
|
my ($pid,$expression) = @_; |
140
|
|
|
|
|
|
|
return Devel::Debug::Server::Client::sendCommand($pid, |
141
|
|
|
|
|
|
|
{ command => $Devel::Debug::Server::EVAL_COMMAND, |
142
|
|
|
|
|
|
|
arg1 => $expression }); |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
1; |