src/scripttools/debugging/scripts/commands/down.qs
author Eckhart Koeppen <eckhart.koppen@nokia.com>
Thu, 29 Apr 2010 15:15:16 +0300 (2010-04-29)
branchRCL_3
changeset 17 4b6ee5efea19
parent 0 1918ee327afb
permissions -rw-r--r--
2010-17 9996a03743ab23f83c83c5bc7ade0f82f71b1506
name = "down";

group = "stack";

shortDescription = "Select and print the stack frame below the current one";

longDescription = "";

seeAlso = [ "up", "frame" ];

function execute() {
    var idx = getCurrentFrameIndex();
    if (idx == 0) {
        warning("Already at bottom (innermost) frame.");
        return;
    }
    setCurrentFrameIndex(idx - 1);
    scheduleGetContextInfo(idx - 1);
    state = 1;
}

function handleResponse(resp, id) {
    if (state == 1) {
        var info = resp.result;
        setCurrentScriptId(info.scriptId);
        setCurrentLineNumber(info.lineNumber);
        scheduleGetBacktrace();
        state = 2;
    } else if (state == 2) {
        var backtrace = resp.result;
        message("#" + getCurrentFrameIndex() + "  " + backtrace[getCurrentFrameIndex()]);
    }
}