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 cf68846..b49de4e 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 @@ -11,6 +11,8 @@ Contributors: **********************************************************************/ package net.sourceforge.phpdt.internal.debug.core.model; +import net.sourceforge.phpdt.internal.debug.core.PHPDBGProxy; + import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; @@ -20,10 +22,8 @@ import org.eclipse.debug.core.model.IRegisterGroup; import org.eclipse.debug.core.model.IStackFrame; import org.eclipse.debug.core.model.IThread; import org.eclipse.debug.core.model.IVariable; -import net.sourceforge.phpdt.internal.debug.core.PHPDBGProxy; -import net.sourceforge.phpdt.internal.debug.core.model.PHPDebugTarget; -public class PHPStackFrame implements IStackFrame { +public class PHPStackFrame extends PHPDebugElement implements IStackFrame { private PHPThread thread; private String file; @@ -34,57 +34,71 @@ public class PHPStackFrame implements IStackFrame { private String description; public PHPStackFrame(PHPThread thread, String file, int line, int index, String desc, int modno) { + super (null); this.lineNumber = line; this.index = index; this.file = file; this.thread = thread; this.description = desc; this.modno = modno; - } - + } + public PHPStackFrame(PHPThread thread, String file, int line, int index) { + super (null); this.lineNumber = line; this.index = index; this.file = file; this.thread = thread; - } - + } + public IThread getThread() { return thread; } - + public void setThread(PHPThread thread) { this.thread = thread; } - + public IVariable[] getVariables() throws DebugException { if (variables == null) { variables = this.getPHPDBGProxy().readVariables(this); } return variables; } - + + public IVariable findVariable(String s) throws DebugException { + if (this.hasVariables()) { + String name="$"+s; + for(int i= 0; i < variables.length; i++) { + String n= variables[i].getName(); + if((variables[i].getName()).equals(name)) + return variables[i]; + } + } + return null; + } + public boolean hasVariables() throws DebugException { if (variables == null) { return false; } return variables.length > 0; } - + public int getLineNumber() { return lineNumber; } - + public int getCharStart() throws DebugException { // not supported return -1; } - + public int getCharEnd() throws DebugException { // not supported return -1; } - + public String getName() { if(!this.getDescription().equals("")) return this.getDescription() + " [line: " + this.getLineNumber() + "]"; @@ -95,7 +109,7 @@ public class PHPStackFrame implements IStackFrame { public String getFileName() { return file; } - + public void setDescription(String desc) { this.description= desc; } @@ -103,50 +117,50 @@ public class PHPStackFrame implements IStackFrame { public String getDescription() { return this.description; } - + public IRegisterGroup[] getRegisterGroups() throws DebugException { return null; } - + public boolean hasRegisterGroups() throws DebugException { return false; } - + public String getModelIdentifier() { return this.getThread().getModelIdentifier(); } - + public IDebugTarget getDebugTarget() { return this.getThread().getDebugTarget(); } - + public ILaunch getLaunch() { return this.getDebugTarget().getLaunch(); } - + public boolean canStepInto() { return canResume(); } - + public boolean canStepOver() { return canResume(); } - + public boolean canStepReturn() { return canResume(); } - + public boolean isStepping() { return false; } - + public void stepInto() throws DebugException { thread.prepareForResume() ; - this.getPHPDBGProxy().readStepIntoEnd(PHPStackFrame.this) ; + this.getPHPDBGProxy().readStepIntoEnd(PHPStackFrame.this) ; DebugEvent ev = new DebugEvent(this.getThread(), DebugEvent.RESUME, DebugEvent.STEP_INTO); DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { ev }); } - + public void stepOver() throws DebugException { thread.prepareForResume() ; this.getPHPDBGProxy().readStepOverEnd(PHPStackFrame.this) ; @@ -156,45 +170,41 @@ public class PHPStackFrame implements IStackFrame { public void stepReturn() throws DebugException { thread.prepareForResume() ; - this.getPHPDBGProxy().readStepReturnEnd(PHPStackFrame.this) ; + this.getPHPDBGProxy().readStepReturnEnd(PHPStackFrame.this) ; DebugEvent ev = new DebugEvent(this.getThread(), DebugEvent.RESUME, DebugEvent.STEP_RETURN); - DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { ev }); + DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { ev }); } - + public boolean canResume() { return this.getThread().canResume(); } - + public boolean canSuspend() { return this.getThread().canSuspend(); } - + public boolean isSuspended() { return this.getThread().isSuspended(); - } - + } + public void resume() throws DebugException { this.getThread().resume(); } - + public void suspend() throws DebugException { } - + public boolean canTerminate() { return this.getThread().canTerminate(); } - + public boolean isTerminated() { return this.getThread().isTerminated(); - } - + } + public void terminate() throws DebugException { getPHPDBGProxy().stop(); - } - - public Object getAdapter(Class arg0) { - return null; } public int getIndex() { @@ -210,7 +220,7 @@ public class PHPStackFrame implements IStackFrame { public void setFile(String file) { this.file = file; } - + public int getModNo() { return modno; }