mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +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
|
2002-10-22 Alain Magloire
|
||||||
|
|
||||||
* src/.../cdi/ICDISession.java (getSessionProcess):
|
* src/.../cdi/ICDISession.java (getSessionProcess):
|
||||||
|
|
|
@ -73,8 +73,8 @@ public class CDebugModel
|
||||||
/**
|
/**
|
||||||
* Creates and returns a debug target for the given CDI target, with
|
* Creates and returns a debug target for the given CDI target, with
|
||||||
* the specified name, and associates the debug target with the
|
* the specified name, and associates the debug target with the
|
||||||
* given process for console I/O. The allow terminate flag specifies whether
|
* given process for console I/O. The allow terminate flag specifies
|
||||||
* the debug target will support termination (<code>ITerminate</code>).
|
* whether the debug target will support termination (<code>ITerminate</code>).
|
||||||
* The allow disconnect flag specifies whether the debug target will
|
* The allow disconnect flag specifies whether the debug target will
|
||||||
* support disconnection (<code>IDisconnect</code>). The resume
|
* support disconnection (<code>IDisconnect</code>). The resume
|
||||||
* flag specifies if the target process should be resumed on startup.
|
* flag specifies if the target process should be resumed on startup.
|
||||||
|
@ -111,6 +111,59 @@ public class CDebugModel
|
||||||
cdiTarget,
|
cdiTarget,
|
||||||
name,
|
name,
|
||||||
process,
|
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,
|
project,
|
||||||
allowTerminate,
|
allowTerminate,
|
||||||
allowDisconnect );
|
allowDisconnect );
|
||||||
|
@ -157,6 +210,57 @@ public class CDebugModel
|
||||||
cdiTarget,
|
cdiTarget,
|
||||||
name,
|
name,
|
||||||
null,
|
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,
|
project,
|
||||||
false,
|
false,
|
||||||
true );
|
true );
|
||||||
|
@ -205,6 +309,57 @@ public class CDebugModel
|
||||||
cdiTarget,
|
cdiTarget,
|
||||||
name,
|
name,
|
||||||
null,
|
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,
|
project,
|
||||||
true,
|
true,
|
||||||
false );
|
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.ICLineBreakpoint;
|
||||||
import org.eclipse.cdt.debug.core.ICMemoryManager;
|
import org.eclipse.cdt.debug.core.ICMemoryManager;
|
||||||
import org.eclipse.cdt.debug.core.ICWatchpoint;
|
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.IFormattedMemoryBlock;
|
||||||
import org.eclipse.cdt.debug.core.IFormattedMemoryRetrieval;
|
import org.eclipse.cdt.debug.core.IFormattedMemoryRetrieval;
|
||||||
import org.eclipse.cdt.debug.core.IRestart;
|
import org.eclipse.cdt.debug.core.IRestart;
|
||||||
|
@ -101,7 +102,8 @@ public class CDebugTarget extends CDebugElement
|
||||||
ILaunchListener,
|
ILaunchListener,
|
||||||
ISwitchToThread,
|
ISwitchToThread,
|
||||||
IExpressionListener,
|
IExpressionListener,
|
||||||
ICExpressionEvaluator
|
ICExpressionEvaluator,
|
||||||
|
IDebuggerProcessSupport
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The type of this target.
|
* The type of this target.
|
||||||
|
@ -116,9 +118,14 @@ public class CDebugTarget extends CDebugElement
|
||||||
private ArrayList fThreads;
|
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.
|
* The underlying CDI target.
|
||||||
|
@ -205,6 +212,11 @@ public class CDebugTarget extends CDebugElement
|
||||||
*/
|
*/
|
||||||
private CMemoryManager fMemoryManager;
|
private CMemoryManager fMemoryManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A memory manager for this target.
|
||||||
|
*/
|
||||||
|
private boolean fIsDebuggerProcessDefault = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for CDebugTarget.
|
* Constructor for CDebugTarget.
|
||||||
* @param target
|
* @param target
|
||||||
|
@ -213,7 +225,8 @@ public class CDebugTarget extends CDebugElement
|
||||||
int targetType,
|
int targetType,
|
||||||
ICDITarget cdiTarget,
|
ICDITarget cdiTarget,
|
||||||
String name,
|
String name,
|
||||||
IProcess process,
|
IProcess debuggeeProcess,
|
||||||
|
IProcess debuggerProcess,
|
||||||
IProject project,
|
IProject project,
|
||||||
boolean allowsTerminate,
|
boolean allowsTerminate,
|
||||||
boolean allowsDisconnect )
|
boolean allowsDisconnect )
|
||||||
|
@ -223,7 +236,7 @@ public class CDebugTarget extends CDebugElement
|
||||||
setTargetType( targetType );
|
setTargetType( targetType );
|
||||||
setDebugTarget( this );
|
setDebugTarget( this );
|
||||||
setName( name );
|
setName( name );
|
||||||
setProcess( process );
|
setProcesses( debuggeeProcess, debuggerProcess );
|
||||||
setCDITarget( cdiTarget );
|
setCDITarget( cdiTarget );
|
||||||
setBreakpoints( new HashMap( 5 ) );
|
setBreakpoints( new HashMap( 5 ) );
|
||||||
setTemporaryBreakpoints( new ArrayList() );
|
setTemporaryBreakpoints( new ArrayList() );
|
||||||
|
@ -307,7 +320,7 @@ public class CDebugTarget extends CDebugElement
|
||||||
*/
|
*/
|
||||||
public IProcess getProcess()
|
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
|
* underlying CDI target, or <code>null</code> if no process is
|
||||||
* associated with this debug target (for example, a core dump debugging).
|
* 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)
|
/* (non-Javadoc)
|
||||||
|
@ -1920,4 +1934,29 @@ public class CDebugTarget extends CDebugElement
|
||||||
{
|
{
|
||||||
getMemoryManager().dispose();
|
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