mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 09:25:31 +02:00
Support for debugger console.
This commit is contained in:
parent
7a85d3715d
commit
97fc7f02f3
4 changed files with 231 additions and 10 deletions
|
@ -1,3 +1,10 @@
|
|||
2002-10-23 Mikhail Khodjaiants
|
||||
Support for debugger console.
|
||||
* CDebugModel.java: new factory methods for CDebugTarget
|
||||
* IDebuggerProcessSupport: new interface that defines the debugger
|
||||
process support functionality.
|
||||
* CDebugTarget.java: implementation of IDebuggerProcessSupport interface.
|
||||
|
||||
2002-10-22 Alain Magloire
|
||||
|
||||
* src/.../cdi/ICDISession.java (getSessionProcess):
|
||||
|
|
|
@ -73,8 +73,8 @@ public class CDebugModel
|
|||
/**
|
||||
* Creates and returns a debug target for the given CDI target, with
|
||||
* the specified name, and associates the debug target with the
|
||||
* given process for console I/O. The allow terminate flag specifies whether
|
||||
* the debug target will support termination (<code>ITerminate</code>).
|
||||
* given process for console I/O. The allow terminate flag specifies
|
||||
* whether the debug target will support termination (<code>ITerminate</code>).
|
||||
* The allow disconnect flag specifies whether the debug target will
|
||||
* support disconnection (<code>IDisconnect</code>). The resume
|
||||
* flag specifies if the target process should be resumed on startup.
|
||||
|
@ -111,6 +111,59 @@ public class CDebugModel
|
|||
cdiTarget,
|
||||
name,
|
||||
process,
|
||||
null,
|
||||
project,
|
||||
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 newDebugTarget( final ILaunch launch,
|
||||
final ICDITarget cdiTarget,
|
||||
final String name,
|
||||
final IProcess debuggeeProcess,
|
||||
final IProcess debuggerProcess,
|
||||
final IProject project,
|
||||
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,
|
||||
project,
|
||||
allowTerminate,
|
||||
allowDisconnect );
|
||||
|
@ -157,6 +210,57 @@ public class CDebugModel
|
|||
cdiTarget,
|
||||
name,
|
||||
null,
|
||||
null,
|
||||
project,
|
||||
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 newAttachDebugTarget( final ILaunch launch,
|
||||
final ICDITarget cdiTarget,
|
||||
final String name,
|
||||
final IProcess debuggerProcess,
|
||||
final IProject project ) 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,
|
||||
project,
|
||||
false,
|
||||
true );
|
||||
|
@ -205,6 +309,57 @@ public class CDebugModel
|
|||
cdiTarget,
|
||||
name,
|
||||
null,
|
||||
null,
|
||||
project,
|
||||
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];
|
||||
}
|
||||
|
||||
public static IDebugTarget newCoreFileDebugTarget( final ILaunch launch,
|
||||
final ICDITarget cdiTarget,
|
||||
final String name,
|
||||
final IProcess debuggerProcess,
|
||||
final IProject project ) 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,
|
||||
project,
|
||||
true,
|
||||
false );
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.core;
|
||||
|
||||
/**
|
||||
* Provides the functionality to support debugger console.
|
||||
*
|
||||
* @since: Oct 23, 2002
|
||||
*/
|
||||
public interface IDebuggerProcessSupport
|
||||
{
|
||||
boolean supportsDebuggerProcess();
|
||||
|
||||
boolean isDebuggerProcessDefault();
|
||||
|
||||
void setDebuggerProcessDefault( boolean value );
|
||||
}
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.debug.core.ICExpressionEvaluator;
|
|||
import org.eclipse.cdt.debug.core.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.ICMemoryManager;
|
||||
import org.eclipse.cdt.debug.core.ICWatchpoint;
|
||||
import org.eclipse.cdt.debug.core.IDebuggerProcessSupport;
|
||||
import org.eclipse.cdt.debug.core.IFormattedMemoryBlock;
|
||||
import org.eclipse.cdt.debug.core.IFormattedMemoryRetrieval;
|
||||
import org.eclipse.cdt.debug.core.IRestart;
|
||||
|
@ -101,7 +102,8 @@ public class CDebugTarget extends CDebugElement
|
|||
ILaunchListener,
|
||||
ISwitchToThread,
|
||||
IExpressionListener,
|
||||
ICExpressionEvaluator
|
||||
ICExpressionEvaluator,
|
||||
IDebuggerProcessSupport
|
||||
{
|
||||
/**
|
||||
* The type of this target.
|
||||
|
@ -116,9 +118,14 @@ public class CDebugTarget extends CDebugElement
|
|||
private ArrayList fThreads;
|
||||
|
||||
/**
|
||||
* Associated system process, or <code>null</code> if not available.
|
||||
* Associated inferrior process, or <code>null</code> if not available.
|
||||
*/
|
||||
private IProcess fProcess;
|
||||
private IProcess fDebuggeeProcess = null;
|
||||
|
||||
/**
|
||||
* Associated debugger process, or <code>null</code> if not available.
|
||||
*/
|
||||
private IProcess fDebuggerProcess = null;
|
||||
|
||||
/**
|
||||
* The underlying CDI target.
|
||||
|
@ -205,6 +212,11 @@ public class CDebugTarget extends CDebugElement
|
|||
*/
|
||||
private CMemoryManager fMemoryManager;
|
||||
|
||||
/**
|
||||
* A memory manager for this target.
|
||||
*/
|
||||
private boolean fIsDebuggerProcessDefault = false;
|
||||
|
||||
/**
|
||||
* Constructor for CDebugTarget.
|
||||
* @param target
|
||||
|
@ -213,7 +225,8 @@ public class CDebugTarget extends CDebugElement
|
|||
int targetType,
|
||||
ICDITarget cdiTarget,
|
||||
String name,
|
||||
IProcess process,
|
||||
IProcess debuggeeProcess,
|
||||
IProcess debuggerProcess,
|
||||
IProject project,
|
||||
boolean allowsTerminate,
|
||||
boolean allowsDisconnect )
|
||||
|
@ -223,7 +236,7 @@ public class CDebugTarget extends CDebugElement
|
|||
setTargetType( targetType );
|
||||
setDebugTarget( this );
|
||||
setName( name );
|
||||
setProcess( process );
|
||||
setProcesses( debuggeeProcess, debuggerProcess );
|
||||
setCDITarget( cdiTarget );
|
||||
setBreakpoints( new HashMap( 5 ) );
|
||||
setTemporaryBreakpoints( new ArrayList() );
|
||||
|
@ -307,7 +320,7 @@ public class CDebugTarget extends CDebugElement
|
|||
*/
|
||||
public IProcess getProcess()
|
||||
{
|
||||
return fProcess;
|
||||
return ( fIsDebuggerProcessDefault ) ? fDebuggerProcess : fDebuggeeProcess;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -318,9 +331,10 @@ public class CDebugTarget extends CDebugElement
|
|||
* underlying CDI target, or <code>null</code> if no process is
|
||||
* associated with this debug target (for example, a core dump debugging).
|
||||
*/
|
||||
protected void setProcess( IProcess process )
|
||||
protected void setProcesses( IProcess debuggeeProcess, IProcess debuggerProcess )
|
||||
{
|
||||
fProcess = process;
|
||||
fDebuggeeProcess = debuggeeProcess;
|
||||
fDebuggerProcess = debuggerProcess;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -1920,4 +1934,29 @@ public class CDebugTarget extends CDebugElement
|
|||
{
|
||||
getMemoryManager().dispose();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.IDebuggerProcessSupport#isDefault()
|
||||
*/
|
||||
public boolean isDebuggerProcessDefault()
|
||||
{
|
||||
return fIsDebuggerProcessDefault;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.IDebuggerProcessSupport#setDefault(boolean)
|
||||
*/
|
||||
public void setDebuggerProcessDefault( boolean value )
|
||||
{
|
||||
fIsDebuggerProcessDefault = value;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.IDebuggerProcessSupport#supportsDebuggerProcess()
|
||||
*/
|
||||
public boolean supportsDebuggerProcess()
|
||||
{
|
||||
return ( fDebuggerProcess != null );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue