1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-09 19:43:27 +02:00
This commit is contained in:
Mikhail Khodjaiants 2004-07-20 21:27:37 +00:00
parent 243857d6ef
commit 9c3c70be24
2 changed files with 63 additions and 131 deletions

View file

@ -1,3 +1,7 @@
2004-07-20 Mikhail Khodjaiants
Cleanup.
* CStackFrame.java
2004-07-16 Mikhail Khodjaiants 2004-07-16 Mikhail Khodjaiants
Asynchronous resume, suspend and step operations. Cleanup. Asynchronous resume, suspend and step operations. Cleanup.
* CDebugModel.java * CDebugModel.java

View file

@ -73,8 +73,6 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
/** /**
* Constructor for CStackFrame. * Constructor for CStackFrame.
*
* @param target
*/ */
public CStackFrame( CThread thread, ICDIStackFrame cdiFrame ) { public CStackFrame( CThread thread, ICDIStackFrame cdiFrame ) {
super( (CDebugTarget)thread.getDebugTarget() ); super( (CDebugTarget)thread.getDebugTarget() );
@ -83,18 +81,14 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
getCDISession().getEventManager().addEventListener( this ); getCDISession().getEventManager().addEventListener( this );
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStackFrame#getThread() * @see org.eclipse.debug.core.model.IStackFrame#getThread()
*/ */
public IThread getThread() { public IThread getThread() {
return fThread; return fThread;
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStackFrame#getVariables() * @see org.eclipse.debug.core.model.IStackFrame#getVariables()
*/ */
public IVariable[] getVariables() throws DebugException { public IVariable[] getVariables() throws DebugException {
@ -107,25 +101,27 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
} }
protected synchronized List getVariables0() throws DebugException { protected synchronized List getVariables0() throws DebugException {
((CThread)getThread()).switchToFrame( this ); CThread thread = (CThread)getThread();
if ( fVariables == null ) { if ( thread.isSuspended() ) {
List vars = getAllCDIVariableObjects(); thread.switchToFrame( this );
fVariables = new ArrayList( vars.size() ); if ( fVariables == null ) {
Iterator it = vars.iterator(); List vars = getAllCDIVariableObjects();
while( it.hasNext() ) { fVariables = new ArrayList( vars.size() );
fVariables.add( new CModificationVariable( this, (ICDIVariableObject)it.next() ) ); Iterator it = vars.iterator();
while( it.hasNext() ) {
fVariables.add( new CModificationVariable( this, (ICDIVariableObject)it.next() ) );
}
} }
else if ( refreshVariables() ) {
updateVariables();
}
setRefreshVariables( false );
} }
else if ( refreshVariables() ) {
updateVariables();
}
setRefreshVariables( false );
return fVariables; return fVariables;
} }
/** /**
* Incrementally updates this stack frame's variables. * Incrementally updates this stack frame's variables.
*
*/ */
protected void updateVariables() throws DebugException { protected void updateVariables() throws DebugException {
List locals = getAllCDIVariableObjects(); List locals = getAllCDIVariableObjects();
@ -151,25 +147,20 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
/** /**
* Sets the containing thread. * Sets the containing thread.
* *
* @param thread * @param thread the containing thread
* the containing thread
*/ */
protected void setThread( CThread thread ) { protected void setThread( CThread thread ) {
fThread = thread; fThread = thread;
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStackFrame#hasVariables() * @see org.eclipse.debug.core.model.IStackFrame#hasVariables()
*/ */
public boolean hasVariables() throws DebugException { public boolean hasVariables() throws DebugException {
return getVariables0().size() > 0; return getVariables0().size() > 0;
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStackFrame#getLineNumber() * @see org.eclipse.debug.core.model.IStackFrame#getLineNumber()
*/ */
public int getLineNumber() throws DebugException { public int getLineNumber() throws DebugException {
@ -183,27 +174,21 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
return -1; return -1;
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStackFrame#getCharStart() * @see org.eclipse.debug.core.model.IStackFrame#getCharStart()
*/ */
public int getCharStart() throws DebugException { public int getCharStart() throws DebugException {
return -1; return -1;
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStackFrame#getCharEnd() * @see org.eclipse.debug.core.model.IStackFrame#getCharEnd()
*/ */
public int getCharEnd() throws DebugException { public int getCharEnd() throws DebugException {
return -1; return -1;
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStackFrame#getName() * @see org.eclipse.debug.core.model.IStackFrame#getName()
*/ */
public String getName() throws DebugException { public String getName() throws DebugException {
@ -225,35 +210,27 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
return MessageFormat.format( CoreModelMessages.getString( "CStackFrame.0" ), new String[]{ func, file, line } ); //$NON-NLS-1$ return MessageFormat.format( CoreModelMessages.getString( "CStackFrame.0" ), new String[]{ func, file, line } ); //$NON-NLS-1$
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStackFrame#getRegisterGroups() * @see org.eclipse.debug.core.model.IStackFrame#getRegisterGroups()
*/ */
public IRegisterGroup[] getRegisterGroups() throws DebugException { public IRegisterGroup[] getRegisterGroups() throws DebugException {
return ((CDebugTarget)getDebugTarget()).getRegisterGroups(); return ((CDebugTarget)getDebugTarget()).getRegisterGroups();
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStackFrame#hasRegisterGroups() * @see org.eclipse.debug.core.model.IStackFrame#hasRegisterGroups()
*/ */
public boolean hasRegisterGroups() throws DebugException { public boolean hasRegisterGroups() throws DebugException {
return ((CDebugTarget)getDebugTarget()).getRegisterGroups().length > 0; return ((CDebugTarget)getDebugTarget()).getRegisterGroups().length > 0;
} }
/* /* (non-Javadoc)
* (non-Javadoc) * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent[])
*
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(ICDIEvent)
*/ */
public void handleDebugEvents( ICDIEvent[] events ) { public void handleDebugEvents( ICDIEvent[] events ) {
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStep#canStepInto() * @see org.eclipse.debug.core.model.IStep#canStepInto()
*/ */
public boolean canStepInto() { public boolean canStepInto() {
@ -266,9 +243,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
} }
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStep#canStepOver() * @see org.eclipse.debug.core.model.IStep#canStepOver()
*/ */
public boolean canStepOver() { public boolean canStepOver() {
@ -281,9 +256,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
return false; return false;
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStep#canStepReturn() * @see org.eclipse.debug.core.model.IStep#canStepReturn()
*/ */
public boolean canStepReturn() { public boolean canStepReturn() {
@ -303,18 +276,14 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
return false; return false;
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStep#isStepping() * @see org.eclipse.debug.core.model.IStep#isStepping()
*/ */
public boolean isStepping() { public boolean isStepping() {
return getThread().isStepping(); return getThread().isStepping();
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStep#stepInto() * @see org.eclipse.debug.core.model.IStep#stepInto()
*/ */
public void stepInto() throws DebugException { public void stepInto() throws DebugException {
@ -323,9 +292,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
} }
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStep#stepOver() * @see org.eclipse.debug.core.model.IStep#stepOver()
*/ */
public void stepOver() throws DebugException { public void stepOver() throws DebugException {
@ -341,9 +308,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
} }
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStep#stepReturn() * @see org.eclipse.debug.core.model.IStep#stepReturn()
*/ */
public void stepReturn() throws DebugException { public void stepReturn() throws DebugException {
@ -362,54 +327,42 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
} }
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ISuspendResume#canResume() * @see org.eclipse.debug.core.model.ISuspendResume#canResume()
*/ */
public boolean canResume() { public boolean canResume() {
return getThread().canResume(); return getThread().canResume();
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
*/ */
public boolean canSuspend() { public boolean canSuspend() {
return getThread().canSuspend(); return getThread().canSuspend();
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
*/ */
public boolean isSuspended() { public boolean isSuspended() {
return getThread().isSuspended(); return getThread().isSuspended();
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ISuspendResume#resume() * @see org.eclipse.debug.core.model.ISuspendResume#resume()
*/ */
public void resume() throws DebugException { public void resume() throws DebugException {
getThread().resume(); getThread().resume();
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ISuspendResume#suspend() * @see org.eclipse.debug.core.model.ISuspendResume#suspend()
*/ */
public void suspend() throws DebugException { public void suspend() throws DebugException {
getThread().suspend(); getThread().suspend();
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ITerminate#canTerminate() * @see org.eclipse.debug.core.model.ITerminate#canTerminate()
*/ */
public boolean canTerminate() { public boolean canTerminate() {
@ -423,18 +376,14 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
return exists && getThread().canTerminate() || getDebugTarget().canTerminate(); return exists && getThread().canTerminate() || getDebugTarget().canTerminate();
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ITerminate#isTerminated() * @see org.eclipse.debug.core.model.ITerminate#isTerminated()
*/ */
public boolean isTerminated() { public boolean isTerminated() {
return getThread().isTerminated(); return getThread().isTerminated();
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ITerminate#terminate() * @see org.eclipse.debug.core.model.ITerminate#terminate()
*/ */
public void terminate() throws DebugException { public void terminate() throws DebugException {
@ -458,8 +407,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
/** /**
* Sets the underlying CDI stack frame. Called by a thread when incrementally updating after a step has completed. * Sets the underlying CDI stack frame. Called by a thread when incrementally updating after a step has completed.
* *
* @param frame * @param frame the underlying stack frame
* the underlying stack frame
*/ */
protected void setCDIStackFrame( ICDIStackFrame frame ) { protected void setCDIStackFrame( ICDIStackFrame frame ) {
if ( frame != null ) { if ( frame != null ) {
@ -592,46 +540,36 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
fVariables = null; fVariables = null;
} }
/* /* (non-Javadoc)
* (non-Javadoc) * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getAddress()
*
* @see org.eclipse.cdt.debug.core.IStackFrameInfo#getAddress()
*/ */
public long getAddress() { public long getAddress() {
return getCDIStackFrame().getLocation().getAddress(); return getCDIStackFrame().getLocation().getAddress();
} }
/* /* (non-Javadoc)
* (non-Javadoc) * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getFile()
*
* @see org.eclipse.cdt.debug.core.IStackFrameInfo#getFile()
*/ */
public String getFile() { public String getFile() {
return getCDIStackFrame().getLocation().getFile(); return getCDIStackFrame().getLocation().getFile();
} }
/* /* (non-Javadoc)
* (non-Javadoc) * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getFunction()
*
* @see org.eclipse.cdt.debug.core.IStackFrameInfo#getFunction()
*/ */
public String getFunction() { public String getFunction() {
return getCDIStackFrame().getLocation().getFunction(); return getCDIStackFrame().getLocation().getFunction();
} }
/* /* (non-Javadoc)
* (non-Javadoc) * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getLevel()
*
* @see org.eclipse.cdt.debug.core.IStackFrameInfo#getLevel()
*/ */
public int getLevel() { public int getLevel() {
return getCDIStackFrame().getLevel(); return getCDIStackFrame().getLevel();
} }
/* /* (non-Javadoc)
* (non-Javadoc) * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getFrameLineNumber()
*
* @see org.eclipse.cdt.debug.core.IStackFrameInfo#getFrameLineNumber()
*/ */
public int getFrameLineNumber() { public int getFrameLineNumber() {
return getCDIStackFrame().getLocation().getLineNumber(); return getCDIStackFrame().getLocation().getLineNumber();
@ -665,19 +603,15 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
return null; return null;
} }
/* /* (non-Javadoc)
* (non-Javadoc) * @see org.eclipse.cdt.debug.core.model.IRestart#canRestart()
*
* @see org.eclipse.cdt.debug.core.IRestart#canRestart()
*/ */
public boolean canRestart() { public boolean canRestart() {
return getDebugTarget() instanceof IRestart && ((IRestart)getDebugTarget()).canRestart(); return getDebugTarget() instanceof IRestart && ((IRestart)getDebugTarget()).canRestart();
} }
/* /* (non-Javadoc)
* (non-Javadoc) * @see org.eclipse.cdt.debug.core.model.IRestart#restart()
*
* @see org.eclipse.cdt.debug.core.IRestart#restart()
*/ */
public void restart() throws DebugException { public void restart() throws DebugException {
if ( canRestart() ) { if ( canRestart() ) {
@ -693,18 +627,14 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
return fRefreshVariables; return fRefreshVariables;
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#canResumeWithoutSignal() * @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#canResumeWithoutSignal()
*/ */
public boolean canResumeWithoutSignal() { public boolean canResumeWithoutSignal() {
return (getDebugTarget() instanceof IResumeWithoutSignal && ((IResumeWithoutSignal)getDebugTarget()).canResumeWithoutSignal()); return (getDebugTarget() instanceof IResumeWithoutSignal && ((IResumeWithoutSignal)getDebugTarget()).canResumeWithoutSignal());
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#resumeWithoutSignal() * @see org.eclipse.cdt.debug.core.model.IResumeWithoutSignal#resumeWithoutSignal()
*/ */
public void resumeWithoutSignal() throws DebugException { public void resumeWithoutSignal() throws DebugException {
@ -713,9 +643,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
} }
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.model.ICStackFrame#evaluateExpression(java.lang.String) * @see org.eclipse.cdt.debug.core.model.ICStackFrame#evaluateExpression(java.lang.String)
*/ */
public IValue evaluateExpression( String expression ) throws DebugException { public IValue evaluateExpression( String expression ) throws DebugException {