1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Replaced the 'IProject' argument by 'IFile' in the debug target factory methods.

This commit is contained in:
Mikhail Khodjaiants 2002-11-01 17:15:50 +00:00
parent 103447277e
commit f58a8c96ee
3 changed files with 200 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2002-10-31 Mikhail Khodjaiants
Replaced the 'IProject' argument by 'IFile' in the debug target factory methods.
* CDebugModel.java
* CDebugTarget.java
2002-10-31 Mikhail Khodjaiants 2002-10-31 Mikhail Khodjaiants
Fixed the synchronization bug. Fixed the synchronization bug.
* CFormattedMemoryBlock.java * CFormattedMemoryBlock.java

View file

@ -25,6 +25,7 @@ import org.eclipse.cdt.debug.internal.core.breakpoints.CWatchpoint;
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
import org.eclipse.cdt.debug.internal.core.model.CExpression; import org.eclipse.cdt.debug.internal.core.model.CExpression;
import org.eclipse.cdt.debug.internal.core.model.CFormattedMemoryBlock; import org.eclipse.cdt.debug.internal.core.model.CFormattedMemoryBlock;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
@ -91,6 +92,7 @@ public class CDebugModel
* @param stopInMain whether to set a temporary breakpoint in main. * @param stopInMain whether to set a temporary breakpoint in main.
* @return a debug target * @return a debug target
*/ */
/*
public static IDebugTarget newDebugTarget( final ILaunch launch, public static IDebugTarget newDebugTarget( final ILaunch launch,
final ICDITarget cdiTarget, final ICDITarget cdiTarget,
final String name, final String name,
@ -141,7 +143,7 @@ public class CDebugModel
return target[0]; return target[0];
} }
*/
public static IDebugTarget newDebugTarget( final ILaunch launch, public static IDebugTarget newDebugTarget( final ILaunch launch,
final ICDITarget cdiTarget, final ICDITarget cdiTarget,
final String name, final String name,
@ -194,6 +196,58 @@ public class CDebugModel
return target[0]; return target[0];
} }
public static IDebugTarget newDebugTarget( final ILaunch launch,
final ICDITarget cdiTarget,
final String name,
final IProcess debuggeeProcess,
final IProcess debuggerProcess,
final IFile file,
final boolean allowTerminate,
final boolean allowDisconnect,
final boolean stopInMain ) throws DebugException
{
final IDebugTarget[] target = new IDebugTarget[1];
IWorkspaceRunnable r = new IWorkspaceRunnable()
{
public void run( IProgressMonitor m )
{
target[0] = new CDebugTarget( launch,
ICDebugTargetType.TARGET_TYPE_LOCAL_RUN,
cdiTarget,
name,
debuggeeProcess,
debuggerProcess,
file,
allowTerminate,
allowDisconnect );
}
};
try
{
ResourcesPlugin.getWorkspace().run( r, null );
}
catch( CoreException e )
{
CDebugCorePlugin.log( e );
throw new DebugException( e.getStatus() );
}
ICDIConfiguration config = cdiTarget.getSession().getConfiguration();
if ( config.supportsBreakpoints() && stopInMain )
{
stopInMain( (CDebugTarget)target[0] );
}
if ( config.supportsResume() )
{
target[0].resume();
}
return target[0];
}
/*
public static IDebugTarget newAttachDebugTarget( final ILaunch launch, public static IDebugTarget newAttachDebugTarget( final ILaunch launch,
final ICDITarget cdiTarget, final ICDITarget cdiTarget,
final String name, final String name,
@ -242,7 +296,7 @@ public class CDebugModel
return target[0]; return target[0];
} }
*/
public static IDebugTarget newAttachDebugTarget( final ILaunch launch, public static IDebugTarget newAttachDebugTarget( final ILaunch launch,
final ICDITarget cdiTarget, final ICDITarget cdiTarget,
final String name, final String name,
@ -293,6 +347,56 @@ public class CDebugModel
return target[0]; return target[0];
} }
public static IDebugTarget newAttachDebugTarget( final ILaunch launch,
final ICDITarget cdiTarget,
final String name,
final IProcess debuggerProcess,
final IFile file ) throws DebugException
{
final IDebugTarget[] target = new IDebugTarget[1];
IWorkspaceRunnable r = new IWorkspaceRunnable()
{
public void run( IProgressMonitor m )
{
target[0] = new CDebugTarget( launch,
ICDebugTargetType.TARGET_TYPE_LOCAL_ATTACH,
cdiTarget,
name,
null,
debuggerProcess,
file,
false,
true );
}
};
try
{
ResourcesPlugin.getWorkspace().run( r, null );
}
catch( CoreException e )
{
CDebugCorePlugin.log( e );
throw new DebugException( e.getStatus() );
}
((CDebugTarget)target[0]).handleDebugEvent( new ICDISuspendedEvent()
{
public ICDISessionObject getReason()
{
return null;
}
public ICDIObject getSource()
{
return cdiTarget;
}
} );
return target[0];
}
/*
public static IDebugTarget newCoreFileDebugTarget( final ILaunch launch, public static IDebugTarget newCoreFileDebugTarget( final ILaunch launch,
final ICDITarget cdiTarget, final ICDITarget cdiTarget,
final String name, final String name,
@ -341,7 +445,7 @@ public class CDebugModel
return target[0]; return target[0];
} }
*/
public static IDebugTarget newCoreFileDebugTarget( final ILaunch launch, public static IDebugTarget newCoreFileDebugTarget( final ILaunch launch,
final ICDITarget cdiTarget, final ICDITarget cdiTarget,
final String name, final String name,
@ -392,6 +496,56 @@ public class CDebugModel
return target[0]; return target[0];
} }
public static IDebugTarget newCoreFileDebugTarget( final ILaunch launch,
final ICDITarget cdiTarget,
final String name,
final IProcess debuggerProcess,
final IFile file ) throws DebugException
{
final IDebugTarget[] target = new IDebugTarget[1];
IWorkspaceRunnable r = new IWorkspaceRunnable()
{
public void run( IProgressMonitor m )
{
target[0] = new CDebugTarget( launch,
ICDebugTargetType.TARGET_TYPE_LOCAL_CORE_DUMP,
cdiTarget,
name,
null,
debuggerProcess,
file,
true,
false );
}
};
try
{
ResourcesPlugin.getWorkspace().run( r, null );
}
catch( CoreException e )
{
CDebugCorePlugin.log( e );
throw new DebugException( e.getStatus() );
}
((CDebugTarget)target[0]).handleDebugEvent( new ICDISuspendedEvent()
{
public ICDISessionObject getReason()
{
return null;
}
public ICDIObject getSource()
{
return cdiTarget;
}
} );
return target[0];
}
/** /**
* Returns a C/C++ line breakpoint that is already registered with the breakpoint * Returns a C/C++ line breakpoint that is already registered with the breakpoint
* manager for a file with the given name at the given line number. * manager for a file with the given name at the given line number.

View file

@ -63,6 +63,7 @@ import org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLocator; import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLocator;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager; import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager;
import org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager; import org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarkerDelta; import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
@ -251,6 +252,43 @@ public class CDebugTarget extends CDebugElement
getCDISession().getEventManager().addEventListener( this ); getCDISession().getEventManager().addEventListener( this );
} }
/**
* Constructor for CDebugTarget.
* @param target
*/
public CDebugTarget( ILaunch launch,
int targetType,
ICDITarget cdiTarget,
String name,
IProcess debuggeeProcess,
IProcess debuggerProcess,
IFile file,
boolean allowsTerminate,
boolean allowsDisconnect )
{
super( null );
setLaunch( launch );
setTargetType( targetType );
setDebugTarget( this );
setName( name );
setProcesses( debuggeeProcess, debuggerProcess );
setCDITarget( cdiTarget );
setBreakpoints( new HashMap( 5 ) );
setTemporaryBreakpoints( new ArrayList() );
if ( file != null )
{
getLaunch().setSourceLocator( createSourceLocator( file.getProject() ) );
}
setConfiguration( cdiTarget.getSession().getConfiguration() );
fSupportsTerminate = allowsTerminate & getConfiguration().supportsTerminate();
fSupportsDisconnect = allowsDisconnect & getConfiguration().supportsDisconnect();
setThreadList( new ArrayList( 5 ) );
initialize();
DebugPlugin.getDefault().getLaunchManager().addLaunchListener( this );
DebugPlugin.getDefault().getExpressionManager().addExpressionListener( this );
getCDISession().getEventManager().addEventListener( this );
}
/** /**
* Initialize state from the underlying debug session. * Initialize state from the underlying debug session.
* *