src/scripttools/debugging/scripts/commands/ignore.qs
changeset 0 1918ee327afb
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 name = "ignore";
       
     2 
       
     3 group = "breakpoints";
       
     4 
       
     5 shortDescription = "Set ignore-count of a breakpoint";
       
     6 
       
     7 longDescription = "ignore <breakpoint-id> <count> : Ignores the breakpoint with the given id the next count times it is hit.";
       
     8 
       
     9 seeAlso = [ "condition" ];
       
    10 
       
    11 function execute() {
       
    12     if (arguments.length < 1) {
       
    13         message("Missing arguments (breakpoing number and ignore-count).");
       
    14         return;
       
    15     }
       
    16     if (arguments.length < 2) {
       
    17         message("Missing argument (ignore-count).");
       
    18         return;
       
    19     }
       
    20     var id = parseInt(arguments[0]);
       
    21     if (isNaN(id)) {
       
    22         message("First argument (breakpoint id) must be a number.");
       
    23         return;
       
    24     }
       
    25     var count = parseInt(arguments[1]);
       
    26     if (isNaN(count)) {
       
    27         message("Second argument (ignore-count) must be a number.");
       
    28         return;
       
    29     }
       
    30     scheduleGetBreakpointData(id);
       
    31     breakpointId = id;
       
    32     if (count < 0)
       
    33         count = 0;
       
    34     ignoreCount = count;
       
    35     state = 1;
       
    36 }
       
    37 
       
    38 function handleResponse(resp) {
       
    39     if (state == 1) {
       
    40         var data = resp.result;
       
    41         if (data == undefined) {
       
    42             message("No breakpoint number " + breakpointId + ".");
       
    43             return;
       
    44         }
       
    45         data.ignoreCount = ignoreCount;
       
    46         scheduleSetBreakpointData(breakpointId, data);
       
    47         state = 2;
       
    48     } else if (state == 2) {
       
    49         message("Breakpoint " + breakpointId + " will be ignored the next " + ignoreCount + " time(s).");
       
    50     }
       
    51 }