mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-14 11:45: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
|
2004-10-21 Mikhail Khodjaiants
|
||||||
Pass the target state to threads on terminate, disconnect, resume, suspend and restart.
|
Pass the target state to threads on terminate, disconnect, resume, suspend and restart.
|
||||||
* CoreModelMessages.properties
|
* CoreModelMessages.properties
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.text.MessageFormat;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -119,7 +120,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
|
||||||
}
|
}
|
||||||
setRefreshVariables( false );
|
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 {
|
public void stepReturn() throws DebugException {
|
||||||
if ( canStepReturn() ) {
|
if ( canStepReturn() ) {
|
||||||
try {
|
getThread().stepReturn();
|
||||||
getCDIStackFrame().stepReturn();
|
|
||||||
}
|
|
||||||
catch( CDIException e ) {
|
|
||||||
targetRequestFailed( e.getMessage(), null );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -680,4 +676,13 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
|
||||||
CDebugTarget target = ((CDebugTarget)getDebugTarget());
|
CDebugTarget target = ((CDebugTarget)getDebugTarget());
|
||||||
return target.supportsExpressionEvaluation() && target.isSuspended();
|
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();
|
ICDIObject source = event.getSource();
|
||||||
if ( source == null )
|
if ( source == null )
|
||||||
continue;
|
continue;
|
||||||
if ( source.getTarget().equals( getCDITarget() ) ) {
|
if ( source instanceof ICDIThread && source.equals( getCDIThread() ) ) {
|
||||||
if ( event instanceof ICDISuspendedEvent ) {
|
if ( event instanceof ICDISuspendedEvent ) {
|
||||||
if ( source instanceof ICDIThread && getCDIThread().equals( (ICDIThread)source ) ) {
|
|
||||||
handleSuspendedEvent( (ICDISuspendedEvent)event );
|
handleSuspendedEvent( (ICDISuspendedEvent)event );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if ( event instanceof ICDIResumedEvent ) {
|
else if ( event instanceof ICDIResumedEvent ) {
|
||||||
if ( (source instanceof ICDIThread && source.equals( getCDIThread() )) ) {
|
|
||||||
handleResumedEvent( (ICDIResumedEvent)event );
|
handleResumedEvent( (ICDIResumedEvent)event );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if ( event instanceof ICDIDestroyedEvent ) {
|
else if ( event instanceof ICDIDestroyedEvent ) {
|
||||||
if ( source instanceof ICDIThread ) {
|
|
||||||
handleTerminatedEvent( (ICDIDestroyedEvent)event );
|
handleTerminatedEvent( (ICDIDestroyedEvent)event );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if ( event instanceof ICDIDisconnectedEvent ) {
|
else if ( event instanceof ICDIDisconnectedEvent ) {
|
||||||
if ( source instanceof ICDIThread ) {
|
|
||||||
handleDisconnectedEvent( (ICDIDisconnectedEvent)event );
|
handleDisconnectedEvent( (ICDIDisconnectedEvent)event );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if ( event instanceof ICDIChangedEvent ) {
|
else if ( event instanceof ICDIChangedEvent ) {
|
||||||
if ( source instanceof ICDIThread ) {
|
|
||||||
handleChangedEvent( (ICDIChangedEvent)event );
|
handleChangedEvent( (ICDIChangedEvent)event );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -398,7 +388,8 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
|
||||||
* @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
|
* @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
|
||||||
*/
|
*/
|
||||||
public boolean 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)
|
/* (non-Javadoc)
|
||||||
|
@ -566,14 +557,14 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
|
||||||
IStackFrame[] frames = getStackFrames();
|
IStackFrame[] frames = getStackFrames();
|
||||||
if ( frames.length == 0 )
|
if ( frames.length == 0 )
|
||||||
return;
|
return;
|
||||||
final IStackFrame f = frames[0];
|
final CStackFrame f = (CStackFrame)frames[0];
|
||||||
final CDebugElementState oldState = getState();
|
final CDebugElementState oldState = getState();
|
||||||
setState( CDebugElementState.STEPPING );
|
setState( CDebugElementState.STEPPING );
|
||||||
DebugPlugin.getDefault().asyncExec( new Runnable() {
|
DebugPlugin.getDefault().asyncExec( new Runnable() {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
f.stepReturn();
|
f.doStepReturn();
|
||||||
}
|
}
|
||||||
catch( DebugException e ) {
|
catch( DebugException e ) {
|
||||||
setState( oldState );
|
setState( oldState );
|
||||||
|
|
Loading…
Add table
Reference in a new issue