Commits

sk  committed 7ca34f0

Refactored debugger to use custom SwankDebugInfo structure instead of LispNode returned by swank.

  • Participants
  • Parent commits 3407ec9

Comments (0)

Files changed (3)

File META-INF/MANIFEST.MF

 Bundle-Activator: org.lispdev.repl.ReplPlugin
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
- org.lispdev.swank;bundle-version="1.0.0"
+ org.lispdev.swank;bundle-version="1.0.0",
+ org.lispdev.log;bundle-version="1.0.0"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Export-Package: org.lispdev.repl

File src/org/lispdev/repl/AbstractRepl.java

 import java.util.Hashtable;
 import java.util.Stack;
 
+import org.lispdev.log.Trace;
 import org.lispdev.swank.ISwank;
-import org.lispdev.swank.LispNode;
+import org.lispdev.swank.SwankDebugInfo;
 import org.lispdev.swank.SwankEvent;
 import org.lispdev.swank.SwankRunnable;
 
     }
   }
 
-  private final Hashtable<String, LispNode> debugInfos =
-    new Hashtable<String, LispNode>();
+  private final Hashtable<String, SwankDebugInfo> debugInfos =
+    new Hashtable<String, SwankDebugInfo>();
 
   private class DebugInfoRunnable extends SwankRunnable
   {
     public void run()
     {
       String key = result.get(1).value + ":" + result.get(2).value;
-      System.out.println("DebugInfoRunnable: "+result.toString());
-      debugInfos.put(key, result);
+      Trace.DEBUG.trace("DebugInfoRunnable: "+result.toString());
+      debugInfos.put(key, swank.getLispImplementation().getDebugInfo(result));
     }
   }
 
     public void run()
     {
       String key = result.get(1).value + ":" + result.get(2).value;
-      System.out.println("*debug found: " + key + "->" + debugInfos.get(key));
-      pushDebugState(debugInfos.get(key));
+      Trace.DEBUG.trace("*debug found: " + key + "->" + debugInfos.get(key));
+      pushDebugState( debugInfos.get(key));
     }
   }
 
-  private void pushDebugState(LispNode debugInfo)
+  private void pushDebugState(SwankDebugInfo debugInfo)
   {
     DebugState state = new DebugState(this, debugInfo);
-    System.out.println("currState:" + currState());
+    Trace.DEBUG.trace("currState:" + currState());
     if( !currState().equals(state) )
     {
       pushState(state);
   public abstract void disconnecting();
   public abstract void connected();
   public abstract void connecting();
-  public abstract void startDebug(LispNode debugInfo);
+  public abstract void startDebug(SwankDebugInfo debugInfo);
   public abstract void debugStoped();
 
   private void pushState(IState s)

File src/org/lispdev/repl/DebugState.java

 package org.lispdev.repl;
 
-import org.lispdev.swank.LispNode;
+import org.lispdev.swank.SwankDebugInfo;
 
 public class DebugState implements IState
 {
   private final AbstractRepl repl;
-  private final LispNode desc, options, backtrace, debugInfo;
-  private final String thread, level;
+  private final SwankDebugInfo debugInfo;
 
-  public DebugState(AbstractRepl r, LispNode debugInfo)
+  public DebugState(AbstractRepl r, SwankDebugInfo debugInfo)
   {
     repl = r;
     this.debugInfo = debugInfo;
-    thread = debugInfo.get(1).value;
-    level = debugInfo.get(2).value;
-
-    desc = debugInfo.get(3);
-    options = debugInfo.get(4);
-    backtrace = debugInfo.get(5);
   }
 
   @Override
     if( obj instanceof DebugState )
     {
       DebugState state = (DebugState)obj;
-      return (thread.equals(state.thread) && level.equals(state.level));
+      return state.debugInfo.equals(debugInfo);
     }
     return false;
   }