org.eclipse.cdt.debug.internal.core.model
Class CThread

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.cdt.debug.internal.core.model.CDebugElement
          extended by org.eclipse.cdt.debug.internal.core.model.CThread
All Implemented Interfaces:
org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener, ICDebugElement, ICDebugElementStatus, ICThread, IRestart, IResumeWithoutSignal, org.eclipse.core.runtime.IAdaptable, org.eclipse.debug.core.model.IDebugElement, org.eclipse.debug.core.model.IStep, org.eclipse.debug.core.model.ISuspendResume, org.eclipse.debug.core.model.ITerminate, org.eclipse.debug.core.model.IThread

public class CThread
extends CDebugElement
implements ICThread, IRestart, IResumeWithoutSignal, org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener

A thread in a C/C++ debug model.


Field Summary
 
Fields inherited from interface org.eclipse.cdt.debug.core.model.ICDebugElementStatus
ERROR, OK, WARNING
 
Constructor Summary
CThread(CDebugTarget target, org.eclipse.cdt.debug.core.cdi.model.ICDIThread cdiThread)
          Constructor for CThread.
 
Method Summary
 boolean canRestart()
          Returns whether this element can currently be restarted.
 boolean canResume()
           
 boolean canResumeWithoutSignal()
          Returns whether this element can currently be resumed without signal.
 boolean canStepInto()
           
 boolean canStepOver()
           
 boolean canStepReturn()
           
 boolean canSuspend()
           
 boolean canTerminate()
           
 java.util.List computeNewStackFrames()
           
 java.util.List computeStackFrames()
          Returns this thread's current stack frames as a list, computing them if required.
 java.lang.Object getAdapter(java.lang.Class adapter)
           
 org.eclipse.debug.core.model.IBreakpoint[] getBreakpoints()
           
 java.lang.String getName()
           
 int getPriority()
           
 org.eclipse.debug.core.model.IStackFrame[] getStackFrames()
           
 org.eclipse.debug.core.model.IStackFrame getTopStackFrame()
           
 void handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[] events)
           
 boolean hasStackFrames()
           
 boolean isStepping()
           
 boolean isSuspended()
           
 boolean isTerminated()
           
 void restart()
          Causes this element to restart its execution.
 void resume()
           
 void resumeWithoutSignal()
          Causes this element to resume its execution ignoring a signal.
 void stepInto()
           
 void stepOver()
           
 void stepReturn()
           
 void suspend()
           
 void terminate()
           
 java.lang.String toString()
           
 
Methods inherited from class org.eclipse.cdt.debug.internal.core.model.CDebugElement
createChangeEvent, createCreateEvent, createResumeEvent, createSuspendEvent, createTerminateEvent, fireChangeEvent, fireCreationEvent, fireResumeEvent, fireSuspendEvent, fireTerminateEvent, getCDISession, getCDITarget, getCurrentStateInfo, getDebugTarget, getLaunch, getMessage, getModelIdentifier, getSeverity, getState, isOK, notSupported, requestFailed, requestFailed, targetRequestFailed, targetRequestFailed
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.debug.core.model.IDebugElement
getDebugTarget, getLaunch, getModelIdentifier
 
Methods inherited from interface org.eclipse.cdt.debug.core.model.ICDebugElement
getCurrentStateInfo, getState
 
Methods inherited from interface org.eclipse.debug.core.model.IDebugElement
getDebugTarget, getLaunch, getModelIdentifier
 

Constructor Detail

CThread

public CThread(CDebugTarget target,
               org.eclipse.cdt.debug.core.cdi.model.ICDIThread cdiThread)
Constructor for CThread.

Method Detail

getStackFrames

public org.eclipse.debug.core.model.IStackFrame[] getStackFrames()
                                                          throws org.eclipse.debug.core.DebugException
Specified by:
getStackFrames in interface org.eclipse.debug.core.model.IThread
Throws:
org.eclipse.debug.core.DebugException

hasStackFrames

public boolean hasStackFrames()
                       throws org.eclipse.debug.core.DebugException
Specified by:
hasStackFrames in interface org.eclipse.debug.core.model.IThread
Throws:
org.eclipse.debug.core.DebugException

computeStackFrames

public java.util.List computeStackFrames()
                                  throws org.eclipse.debug.core.DebugException
Returns this thread's current stack frames as a list, computing them if required. Returns an empty collection if this thread is not currently suspended, or this thread is terminated. This method should be used internally to get the current stack frames, instead of calling #getStackFrames(), which makes a copy of the current list.

Before a thread is resumed a call must be made to one of:

If stack frames are disposed before a thread is resumed, stack frames are completely re-computed on the next call to this method. If stack frames are to be preserved, this method will attempt to re-use any stack frame objects which represent the same stack frame as on the previous suspend. Stack frames are cached until a subsequent call to preserve or dispose stack frames.

Returns:
list of IStackFrame
Throws:
org.eclipse.debug.core.DebugException - if this method fails. Reasons include:

computeNewStackFrames

public java.util.List computeNewStackFrames()
                                     throws org.eclipse.debug.core.DebugException
