X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPThread.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPThread.java index c6508e8..9c94fee 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPThread.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPThread.java @@ -94,12 +94,16 @@ public class PHPThread extends PHPDebugElement implements IThread { * */ public IStackFrame[] getStackFrames () throws DebugException { - return frames; + if (isSuspended()) { + return ((PHPDebugTarget)getDebugTarget()).getStackFrames(); + } else { + return new IStackFrame[0]; + } } - public int getStackFramesSize () { - return frames.length; - } +// public int getStackFramesSize () { +// return frames.length; +// } public boolean hasStackFrames () { if (frames == null) { @@ -121,7 +125,7 @@ public class PHPThread extends PHPDebugElement implements IThread { } public IBreakpoint[] getBreakpoints() { - return null; + return new IBreakpoint[0]; } public String getModelIdentifier() { @@ -132,9 +136,9 @@ public class PHPThread extends PHPDebugElement implements IThread { return target; } - public void setDebugTarget(PHPDebugTarget target) { - this.target = target; - } +// public void setDebugTarget(PHPDebugTarget target) { +// this.target = target; +// } public ILaunch getLaunch() { return this.getDebugTarget().getLaunch(); @@ -164,9 +168,9 @@ public class PHPThread extends PHPDebugElement implements IThread { state.setSuspended (false); // We will leave the suspended state this.frames = null; // Reset the stackframes - ev = new DebugEvent (this, DebugEvent.RESUME, de); // Create an event resume by stepping + ev = new DebugEvent (this, DebugEvent.RESUME, de); // Create an event resume by stepping - DebugPlugin.getDefault ().fireDebugEventSet (new DebugEvent[] { ev }); // Fire the event + DebugPlugin.getDefault ().fireDebugEventSet (new DebugEvent[] { ev }); // Fire the event } /** @@ -210,7 +214,7 @@ public class PHPThread extends PHPDebugElement implements IThread { */ public boolean canStepInto () { return isSuspended () && // Is the thread in suspended mode (stopped) - isStepping () && // and ??? + isStepping () && // and ??? this.hasStackFrames (); // and does this thread have stack frames? } @@ -219,7 +223,7 @@ public class PHPThread extends PHPDebugElement implements IThread { */ public boolean canStepOver () { return isSuspended () && // Is the thread in suspended mode (stopped) - isStepping () && // and ??? + isStepping () && // and ??? this.hasStackFrames (); // and does this thread have stack frames? } @@ -228,7 +232,7 @@ public class PHPThread extends PHPDebugElement implements IThread { */ public boolean canStepReturn () { return isSuspended () && // Is the thread in suspended mode (stopped) - isStepping () && // and ??? + isStepping () && // and ??? this.hasStackFrames (); // and does this thread have stack frames? } @@ -297,6 +301,7 @@ public class PHPThread extends PHPDebugElement implements IThread { state.setTerminated (true); this.frames = null; getDebugTarget ().terminate (); + fireTerminateEvent (); } /** @@ -308,22 +313,13 @@ public class PHPThread extends PHPDebugElement implements IThread { if (IWorkbenchAdapter.class.equals (arg0)) { return new IWorkbenchAdapter() { public Object[] getChildren(Object o) { - Object[] children = null; - try { - IStackFrame[] frames = getStackFrames(); - - if (null != frames) { - children = new Object[frames.length]; - for (int i = 0; i < frames.length; ++i) { - children[i] = frames[i]; - } - } + return getStackFrames (); } catch (DebugException x) { PHPeclipsePlugin.log ("Unable to get stack frames.", x); } - return children; + return new Object[0]; } public ImageDescriptor getImageDescriptor(Object object) { @@ -339,8 +335,7 @@ public class PHPThread extends PHPDebugElement implements IThread { } }; } - - return null; + return super.getAdapter(arg0); } /**