From 5f09b5a930e81c35cea0c067ad4d13f2a8dce6f5 Mon Sep 17 00:00:00 2001 From: robekras Date: Sun, 16 Oct 2005 18:19:32 +0000 Subject: [PATCH] 1) getVariables returns variables as a vector list. 2) Replicate the index number of the stackframes 3) Sort the 'static' stackframe list by their index numbers. Necessary because the UI will not step into a source file if sorting of stackframes is not in correct order. 4) Modified comments for updateStackFrameList. --- .../phpdt/internal/debug/core/PHPDBGInterface.java | 25 ++++++++++++++++--- 1 files changed, 21 insertions(+), 4 deletions(-) diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java index 957c86e..d0576f9 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java @@ -15,6 +15,7 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.OutputStream; import java.util.Vector; +import java.util.Collections; import net.sourceforge.phpdt.internal.debug.core.model.PHPDBGEvalString; import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame; @@ -491,7 +492,7 @@ public class PHPDBGInterface { * @param stack The stackframe for which we want the variables. * @return The array of variables */ - public PHPVariable[] getVariables (PHPStackFrame stack) throws IOException, DebugException { + public Vector getVariables (PHPStackFrame stack) throws IOException, DebugException { PHPDBGPacket DBGPacket; PHPDBGFrame DBGFrame1; PHPDBGEvalString evalStr; @@ -516,7 +517,7 @@ public class PHPDBGInterface { evalStr = new PHPDBGEvalString (stack, serGlobals); // Process serialized variables updateVariableList (DBGVarList, evalStr.getVariables ()); // Replicate the 'static' variable list and the via DBG received variable list - return (PHPVariable[]) DBGVarList.toArray (new PHPVariable[DBGVarList.size ()]); // Convert the list to an array and return the array + return DBGVarList; // Convert the list to an array and return the array } /** @@ -677,10 +678,23 @@ public class PHPDBGInterface { * * The stackList contains the currently read stackframes which were sent * from DBG. The DBG interface holds a list of the active stack frames. - * This method looks whether the sent stackframes are already in the list. + * This method replicates the 'static' stackframe list with the DBG stackframe list + * Replication is done in the following way: + * + * * Removes the unused stackframes from the list, or adds stackframes which * are not yet in the list. * + * * @param stackList */ private void updateStackFrameList (Vector stackList) { @@ -697,7 +711,8 @@ public class PHPDBGInterface { stackFrameOld = (PHPStackFrame) stackListOld.get (n); // --- if (stackFrameNew.getModNo () == stackFrameOld.getModNo ()) { // Did we find the sent stackframe within the list of old stackframes? - stackFrameOld.setLineNumber (stackFrameNew.getLineNumber()); + stackFrameOld.setLineNumber (stackFrameNew.getLineNumber ()); + stackFrameOld.setIndex (stackFrameNew.getIndex ()); break; // Yes, then break; } @@ -727,6 +742,8 @@ public class PHPDBGInterface { } } + Collections.sort (stackListOld); // Sort the 'static' stackframe list by the stackframe index numbers. + // newStackList = new PHPStackFrame[stackListOld.size ()]; newStackList = (PHPStackFrame[]) stackListOld.toArray (newStackList); DBGStackList = newStackList; -- 1.7.1