summaryrefslogtreecommitdiffstats
path: root/src/scripttools/debugging/scripts/commands/down.qs
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripttools/debugging/scripts/commands/down.qs')
-rw-r--r--src/scripttools/debugging/scripts/commands/down.qs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/scripttools/debugging/scripts/commands/down.qs b/src/scripttools/debugging/scripts/commands/down.qs
new file mode 100644
index 0000000..dc0429b
--- /dev/null
+++ b/src/scripttools/debugging/scripts/commands/down.qs
@@ -0,0 +1,33 @@
+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()]);
+ }
+}