1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 01:36:01 +02:00

Bugzilla Bug 156707: A failed operation (e.g., resume) can leave the CDebugTarget in an invalid run state.

This commit is contained in:
Mikhail Khodjaiants 2006-09-11 17:22:22 +00:00
parent d72e22ac05
commit 4dda6937d9
2 changed files with 34 additions and 12 deletions

View file

@ -1,3 +1,7 @@
2006-09-11 Mikhail Khodjaiants
Bugzilla Bug 156707: A failed operation (e.g., resume) can leave the CDebugTarget in an invalid run state.
* CDebugTarget.java
2006-08-29 Mikhail Khodjaiants 2006-08-29 Mikhail Khodjaiants
Bug 155275: Exception when stepping. Bug 155275: Exception when stepping.
* CThread.java * CThread.java

View file

@ -496,12 +496,15 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
if ( !canTerminate() ) { if ( !canTerminate() ) {
return; return;
} }
changeState( CDebugElementState.TERMINATING ); final CDebugElementState newState = CDebugElementState.TERMINATING;
changeState( newState );
try { try {
getCDITarget().terminate(); getCDITarget().terminate();
} }
catch( CDIException e ) { catch( CDIException e ) {
restoreOldState(); if ( getState() == newState ) {
restoreOldState();
}
targetRequestFailed( e.getMessage(), null ); targetRequestFailed( e.getMessage(), null );
} }
} }
@ -545,12 +548,15 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
public void resume() throws DebugException { public void resume() throws DebugException {
if ( !canResume() ) if ( !canResume() )
return; return;
changeState( CDebugElementState.RESUMING ); final CDebugElementState newState = CDebugElementState.RESUMING;
changeState( newState );
try { try {
getCDITarget().resume( false ); getCDITarget().resume( false );
} }
catch( CDIException e ) { catch( CDIException e ) {
restoreOldState(); if ( getState() == newState ) {
restoreOldState();
}
targetRequestFailed( e.getMessage(), null ); targetRequestFailed( e.getMessage(), null );
} }
} }
@ -561,12 +567,15 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
public void suspend() throws DebugException { public void suspend() throws DebugException {
if ( !canSuspend() ) if ( !canSuspend() )
return; return;
changeState( CDebugElementState.SUSPENDING ); final CDebugElementState newState = CDebugElementState.SUSPENDING;
changeState( newState );
try { try {
getCDITarget().suspend(); getCDITarget().suspend();
} }
catch( CDIException e ) { catch( CDIException e ) {
restoreOldState(); if ( getState() == newState ) {
restoreOldState();
}
targetRequestFailed( e.getMessage(), null ); targetRequestFailed( e.getMessage(), null );
} }
} }
@ -697,12 +706,15 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
if ( isDisconnecting() ) { if ( isDisconnecting() ) {
return; return;
} }
changeState( CDebugElementState.DISCONNECTING ); final CDebugElementState newState = CDebugElementState.DISCONNECTING;
changeState( newState );
try { try {
getCDITarget().disconnect(); getCDITarget().disconnect();
} }
catch( CDIException e ) { catch( CDIException e ) {
restoreOldState(); if ( getState() == newState ) {
restoreOldState();
}
targetRequestFailed( e.getMessage(), null ); targetRequestFailed( e.getMessage(), null );
} }
} }
@ -896,12 +908,15 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
} }
ICDILocation location = getCDITarget().createFunctionLocation( "", mainSymbol ); //$NON-NLS-1$ ICDILocation location = getCDITarget().createFunctionLocation( "", mainSymbol ); //$NON-NLS-1$
setInternalTemporaryBreakpoint( location ); setInternalTemporaryBreakpoint( location );
changeState( CDebugElementState.RESTARTING ); final CDebugElementState newState = CDebugElementState.RESTARTING;
changeState( newState );
try { try {
getCDITarget().restart(); getCDITarget().restart();
} }
catch( CDIException e ) { catch( CDIException e ) {
restoreOldState(); if ( getState() == newState ) {
restoreOldState();
}
targetRequestFailed( e.getMessage(), e ); targetRequestFailed( e.getMessage(), e );
} }
} }
@ -1403,12 +1418,15 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
public void resumeWithoutSignal() throws DebugException { public void resumeWithoutSignal() throws DebugException {
if ( !canResume() ) if ( !canResume() )
return; return;
changeState( CDebugElementState.RESUMING ); final CDebugElementState newState = CDebugElementState.RESUMING;
changeState( newState );
try { try {
getCDITarget().resume( false ); getCDITarget().resume( false );
} }
catch( CDIException e ) { catch( CDIException e ) {
restoreOldState(); if ( getState() == newState ) {
restoreOldState();
}
targetRequestFailed( e.getMessage(), e ); targetRequestFailed( e.getMessage(), e );
} }
} }