src/scripttools/debugging/scripts/commands/up.qs
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 19 Feb 2010 23:40:16 +0200
branchRCL_3
changeset 4 3b1da2848fc7
parent 0 1918ee327afb
permissions -rw-r--r--
Revision: 201003 Kit: 201007

name = "up";

group = "stack";

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

longDescription = "";

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

function execute() {
    scheduleGetContextCount();
    state = 1;
}

function handleResponse(resp) {
    if (state == 1) {
        var count = resp.result;
        var idx = getCurrentFrameIndex() + 1;
        if (idx == count) {
            warning("Already at top (outermost) frame.");
            return;
        }
        setCurrentFrameIndex(idx);
        scheduleGetContextInfo(idx);
        state = 2;
    } else if (state == 2) {
        var info = resp.result;
        setCurrentScriptId(info.scriptId);
        setCurrentLineNumber(info.lineNumber);
        scheduleGetBacktrace();
        state = 3;
    } else if (state == 3) {
        var backtrace = resp.result;
        message("#" + getCurrentFrameIndex() + "  " + backtrace[getCurrentFrameIndex()]);
    }
}