Throws:
org.eclipse.debug.core.DebugException
See Also:
This method differs from computeStackFrames() in that it always requests new stack frames from the target. As this is an expensive operation, this method should only be used by clients who know for certain that the stack frames on the target have changed.

getPriority

public int getPriority()
                throws org.eclipse.debug.core.DebugException
Specified by:
getPriority in interface org.eclipse.debug.core.model.IThread
Throws:
org.eclipse.debug.core.DebugException

getTopStackFrame

public org.eclipse.debug.core.model.IStackFrame getTopStackFrame()
                                                          throws org.eclipse.debug.core.DebugException
Specified by:
getTopStackFrame in interface org.eclipse.debug.core.model.IThread
Throws:
org.eclipse.debug.core.DebugException

getName

public java.lang.String getName()
                         throws org.eclipse.debug.core.DebugException
Specified by:
getName in interface org.eclipse.debug.core.model.IThread
Throws:
org.eclipse.debug.core.DebugException

getBreakpoints

public org.eclipse.debug.core.model.IBreakpoint[] getBreakpoints()
Specified by:
getBreakpoints in interface org.eclipse.debug.core.model.IThread

handleDebugEvents

public void handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[] events)
Specified by:
handleDebugEvents in interface org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener

canResume

public boolean canResume()
Specified by:
canResume in interface org.eclipse.debug.core.model.ISuspendResume

canSuspend

public boolean canSuspend()
Specified by:
canSuspend in interface org.eclipse.debug.core.model.ISuspendResume

isSuspended

public boolean isSuspended()
Specified by:
isSuspended in interface org.eclipse.debug.core.model.ISuspendResume

resume

public void resume()
            throws org.eclipse.debug.core.DebugException
Specified by:
resume in interface org.eclipse.debug.core.model.ISuspendResume
Throws:
org.eclipse.debug.core.DebugException

suspend

public void suspend()
             throws org.eclipse.debug.core.DebugException
Specified by:
suspend in interface org.eclipse.debug.core.model.ISuspendResume
Throws:
org.eclipse.debug.core.DebugException

canStepInto

public boolean canStepInto()
Specified by:
canStepInto in interface org.eclipse.debug.core.model.IStep

canStepOver

public boolean canStepOver()
Specified by:
canStepOver in interface org.eclipse.debug.core.model.IStep

canStepReturn

public boolean canStepReturn()
Specified by:
canStepReturn in interface org.eclipse.debug.core.model.IStep

isStepping

public boolean isStepping()
Specified by:
isStepping in interface org.eclipse.debug.core.model.IStep

stepInto

public void stepInto()
              throws org.eclipse.debug.core.DebugException
Specified by:
stepInto in interface org.eclipse.debug.core.model.IStep
Throws:
org.eclipse.debug.core.DebugException

stepOver

public void stepOver()
              throws org.eclipse.debug.core.DebugException
Specified by:
stepOver in interface org.eclipse.debug.core.model.IStep
Throws:
org.eclipse.debug.core.DebugException

stepReturn

public void stepReturn()
                throws org.eclipse.debug.core.DebugException
Specified by:
stepReturn in interface org.eclipse.debug.core.model.IStep
Throws:
org.eclipse.debug.core.DebugException

canTerminate

public boolean canTerminate()
Specified by:
canTerminate in interface org.eclipse.debug.core.model.ITerminate

isTerminated

public boolean isTerminated()
Specified by:
isTerminated in interface org.eclipse.debug.core.model.ITerminate

terminate

public void terminate()
               throws org.eclipse.debug.core.DebugException
Specified by:
terminate in interface org.eclipse.debug.core.model.ITerminate
Throws:
org.eclipse.debug.core.DebugException

canRestart

public boolean canRestart()
Description copied from interface: IRestart
Returns whether this element can currently be restarted.

Specified by:
canRestart in interface IRestart
Returns:
whether this element can currently be restarted

restart

public void restart()
             throws org.eclipse.debug.core.DebugException
Description copied from interface: IRestart
Causes this element to restart its execution.

Specified by:
restart in interface IRestart
Throws:
org.eclipse.debug.core.DebugException - on failure. Reasons include:

getAdapter

public java.lang.Object getAdapter(java.lang.Class adapter)
Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable
Overrides:
getAdapter in class CDebugElement

canResumeWithoutSignal

public boolean canResumeWithoutSignal()
Description copied from interface: IResumeWithoutSignal
Returns whether this element can currently be resumed without signal.

Specified by:
canResumeWithoutSignal in interface IResumeWithoutSignal
Returns:
whether this element can currently be resumed without signal

resumeWithoutSignal

public void resumeWithoutSignal()
                         throws org.eclipse.debug.core.DebugException
Description copied from interface: IResumeWithoutSignal
Causes this element to resume its execution ignoring a signal. Has no effect on an element that is not suspended because of a signal.

Specified by:
resumeWithoutSignal in interface IResumeWithoutSignal
Throws:
org.eclipse.debug.core.DebugException - on failure. Reasons include:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object