1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-13 03:05:39 +02:00

Use the asynchronous implementation for resume, suspend, step etc provided by eclipse 3.1.

This commit is contained in:
Mikhail Khodjaiants 2005-01-10 22:52:06 +00:00
parent 0f2803f134
commit c796aad342
4 changed files with 83 additions and 148 deletions

View file

@ -1,3 +1,9 @@
2005-01-10 Mikhail Khodjaiants
Use the asynchronous implementation for resume, suspend, step etc provided by eclipse 3.1.
* CDebugTarget.java
* CThread.java
* CoreModelMessages.properties
2005-01-10 Mikhail Khodjaiants 2005-01-10 Mikhail Khodjaiants
Bug 73168: Use memory view provided by Eclipse platform in CDT. Bug 73168: Use memory view provided by Eclipse platform in CDT.
* ICType.java * ICType.java

View file

@ -449,23 +449,13 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
return; return;
} }
changeState( CDebugElementState.TERMINATING ); changeState( CDebugElementState.TERMINATING );
DebugPlugin.getDefault().asyncExec( new Runnable() {
public void run() {
try { try {
getCDITarget().terminate(); getCDITarget().terminate();
} }
catch( CDIException e ) { catch( CDIException e ) {
restoreOldState(); restoreOldState();
try { targetRequestFailed( e.getMessage(), null );
targetRequestFailed( e.getMessage(), e );
} }
catch( DebugException e1 ) {
failed( CoreModelMessages.getString( "CDebugTarget.2" ), e1 ); //$NON-NLS-1$
}
}
}
} );
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -508,23 +498,13 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
if ( !canResume() ) if ( !canResume() )
return; return;
changeState( CDebugElementState.RESUMING ); changeState( CDebugElementState.RESUMING );
DebugPlugin.getDefault().asyncExec( new Runnable() {
public void run() {
try { try {
getCDITarget().resume( false ); getCDITarget().resume( false );
} }
catch( CDIException e ) { catch( CDIException e ) {
restoreOldState(); restoreOldState();
try { targetRequestFailed( e.getMessage(), null );
targetRequestFailed( e.getMessage(), e );
} }
catch( DebugException e1 ) {
failed( CoreModelMessages.getString( "CDebugTarget.3" ), e1 ); //$NON-NLS-1$
}
}
}
} );
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -534,23 +514,13 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
if ( !canSuspend() ) if ( !canSuspend() )
return; return;
changeState( CDebugElementState.SUSPENDING ); changeState( CDebugElementState.SUSPENDING );
DebugPlugin.getDefault().asyncExec( new Runnable() {
public void run() {
try { try {
getCDITarget().suspend(); getCDITarget().suspend();
} }
catch( CDIException e ) { catch( CDIException e ) {
restoreOldState(); restoreOldState();
try { targetRequestFailed( e.getMessage(), null );
targetRequestFailed( e.getMessage(), e );
} }
catch( DebugException e1 ) {
failed( CoreModelMessages.getString( "CDebugTarget.4" ), e1 ); //$NON-NLS-1$
}
}
}
} );
} }
protected boolean isSuspending() { protected boolean isSuspending() {
@ -736,23 +706,13 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
return; return;
} }
changeState( CDebugElementState.DISCONNECTING ); changeState( CDebugElementState.DISCONNECTING );
DebugPlugin.getDefault().asyncExec( new Runnable() {
public void run() {
try { try {
getCDITarget().disconnect(); getCDITarget().disconnect();
} }
catch( CDIException e ) { catch( CDIException e ) {
restoreOldState(); restoreOldState();
try { targetRequestFailed( e.getMessage(), null );
targetRequestFailed( e.getMessage(), e );
} }
catch( DebugException e1 ) {
failed( CoreModelMessages.getString( "CDebugTarget.5" ), e1 ); //$NON-NLS-1$
}
}
}
} );
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -50,7 +50,6 @@ import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IMemoryBlockRetrieval; import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
import org.eclipse.debug.core.model.IStackFrame; import org.eclipse.debug.core.model.IStackFrame;
@ -405,21 +404,16 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
public void resume() throws DebugException { public void resume() throws DebugException {
if ( !canResume() ) if ( !canResume() )
return; return;
final CDebugElementState oldState = getState(); CDebugElementState oldState = getState();
setState( CDebugElementState.RESUMING ); setState( CDebugElementState.RESUMING );
DebugPlugin.getDefault().asyncExec( new Runnable() {
public void run() {
try { try {
getCDIThread().resume( false ); getCDIThread().resume( false );
} }
catch( CDIException e ) { catch( CDIException e ) {
setState( oldState ); setState( oldState );
failed( CoreModelMessages.getString( "CThread.2" ), e ); //$NON-NLS-1$ targetRequestFailed( e.getMessage(), null );
} }
} }
} );
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.debug.core.model.ISuspendResume#suspend() * @see org.eclipse.debug.core.model.ISuspendResume#suspend()
@ -427,21 +421,16 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
public void suspend() throws DebugException { public void suspend() throws DebugException {
if ( !canSuspend() ) if ( !canSuspend() )
return; return;
final CDebugElementState oldState = getState(); CDebugElementState oldState = getState();
setState( CDebugElementState.SUSPENDING ); setState( CDebugElementState.SUSPENDING );
DebugPlugin.getDefault().asyncExec( new Runnable() {
public void run() {
try { try {
getCDITarget().suspend(); getCDITarget().suspend();
} }
catch( CDIException e ) { catch( CDIException e ) {
setState( oldState ); setState( oldState );
failed( CoreModelMessages.getString( "CThread.3" ), e ); //$NON-NLS-1$ targetRequestFailed( e.getMessage(), null );
} }
} }
} );
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#canStepInto() * @see org.eclipse.debug.core.model.IStep#canStepInto()
@ -492,11 +481,8 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
public void stepInto() throws DebugException { public void stepInto() throws DebugException {
if ( !canStepInto() ) if ( !canStepInto() )
return; return;
final CDebugElementState oldState = getState(); CDebugElementState oldState = getState();
setState( CDebugElementState.STEPPING ); setState( CDebugElementState.STEPPING );
DebugPlugin.getDefault().asyncExec( new Runnable() {
public void run() {
try { try {
if ( !isInstructionsteppingEnabled() ) { if ( !isInstructionsteppingEnabled() ) {
getCDIThread().stepInto( 1 ); getCDIThread().stepInto( 1 );
@ -507,11 +493,9 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
} }
catch( CDIException e ) { catch( CDIException e ) {
setState( oldState ); setState( oldState );
failed( CoreModelMessages.getString( "CThread.4" ), e ); //$NON-NLS-1$ targetRequestFailed( e.getMessage(), null );
} }
} }
} );
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#stepOver() * @see org.eclipse.debug.core.model.IStep#stepOver()
@ -519,11 +503,8 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
public void stepOver() throws DebugException { public void stepOver() throws DebugException {
if ( !canStepOver() ) if ( !canStepOver() )
return; return;
final CDebugElementState oldState = getState(); CDebugElementState oldState = getState();
setState( CDebugElementState.STEPPING ); setState( CDebugElementState.STEPPING );
DebugPlugin.getDefault().asyncExec( new Runnable() {
public void run() {
try { try {
if ( !isInstructionsteppingEnabled() ) { if ( !isInstructionsteppingEnabled() ) {
getCDIThread().stepOver( 1 ); getCDIThread().stepOver( 1 );
@ -534,11 +515,9 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum
} }
catch( CDIException e ) { catch( CDIException e ) {
setState( oldState ); setState( oldState );
failed( CoreModelMessages.getString( "CThread.5" ), e ); //$NON-NLS-1$ targetRequestFailed( e.getMessage(), null );
} }
} }
} );
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#stepReturn() * @see org.eclipse.debug.core.model.IStep#stepReturn()
@ -549,22 +528,17 @@ 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 CStackFrame f = (CStackFrame)frames[0]; CStackFrame f = (CStackFrame)frames[0];
final CDebugElementState oldState = getState(); CDebugElementState oldState = getState();
setState( CDebugElementState.STEPPING ); setState( CDebugElementState.STEPPING );
DebugPlugin.getDefault().asyncExec( new Runnable() {
public void run() {
try { try {
f.doStepReturn(); f.doStepReturn();
} }
catch( DebugException e ) { catch( DebugException e ) {
setState( oldState ); setState( oldState );
failed( CoreModelMessages.getString( "CThread.6" ), e ); //$NON-NLS-1$ throw e;
} }
} }
} );
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.debug.core.model.ITerminate#canTerminate() * @see org.eclipse.debug.core.model.ITerminate#canTerminate()

View file

@ -23,11 +23,6 @@ CModificationVariable.1=Unable to set value.
CStackFrame.0={0} at {1}: {2} CStackFrame.0={0} at {1}: {2}
CThread.0=Stack is not available: {0}. CThread.0=Stack is not available: {0}.
CThread.1=Stack is not available: {0}. CThread.1=Stack is not available: {0}.
CThread.2=Resume failed.
CThread.3=Suspend failed.
CThread.4=Step failed.
CThread.5=Step failed.
CThread.6=Step failed.
CValue.0=not available: {0} CValue.0=not available: {0}
CVariable.0=not available: {0} CVariable.0=not available: {0}
CVariable.1=not available: {0} CVariable.1=not available: {0}