X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPStackFrame.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPStackFrame.java index bbebc6a..7bede78 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPStackFrame.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPStackFrame.java @@ -6,18 +6,21 @@ which accompanies this distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html Contributors: - IBM Corporation - Initial implementation - Vicente Fernando - www.alfersoft.com.ar + IBM Corporation - Initial implementation + Vicente Fernando - www.alfersoft.com.ar **********************************************************************/ package net.sourceforge.phpdt.internal.debug.core.model; +import java.util.Arrays; +import java.util.Collections; import java.util.Vector; import net.sourceforge.phpdt.internal.debug.core.PHPDBGProxy; +import net.sourceforge.phpdt.internal.debug.core.PHPDebugCorePlugin; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.IRegisterGroup; @@ -27,20 +30,23 @@ import org.eclipse.debug.core.model.IVariable; /** * - * TODO Remove the variables array and use only the varList vector - * Have also to change hasVariables */ -public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Comparable{ - - private PHPThread thread; // The thread to which this stackframe belongs - private String file; // The file name??? - private int lineNumber; // - private int index; // - private int modno; // - private PHPVariable[] variables; // The array of variables TODO: better introduce a vector? - private Vector varList = new Vector (); - private String description; // The source file name with the full path on target/remote system - private boolean fUpToDate; // +public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Comparable { + + private PHPThread thread; // The thread to which this stackframe belongs + private String file; // The file name??? + private int lineNumber; + private int index; + private int modno; + private PHPVariable[] variables; // + private int scope_id; // scope id + private Vector varList; // Variables list + private String description; // The source file name with the full path on target/remote system + private boolean fUpToDate; // Indicates whether the variable list within this stackframe is + // up-to-date + private boolean fAvailable; // Needed when updating the stackframe list, shows whether the stackframe + // is within the list which was received from dbg + private boolean fDebug = true; /** * @@ -50,88 +56,131 @@ public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Compa * @param index * @param desc * @param modno + * @param scope_id */ - public PHPStackFrame (PHPThread thread, String file, int line, int index, String desc, int modno) { + public PHPStackFrame (PHPThread thread, String file, int line, int index, + String desc, int modno, int scope_id) { super (null); - this.lineNumber = line; - this.index = index; - this.file = file; - this.thread = thread; + this.lineNumber = line; + this.index = index; + this.file = file; + this.thread = thread; this.description = desc; - this.modno = modno; + this.modno = modno; + this.scope_id = scope_id; + this.varList = new Vector(); this.fUpToDate = false; } +// /** +// * +// * @param thread +// * @param file +// * @param line +// * @param index +// */ +// public PHPStackFrame(PHPThread thread, String file, int line, int index) { +// super(null); +// +// this.lineNumber = line; +// this.index = index; +// this.file = file; +// this.thread = thread; +// this.fUpToDate = false; +// } + /** * - * @param thread - * @param file - * @param line - * @param index + * @return scope id */ - public PHPStackFrame (PHPThread thread, String file, int line, int index) { - super (null); + public int getScopeID() { + return scope_id; + } - this.lineNumber = line; - this.index = index; - this.file = file; - this.thread = thread; - this.fUpToDate = false; + /** + * + */ + public void setScopeID(int scope_id) { + this.scope_id = scope_id; + fUpToDate = false; } /** * */ - public IThread getThread () { + public IThread getThread() { return thread; } /** * @param thread */ - public void setThread (PHPThread thread) { + public void setThread(PHPThread thread) { this.thread = thread; } +// /** +// * +// */ +// private void setUpToDate(boolean upToDate) { +// fUpToDate = upToDate; +// } + +// /** +// * +// */ +// private boolean isUpToDate() { +// return fUpToDate; +// } + /** * */ - private void setUpToDate (boolean upToDate) { - fUpToDate = upToDate; + public void setAvailable(boolean available) { + fAvailable = available; } /** * */ - private boolean isUpToDate () { - return fUpToDate; + public boolean isAvailable() { + return fAvailable; + } + + /** + * @see IAdaptable#getAdapter(Class) + */ + public Object getAdapter(Class adapter) { + if (adapter == PHPStackFrame.class) { + return this; + } + + return super.getAdapter(adapter); } /** - * * */ - private void resetHasChangedInfo (Vector varList) { + private void resetHasChangedInfo(Vector varList) { int n; PHPVariable var; - PHPValue val; + PHPValue val; - for (n = 0; n < varList.size (); n++) { // For every variable in 'DBG list' - var = (PHPVariable) varList.get (n); // Get the variable - val = (PHPValue) var.getValue (); // Get the variable's value + for (n = 0; n < varList.size(); n++) { // For every variable in 'DBG list' + var = (PHPVariable) varList.get(n); // Get the variable + val = (PHPValue) var.getValue(); // Get the variable's value try { - if (val.hasVariables ()) { // Do we have other variables within the value - if (!hasRecursion (var)) { // Is this variable (value) branch recursive? - resetHasChangedInfo (val.getChildVariables ()); // No, go into branch + if (val.hasVariables()) { // Do we have other variables within the value + if (!hasRecursion(var)) { // Is this variable (value) branch recursive? + resetHasChangedInfo(val.getChildVariables()); // No, go into branch } } - } - catch (DebugException e) { // That's, because of the hasVariables method + } catch (DebugException e) { // That's, because of the hasVariables method } - var.setValueChanged (false); // Reset the 'has changed' flag + var.setValueChanged(false); // Reset the 'has changed' flag } } @@ -142,6 +191,8 @@ public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Compa * TODO Check where this recursion can come from. * Whether this back reference is legal or a bug. * + * Typically $GLOBALS contains $GLOBALS + * * @param var * @return *