Commits

sk  committed 93c780c

Fixed inspector bugs.

  • Participants
  • Parent commits b697efb

Comments (0)

Files changed (3)

File src/org/lispdev/swank/LispImplementation.java

 import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.DebugException;
 import org.lispdev.console.core.IPartitionData;
 import org.lispdev.log.Log;
+import org.lispdev.log.Trace;
 import org.lispdev.swank.debug.LispDebugTarget;
 import org.lispdev.swank.debug.LispValue;
 import org.lispdev.swank.debug.LispVariable;
     }
 
     @Override
-    public InspectInfo inspect(LispVariable parent)
+    public InspectInfo inspect(LispValue parent)
     {
+      try
+      {
+        int nn = Integer.parseInt(n);
+      }
+      catch(NumberFormatException e)
+      {
+        Log.logException("Cannot inspect part " + n, e);
+        return null;
+      }
       LispNode r = target.getSwank().inspectNthPart(n, 500);
       return getInspectInfo(target, parent, r);
     }
    */
   /**
    * @param target
-   * @param parent variable containing other variables described in n
-   * @param n contains information about variables in parent
+   * @param parent value containing other variables described in n
+   * @param n contains information about variables contained in parent
+   * and some additional information about parent
    */
   private static InspectInfo getInspectInfo(final LispDebugTarget target,
-      final LispVariable parent, LispNode n)
+      final LispValue parent, LispNode n)
   {
     InspectInfo res = new InspectInfo(n.getf(":title").value,
         n.getf(":title").value);
     LispNode c = n.getf(":content").get(0);
     if( "Class: ".equalsIgnoreCase(c.get(0).value) )
     {
-      try
-      {
-        res.content.add(new LispVariable(target,
-            (LispValue)parent.getValue(),"Class",
-            c.get(1).getf(":value").value,
-            new InspectNthPart(target, c.get(1).get(2).value)));
-      }
-      catch(DebugException e)
-      {
-        Log.logException(e);
-      }
+      res.content.add(new LispVariable(target,parent,"Class",
+          c.get(1).getf(":value").value,
+          new InspectNthPart(target, c.get(1).get(2).value)));
       for( int i = 2; i < c.getParamsCount(); ++i )
       {
         if( c.get(i).value.equals(" = ") )
         {
-          try
-          {
-            res.content.add(new LispVariable(target,
-                (LispValue)parent.getValue(),c.get(i-2).getf(":value").value,
-                (c.get(i+1).isString ? c.get(i+1).value
-                                     : c.get(i+1).getf(":value").value),
-                new InspectNthPart(target, c.get(i+1).get(2).value)));
-          }
-          catch(DebugException e)
-          {
-            Log.logException("", e);
-          }
+          res.content.add(new LispVariable(target,
+              parent,c.get(i-2).getf(":value").value,
+              (c.get(i+1).isString ? c.get(i+1).value
+                                   : c.get(i+1).getf(":value").value),
+              new InspectNthPart(target, c.get(i+1).get(2).value)));
         }
       }
       return res;
     {
       if( c.get(j).value.startsWith(":") )
       {
-        try
-        {
-          res.content.add(new LispVariable(target,
-              (LispValue)parent.getValue(),c.get(j-1).value,
-              c.get(j+1).getf(":value").value,
-              new InspectNthPart(target, c.get(j+1).get(2).value)));
-        }
-        catch(DebugException e)
-        {
-          Log.logException("", e);
-        }
+        res.content.add(new LispVariable(target,
+            parent,c.get(j-1).value,
+            c.get(j+1).getf(":value").value,
+            new InspectNthPart(target, c.get(j+1).get(2).value)));
       }
     }
     return res;
       final IInspectCmd cmd = new IInspectCmd()
       {
         @Override
-        public InspectInfo inspect(final LispVariable parent)
+        public InspectInfo inspect(final LispValue parent)
         {
           LispNode r = swank.getInspectFrameLocal(thread, frame,
               String.valueOf(ii), 500);
     {
       return null;
     }
+    Trace.DEBUG.trace("Inspecting "+name);
     final ISwank swank = target.getSwank();
     final IInspectCmd cmd = new IInspectCmd()
     {
       @Override
-      public InspectInfo inspect(final LispVariable parent)
+      public InspectInfo inspect(final LispValue parent)
       {
         final LispNode r = swank.inspectReplResult(data.getId(), 500);
         return getInspectInfo(target, parent, r);

File src/org/lispdev/swank/debug/LispValue.java

 import org.eclipse.debug.core.DebugException;
 import org.eclipse.debug.core.model.IValue;
 import org.eclipse.debug.core.model.IVariable;
+import org.lispdev.log.Trace;
 import org.lispdev.swank.debug.LispVariable.IInspectCmd;
 import org.lispdev.swank.debug.LispVariable.InspectInfo;
 
       {
         parent.getParent().runInspect();
       }
-      info = inspect.inspect(parent);
+      try
+      {
+        Trace.DEBUG.trace("Inspecting "+parent.getName());
+      }
+      catch(DebugException e)
+      {
+        e.printStackTrace();
+      }
+      info = inspect.inspect(this);
     }
   }
 
   @Override
   public String getReferenceTypeName() throws DebugException
   {
-    if( info == null )
-    {
-      runInspect();
-    }
-    return (info == null ? "" : info.type);
+    return "lisp";
   }
 
   @Override
   @Override
   public boolean hasVariables() throws DebugException
   {
-    if( info == null )
-    {
-      runInspect();
-    }
-    return info != null;
+    return true;
   }
 
   @Override
   public String toString()
   {
-    if( info == null )
-    {
-      runInspect();
-    }
     return (info == null ? value : info.title);
   }
 

File src/org/lispdev/swank/debug/LispVariable.java

 
   public static interface IInspectCmd
   {
-    public InspectInfo inspect(LispVariable parent);
+    public InspectInfo inspect(LispValue parent);
   }
 
   public LispVariable(LispDebugTarget target, LispValue parent,