src/scripttools/debugging/scripts/commands/frame.qs
changeset 0 1918ee327afb
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 name = "frame";
       
     2 
       
     3 group = "stack";
       
     4 
       
     5 shortDescription = "Select and print a stack frame";
       
     6 
       
     7 longDescription = "";
       
     8 
       
     9 aliases = [ "f" ];
       
    10 
       
    11 function execute() {
       
    12     if (arguments.length == 0)
       
    13         requestedFrameIndex = getCurrentFrameIndex();
       
    14     else
       
    15         requestedFrameIndex = parseInt(arguments[0]);
       
    16     scheduleGetContextInfo(requestedFrameIndex);
       
    17     state = 1;
       
    18 };
       
    19 
       
    20 function handleResponse(resp, id) {
       
    21     if (state == 1) {
       
    22         var info = resp.result;
       
    23         if (info == undefined) {
       
    24             message("Frame index out of range.");
       
    25             return;
       
    26         }
       
    27         setCurrentFrameIndex(requestedFrameIndex);
       
    28         setCurrentScriptId(info.scriptId);
       
    29         setCurrentLineNumber(info.lineNumber);
       
    30         scheduleGetBacktrace();
       
    31         state = 2;
       
    32     } else if (state == 2) {
       
    33         var backtrace = resp.result;
       
    34         message("#" + getCurrentFrameIndex() + "  " + backtrace[getCurrentFrameIndex()]);
       
    35     }
       
    36 }