X-Git-Url: http://git.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 43b2117..245dc76 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 @@ -15,6 +15,7 @@ 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; @@ -266,16 +267,14 @@ public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Compa updateVariableList(valOld.getChildVariables(), // Update the variable list for the child variables valNew.getChildVariables()); } - } else if (!valOld.getValueString().equals( + } + if (!valOld.getValueString().equals( valNew.getValueString())) { // Has the value changed? valOld.setValueString(valNew.getValueString()); // Yes, set the 'static' value (variable) to the new value varOld.setValueChanged(true); // and set the 'has changed' flag, so that the variable view // could show the user the changed status with a different // color } - //else { - // varOld.setValueChanged (false); // Reset the 'has changed' flag - //} } catch (DebugException e) { // That's, because of the hasVariables method } @@ -343,15 +342,14 @@ public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Compa try { if (value.hasVariables()) { // Does the variable/value have children if (!hasRecursion(variable)) { // Don't follow recursive variable/values - variable = findVariable(value.getChildVariables(), - varname); - - if (variable != null) { - return variable; + PHPVariable var = findVariable(value.getChildVariables(), varname); + if (var != null) { + return var; } } - } else if ((variable.getName()).equals(varname)) { // - return variable; // + } + if (variable.getName().equals(varname)) { + return variable; } } catch (DebugException e) { // That's, because of the hasVariables method } @@ -567,6 +565,36 @@ public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Compa public void setFile(String file) { this.file = file; + + final String COMPILED_EVAL = "eval()'d code"; + final String COMPILED_LAMBDA = "runtime-created function"; + + int i = 0; + if (file.endsWith(COMPILED_EVAL)) { + i = file.length() - COMPILED_EVAL.length(); + } else if (file.endsWith(COMPILED_LAMBDA)) { + i = file.length() - COMPILED_LAMBDA.length(); + } + if (i > 0) { + // assume COMPILED_STRING_DESCRIPTION_FORMAT + // "filename(linenumber) : string" + int j = i; + while (--i > 0) { + switch (file.charAt(i)) { + case ')': + j = i; + break; + case '(': + this.file = file.substring(0, i); + try { + lineNumber = Integer.parseInt(file.substring(i + 1, j)); + } catch (NumberFormatException e) { + PHPDebugCorePlugin.log(e); + } + return; + } + } + } } public int getModNo() { @@ -580,18 +608,20 @@ public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Compa * @return * */ public int compareTo(Object obj) { - //if (index < ((PHPStackFrame) obj).getIndex()) { - // return -1; - //} else if (index > ((PHPStackFrame) obj).getIndex()) { - // return 1; - //} - - //return 0; - return Integer.signum(index - ((PHPStackFrame) obj).getIndex()); + if (!(obj instanceof PHPStackFrame)) { + throw new IllegalArgumentException("A PHPStackFrame can only be compared with another PHPStackFrame"); + } + int frameIndex = ((PHPStackFrame) obj).getIndex(); + if (index < frameIndex) { + return -1; + } else if (index > frameIndex) { + return 1; + } + return 0; } }