0
|
1 |
name = "enable";
|
|
2 |
|
|
3 |
group = "breakpoints";
|
|
4 |
|
|
5 |
shortDescription = "Enable breakpoint(s)";
|
|
6 |
|
|
7 |
longDescription = "enable <breakpoint-id> : Enable the breakpoint with the given id.";
|
|
8 |
|
|
9 |
seeAlso = [ "disable" ];
|
|
10 |
|
|
11 |
function execute() {
|
|
12 |
if (arguments.length == 0) {
|
|
13 |
// enable all breakpoints
|
|
14 |
state = 1;
|
|
15 |
scheduleGetBreakpoints();
|
|
16 |
} else {
|
|
17 |
var id = parseInt(arguments[0]);
|
|
18 |
if (isNaN(id)) {
|
|
19 |
message("Breakpoint id expected.");
|
|
20 |
return;
|
|
21 |
}
|
|
22 |
scheduleGetBreakpointData(id);
|
|
23 |
breakpointId = id;
|
|
24 |
state = 3;
|
|
25 |
}
|
|
26 |
};
|
|
27 |
|
|
28 |
function handleResponse(resp) {
|
|
29 |
if (state == 1) {
|
|
30 |
var breakpoints = resp.result;
|
|
31 |
if (breakpoints == undefined)
|
|
32 |
return;
|
|
33 |
for (var id in breakpoints) {
|
|
34 |
var data = breakpoints[id];
|
|
35 |
if (!data.enabled) {
|
|
36 |
data.enabled = true;
|
|
37 |
scheduleSetBreakpointData(id, data);
|
|
38 |
}
|
|
39 |
}
|
|
40 |
state = 2;
|
|
41 |
} else if (state == 2) {
|
|
42 |
state = 0;
|
|
43 |
} else if (state == 3) {
|
|
44 |
var data = resp.result;
|
|
45 |
if (data == undefined) {
|
|
46 |
message("No breakpoint number " + breakpointId + ".");
|
|
47 |
return;
|
|
48 |
} else if (!data.enabled) {
|
|
49 |
data.enabled = true;
|
|
50 |
scheduleSetBreakpointData(breakpointId, data);
|
|
51 |
state = 4;
|
|
52 |
}
|
|
53 |
} else if (state == 4) {
|
|
54 |
state = 0;
|
|
55 |
}
|
|
56 |
}
|