1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Corrected position of the "try-catch-finally" clause in createSession.

This commit is contained in:
Mikhail Khodjaiants 2006-03-31 20:05:01 +00:00
parent ae43d3b681
commit 67a47ed1f9
2 changed files with 33 additions and 28 deletions

View file

@ -1,3 +1,7 @@
2006-03-31 Mikhail Khodjaiants
Corrected position of the "try-catch-finally" clause in createSession.
* AbstractGDBCDIDebugger.java
2006-03-31 Mikhail Khodjaiants 2006-03-31 Mikhail Khodjaiants
Throw OperationCanceledException instead of IOException when getGDBprocess is canceled. Throw OperationCanceledException instead of IOException when getGDBprocess is canceled.
* MIProcessAdapter.java * MIProcessAdapter.java

View file

@ -64,53 +64,53 @@ abstract public class AbstractGDBCDIDebugger implements ICDIDebugger2 {
} }
Session session = createGDBSession( launch, executable, monitor ); Session session = createGDBSession( launch, executable, monitor );
if ( session != null ) { if ( session != null ) {
ICDITarget[] targets = session.getTargets(); try {
for( int i = 0; i < targets.length; i++ ) { ICDITarget[] targets = session.getTargets();
Process debugger = session.getSessionProcess( targets[i] ); for( int i = 0; i < targets.length; i++ ) {
if ( debugger != null ) { Process debugger = session.getSessionProcess( targets[i] );
IProcess debuggerProcess = DebugPlugin.newProcess( launch, debugger, renderDebuggerProcessLabel( launch ) ); if ( debugger != null ) {
launch.addProcess( debuggerProcess ); IProcess debuggerProcess = DebugPlugin.newProcess( launch, debugger, renderDebuggerProcessLabel( launch ) );
} launch.addProcess( debuggerProcess );
try { }
((Target)targets[i]).getMISession().start(); ((Target)targets[i]).getMISession().start();
} }
catch( MIException e ) { doStartSession( launch, session, monitor );
failed = true; }
throw newCoreException( e ); catch( MIException e ) {
failed = true;
throw newCoreException( e );
}
catch( CoreException e ) {
failed = true;
throw e;
}
finally {
try {
if ( (failed || monitor.isCanceled()) && session != null )
session.terminate();
}
catch( CDIException e1 ) {
} }
}
}
try {
doStartSession( launch, session, monitor );
}
catch( CoreException e ) {
failed = true;
throw e;
}
finally {
try {
if ( failed || monitor.isCanceled() )
session.terminate();
}
catch( CDIException e1 ) {
} }
} }
return session; return session;
} }
protected Session createGDBSession( ILaunch launch, File executable, IProgressMonitor monitor ) throws CoreException { protected Session createGDBSession( ILaunch launch, File executable, IProgressMonitor monitor ) throws CoreException {
Session session = null;
IPath gdbPath = getGDBPath( launch ); IPath gdbPath = getGDBPath( launch );
ILaunchConfiguration config = launch.getLaunchConfiguration(); ILaunchConfiguration config = launch.getLaunchConfiguration();
CommandFactory factory = getCommandFactory( config ); CommandFactory factory = getCommandFactory( config );
String[] extraArgs = getExtraArguments( config ); String[] extraArgs = getExtraArguments( config );
boolean usePty = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, true ); boolean usePty = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, true );
try { try {
Session session = MIPlugin.getDefault().createSession( getSessionType( config ), gdbPath.toOSString(), factory, executable, extraArgs, usePty, monitor ); session = MIPlugin.getDefault().createSession( getSessionType( config ), gdbPath.toOSString(), factory, executable, extraArgs, usePty, monitor );
ICDISessionConfiguration sessionConfig = getSessionConfiguration( session ); ICDISessionConfiguration sessionConfig = getSessionConfiguration( session );
if ( sessionConfig != null ) { if ( sessionConfig != null ) {
session.setConfiguration( sessionConfig ); session.setConfiguration( sessionConfig );
} }
return session; }
catch( OperationCanceledException e ) {
} }
catch( Exception e ) { catch( Exception e ) {
// Catch all wrap them up and rethrow // Catch all wrap them up and rethrow
@ -119,6 +119,7 @@ abstract public class AbstractGDBCDIDebugger implements ICDIDebugger2 {
} }
throw newCoreException( e ); throw newCoreException( e );
} }
return session;
} }
protected int getSessionType( ILaunchConfiguration config ) throws CoreException { protected int getSessionType( ILaunchConfiguration config ) throws CoreException {