src/scripttools/debugging/scripts/commands/frame.qs
author Eckhart Koeppen <eckhart.koppen@nokia.com>
Wed, 21 Apr 2010 12:15:23 +0300 (2010-04-21)
branchRCL_3
changeset 13 cc75c76972ee
parent 0 1918ee327afb
permissions -rw-r--r--
a69086a7359b3de9db0823ce58d9aab8b5c369be
name = "frame";

group = "stack";

shortDescription = "Select and print a stack frame";

longDescription = "";

aliases = [ "f" ];

function execute() {
    if (arguments.length == 0)
        requestedFrameIndex = getCurrentFrameIndex();
    else
        requestedFrameIndex = parseInt(arguments[0]);
    scheduleGetContextInfo(requestedFrameIndex);
    state = 1;
};

function handleResponse(resp, id) {
    if (state == 1) {
        var info = resp.result;
        if (info == undefined) {
            message("Frame index out of range.");
            return;
        }
        setCurrentFrameIndex(requestedFrameIndex);
        setCurrentScriptId(info.scriptId);
        setCurrentLineNumber(info.lineNumber);
        scheduleGetBacktrace();
        state = 2;
    } else if (state == 2) {
        var backtrace = resp.result;
        message("#" + getCurrentFrameIndex() + "  " + backtrace[getCurrentFrameIndex()]);
    }
}