mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 11:15:38 +02:00
Pass ILaunch instead of ILaunchConfiguration.
Added "getGDBPath" method.
This commit is contained in:
parent
6f5a1ad81c
commit
7a09933b77
5 changed files with 35 additions and 17 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2006-03-23 Mikhail Khodjaiants
|
||||||
|
Pass ILaunch instead of ILaunchConfiguration.
|
||||||
|
Added "getGDBPath" method.
|
||||||
|
* AbstractGDBCDIDebugger.java
|
||||||
|
* CygwinGDBCDIDebugger2.java
|
||||||
|
* GDBCDIDebugger2.java
|
||||||
|
* GDBServerCDIDebugger2.java
|
||||||
|
|
||||||
2006-03-23 Mikhail Khodjaiants
|
2006-03-23 Mikhail Khodjaiants
|
||||||
Added default attribute value for ATTR_DEBUG_NAME.
|
Added default attribute value for ATTR_DEBUG_NAME.
|
||||||
* IMILaunchConfigurationConstants.java
|
* IMILaunchConfigurationConstants.java
|
||||||
|
|
|
@ -24,11 +24,13 @@ import org.eclipse.cdt.debug.mi.core.cdi.Session;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
|
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.MultiStatus;
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
import org.eclipse.debug.core.ILaunch;
|
import org.eclipse.debug.core.ILaunch;
|
||||||
|
@ -59,14 +61,13 @@ abstract public class AbstractGDBCDIDebugger implements ICDIDebugger2 {
|
||||||
if ( monitor.isCanceled() ) {
|
if ( monitor.isCanceled() ) {
|
||||||
throw new OperationCanceledException();
|
throw new OperationCanceledException();
|
||||||
}
|
}
|
||||||
ILaunchConfiguration config = launch.getLaunchConfiguration();
|
Session session = createGDBSession( launch, executable, monitor );
|
||||||
Session session = createGDBSession( config, executable, monitor );
|
|
||||||
if ( session != null ) {
|
if ( session != null ) {
|
||||||
ICDITarget[] targets = session.getTargets();
|
ICDITarget[] targets = session.getTargets();
|
||||||
for( int i = 0; i < targets.length; i++ ) {
|
for( int i = 0; i < targets.length; i++ ) {
|
||||||
Process debugger = session.getSessionProcess( targets[i] );
|
Process debugger = session.getSessionProcess( targets[i] );
|
||||||
if ( debugger != null ) {
|
if ( debugger != null ) {
|
||||||
IProcess debuggerProcess = DebugPlugin.newProcess( launch, debugger, renderDebuggerProcessLabel( config ) );
|
IProcess debuggerProcess = DebugPlugin.newProcess( launch, debugger, renderDebuggerProcessLabel( launch ) );
|
||||||
launch.addProcess( debuggerProcess );
|
launch.addProcess( debuggerProcess );
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -79,7 +80,7 @@ abstract public class AbstractGDBCDIDebugger implements ICDIDebugger2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
doStartSession( launch, config, session, monitor );
|
doStartSession( launch, session, monitor );
|
||||||
}
|
}
|
||||||
catch( CoreException e ) {
|
catch( CoreException e ) {
|
||||||
failed = true;
|
failed = true;
|
||||||
|
@ -96,13 +97,14 @@ abstract public class AbstractGDBCDIDebugger implements ICDIDebugger2 {
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Session createGDBSession( ILaunchConfiguration config, File executable, IProgressMonitor monitor ) throws CoreException {
|
protected Session createGDBSession( ILaunch launch, File executable, IProgressMonitor monitor ) throws CoreException {
|
||||||
String gdb = config.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" ); //$NON-NLS-1$
|
IPath gdbPath = getGDBPath( launch );
|
||||||
|
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 {
|
||||||
return MIPlugin.getDefault().createSession( getSessionType( config ), gdb, factory, executable, extraArgs, usePty, monitor );
|
return MIPlugin.getDefault().createSession( getSessionType( config ), gdbPath.toOSString(), factory, executable, extraArgs, usePty, monitor );
|
||||||
}
|
}
|
||||||
catch( Exception e ) {
|
catch( Exception e ) {
|
||||||
// Catch all wrap them up and rethrow
|
// Catch all wrap them up and rethrow
|
||||||
|
@ -130,21 +132,26 @@ abstract public class AbstractGDBCDIDebugger implements ICDIDebugger2 {
|
||||||
|
|
||||||
abstract protected CommandFactory getCommandFactory( ILaunchConfiguration config ) throws CoreException;
|
abstract protected CommandFactory getCommandFactory( ILaunchConfiguration config ) throws CoreException;
|
||||||
|
|
||||||
protected void doStartSession( ILaunch launch, ILaunchConfiguration config, Session session, IProgressMonitor monitor ) throws CoreException {
|
protected void doStartSession( ILaunch launch, Session session, IProgressMonitor monitor ) throws CoreException {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String renderDebuggerProcessLabel( ILaunchConfiguration config ) {
|
protected String renderDebuggerProcessLabel( ILaunch launch ) {
|
||||||
String format = "{0} ({1})"; //$NON-NLS-1$
|
String format = "{0} ({1})"; //$NON-NLS-1$
|
||||||
String timestamp = DateFormat.getInstance().format( new Date( System.currentTimeMillis() ) );
|
String timestamp = DateFormat.getInstance().format( new Date( System.currentTimeMillis() ) );
|
||||||
String label = MIPlugin.getResourceString( "src.AbstractGDBCDIDebugger.0" ); //$NON-NLS-1$
|
String label = MIPlugin.getResourceString( "src.AbstractGDBCDIDebugger.0" ); //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
label = config.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" ); //$NON-NLS-1$
|
IPath path = getGDBPath( launch );
|
||||||
|
label = path.toOSString();
|
||||||
}
|
}
|
||||||
catch( CoreException e ) {
|
catch( CoreException e ) {
|
||||||
}
|
}
|
||||||
return MessageFormat.format( format, new String[]{ label, timestamp } );
|
return MessageFormat.format( format, new String[]{ label, timestamp } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected IPath getGDBPath( ILaunch launch ) throws CoreException {
|
||||||
|
ILaunchConfiguration config = launch.getLaunchConfiguration();
|
||||||
|
return new Path( config.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT ) );
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Throws a core exception with an error status object built from
|
* Throws a core exception with an error status object built from
|
||||||
* the lower level exception and error code.
|
* the lower level exception and error code.
|
||||||
|
|
|
@ -33,9 +33,9 @@ public class CygwinGDBCDIDebugger2 extends GDBCDIDebugger2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.mi.core.GDBCDIDebugger2#doStartSession(org.eclipse.debug.core.ILaunch, org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.cdt.debug.mi.core.cdi.Session, org.eclipse.core.runtime.IProgressMonitor)
|
* @see org.eclipse.cdt.debug.mi.core.GDBCDIDebugger2#doStartSession(org.eclipse.debug.core.ILaunch, org.eclipse.cdt.debug.mi.core.cdi.Session, org.eclipse.core.runtime.IProgressMonitor)
|
||||||
*/
|
*/
|
||||||
protected void doStartSession( ILaunch launch, ILaunchConfiguration config, Session session, IProgressMonitor monitor ) throws CoreException {
|
protected void doStartSession( ILaunch launch, Session session, IProgressMonitor monitor ) throws CoreException {
|
||||||
// For windows we need to start the inferior in a new console window
|
// For windows we need to start the inferior in a new console window
|
||||||
// to separate the Inferior std{in,out,err} from gdb std{in,out,err}
|
// to separate the Inferior std{in,out,err} from gdb std{in,out,err}
|
||||||
MISession miSession = getMISession( session );
|
MISession miSession = getMISession( session );
|
||||||
|
@ -52,7 +52,7 @@ public class CygwinGDBCDIDebugger2 extends GDBCDIDebugger2 {
|
||||||
// We ignore this exception, for example
|
// We ignore this exception, for example
|
||||||
// on GNU/Linux the new-console is an error.
|
// on GNU/Linux the new-console is an error.
|
||||||
}
|
}
|
||||||
super.doStartSession( launch, config, session, monitor );
|
super.doStartSession( launch, session, monitor );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -97,9 +97,10 @@ public class GDBCDIDebugger2 extends AbstractGDBCDIDebugger {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.mi.core.AbstractGDBCDIDebugger#doStartSession(org.eclipse.debug.core.ILaunch, org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.cdt.debug.mi.core.cdi.Session, org.eclipse.core.runtime.IProgressMonitor)
|
* @see org.eclipse.cdt.debug.mi.core.AbstractGDBCDIDebugger#doStartSession(org.eclipse.debug.core.ILaunch, org.eclipse.cdt.debug.mi.core.cdi.Session, org.eclipse.core.runtime.IProgressMonitor)
|
||||||
*/
|
*/
|
||||||
protected void doStartSession( ILaunch launch, ILaunchConfiguration config, Session session, IProgressMonitor monitor ) throws CoreException {
|
protected void doStartSession( ILaunch launch, Session session, IProgressMonitor monitor ) throws CoreException {
|
||||||
|
ILaunchConfiguration config = launch.getLaunchConfiguration();
|
||||||
initializeLibraries( config, session );
|
initializeLibraries( config, session );
|
||||||
if ( monitor.isCanceled() ) {
|
if ( monitor.isCanceled() ) {
|
||||||
throw new OperationCanceledException();
|
throw new OperationCanceledException();
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
|
import org.eclipse.debug.core.ILaunch;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,9 +30,10 @@ import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
public class GDBServerCDIDebugger2 extends GDBCDIDebugger2 {
|
public class GDBServerCDIDebugger2 extends GDBCDIDebugger2 {
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.mi.core.GDBCDIDebugger2#doStartSession(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.cdt.debug.mi.core.cdi.Session, org.eclipse.core.runtime.IProgressMonitor)
|
* @see org.eclipse.cdt.debug.mi.core.GDBCDIDebugger2#doStartSession(org.eclipse.debug.core.ILaunch, org.eclipse.cdt.debug.mi.core.cdi.Session, org.eclipse.core.runtime.IProgressMonitor)
|
||||||
*/
|
*/
|
||||||
protected void doStartSession( ILaunchConfiguration config, Session session, IProgressMonitor monitor ) throws CoreException {
|
protected void doStartSession( ILaunch launch, Session session, IProgressMonitor monitor ) throws CoreException {
|
||||||
|
ILaunchConfiguration config = launch.getLaunchConfiguration();
|
||||||
initializeLibraries( config, session );
|
initializeLibraries( config, session );
|
||||||
if ( monitor.isCanceled() ) {
|
if ( monitor.isCanceled() ) {
|
||||||
throw new OperationCanceledException();
|
throw new OperationCanceledException();
|
||||||
|
|
Loading…
Add table
Reference in a new issue