Debian Codegraph @

src/scripttools/debugging/scripts/commands/clear.qs

raw
1 name = "clear";
2
3 group = "breakpoints";
4
5 shortDescription = "Clear breakpoint at specified location";
6
7 longDescription = "clear <file>:<line> : Clear breakpoints at the given location.";
8 longDescription += "\nclear <line> : Clear breakpoints at the given line of the current script.";
9
10 seeAlso = [ "delete" ];
11
12 argumentTypes = [ "script-filename" ];
13
14 function execute() {
15 if (arguments.length == 0) {
16 message("Missing argument.");
17 return;
18 }
19 var arg = arguments[0];
20 var colonIndex = arg.lastIndexOf(':');
21 if (colonIndex == -1) {
22 lineNumber = parseInt(arg);
23 if (isNaN(lineNumber)) {
24 message("Breakpoint location must be of the form <file>:<line> or <line>.");
25 return;
26 }
27 var sid = getCurrentScriptId();
28 if (sid == -1) {
29 message("No script.");
30 return;
31 }
32 scriptId = sid;
33 } else {
34 fileName = arg.slice(0, colonIndex);
35 lineNumber = parseInt(arg.slice(colonIndex+1));
36 }
37 scheduleGetBreakpoints();
38 state = 1;
39 }
40
41 function handleResponse(resp) {
42 if (state == 1) {
43 var breakpoints = resp.result;
44 if (breakpoints == undefined)
45 return;
46 for (var id in breakpoints) {
47 var data = breakpoints[id];
48 if ((data.lineNumber == lineNumber)
49 && (data.fileName == fileName)
50 || ((data.scriptId != -1) && (data.scriptId = scriptId))) {
51 scheduleDeleteBreakpoint(id);
52 message("Deleted breakpoint " + id + ".");
53 }
54 }
55 state = 2;
56 } else if (state == 2) {
57
58 }
59 }