changeset 22006:547edc5af3fc

Some language REPLs need access to the current stack. Make the method public.
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Tue, 21 Jul 2015 17:34:08 +0200
parents 1c38917c00b2
children 12891f4cae7a
files truffle/com.oracle.truffle.tools.debug.shell/src/com/oracle/truffle/tools/debug/shell/server/REPLServerContext.java
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.tools.debug.shell/src/com/oracle/truffle/tools/debug/shell/server/REPLServerContext.java	Tue Jul 21 13:07:58 2015 +0200
+++ b/truffle/com.oracle.truffle.tools.debug.shell/src/com/oracle/truffle/tools/debug/shell/server/REPLServerContext.java	Tue Jul 21 17:34:08 2015 +0200
@@ -35,6 +35,7 @@
 import com.oracle.truffle.api.vm.TruffleVM.Language;
 import com.oracle.truffle.tools.debug.shell.*;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 public abstract class REPLServerContext {
@@ -89,7 +90,12 @@
 
     public abstract int getBreakpointID(Breakpoint breakpoint);
 
-    List<FrameDebugDescription> getStack() {
+    /**
+     * Provides access to the execution stack.
+     * 
+     * @return immutable list of stack elements
+     */
+    public List<FrameDebugDescription> getStack() {
         List<FrameDebugDescription> frames = new ArrayList<>();
         int frameCount = 1;
         for (FrameInstance frameInstance : event.getStack()) {
@@ -100,7 +106,7 @@
             }
             frameCount++;
         }
-        return frames;
+        return Collections.unmodifiableList(frames);
     }
 
     void prepareStepOut() {