mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 19:25:38 +02:00
Thread should handle CDI events from the corresponding CDI thread only.
"canSuspend" should return true if the thread is stepping. New implementation of "stepReturn" for stack frames.
This commit is contained in:
parent
ee74068fe8
commit
2ebb271b82
3 changed files with 24 additions and 21 deletions
|
@ -1,3 +1,10 @@
|
|||
2004-10-21 Mikhail Khodjaiants
|
||||
Thread should handle CDI events from the corresponding CDI thread only.
|
||||
"canSuspend" should return true if the thread is stepping.
|
||||
New implementation of "stepReturn" for stack frames.
|
||||
* CThread.java
|
||||
* CStackFrame.java
|
||||
|
||||
2004-10-21 Mikhail Khodjaiants
|
||||
Pass the target state to threads on terminate, disconnect, resume, suspend and restart.
|
||||
* CoreModelMessages.properties
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.text.MessageFormat;
|
|||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -119,7 +120,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
|
|||
}
|
||||
setRefreshVariables( false );
|
||||
}
|
||||
return fVariables;
|
||||
return ( fVariables != null ) ? fVariables : Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -308,12 +309,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
|
|||
*/
|
||||
public void stepReturn() throws DebugException {
|
||||
if ( canStepReturn() ) {
|
||||
try {
|
||||
getCDIStackFrame().stepReturn();
|
||||
}
|
||||
catch( CDIException e ) {
|
||||
targetRequestFailed( e.getMessage(), null );
|
||||
}
|
||||
getThread().stepReturn();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -680,4 +676,13 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
|
|||
CDebugTarget target = ((CDebugTarget)getDebugTarget());
|
||||
return target.supportsExpressionEvaluation() && target.isSuspended();
|
||||
}
|
||||
|
||||
protected void doStepReturn() throws DebugException {
|
||||
try {
|
||||
getCDIStackFrame().stepReturn();
|
||||
}
|
||||
catch( CDIException e ) {
|
||||
targetRequestFailed( e.getMessage(), null );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -357,31 +357,21 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
|
|||
ICDIObject source = event.getSource();
|
||||
if ( source == null )
|
||||
continue;
|
||||
if ( source.getTarget().equals( getCDITarget() ) ) {
|
||||
if ( source instanceof ICDIThread && source.equals( getCDIThread() ) ) {
|
||||
if ( event instanceof ICDISuspendedEvent ) {
|
||||
if ( source instanceof ICDIThread && getCDIThread().equals( (ICDIThread)source ) ) {
|
||||
handleSuspendedEvent( (ICDISuspendedEvent)event );
|
||||
}
|
||||
}
|
||||
else if ( event instanceof ICDIResumedEvent ) {
|
||||
if ( (source instanceof ICDIThread && source.equals( getCDIThread() )) ) {
|
||||
handleResumedEvent( (ICDIResumedEvent)event );
|
||||
}
|
||||
}
|
||||
else if ( event instanceof ICDIDestroyedEvent ) {
|
||||
if ( source instanceof ICDIThread ) {
|
||||
handleTerminatedEvent( (ICDIDestroyedEvent)event );
|
||||
}
|
||||
}
|
||||
else if ( event instanceof ICDIDisconnectedEvent ) {
|
||||
if ( source instanceof ICDIThread ) {
|
||||
handleDisconnectedEvent( (ICDIDisconnectedEvent)event );
|
||||
}
|
||||
}
|
||||
else if ( event instanceof ICDIChangedEvent ) {
|
||||
if ( source instanceof ICDIThread ) {
|
||||
handleChangedEvent( (ICDIChangedEvent)event );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -398,7 +388,8 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
|
|||
* @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
|
||||
*/
|
||||
public boolean canSuspend() {
|
||||
return ( fConfig.supportsSuspend() && getState().equals( CDebugElementState.RESUMED ) );
|
||||
CDebugElementState state = getState();
|
||||
return ( fConfig.supportsSuspend() && (state.equals( CDebugElementState.RESUMED ) || state.equals( CDebugElementState.STEPPED )) );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -566,14 +557,14 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
|
|||
IStackFrame[] frames = getStackFrames();
|
||||
if ( frames.length == 0 )
|
||||
return;
|
||||
final IStackFrame f = frames[0];
|
||||
final CStackFrame f = (CStackFrame)frames[0];
|
||||
final CDebugElementState oldState = getState();
|
||||
setState( CDebugElementState.STEPPING );
|
||||
DebugPlugin.getDefault().asyncExec( new Runnable() {
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
f.stepReturn();
|
||||
f.doStepReturn();
|
||||
}
|
||||
catch( DebugException e ) {
|
||||
setState( oldState );
|
||||
|
|
Loading…
Add table
Reference in a new issue