mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Moved the extraction of the stop symbol to the launch.
This commit is contained in:
parent
6d80cc5d00
commit
1018fe85a9
6 changed files with 103 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2006-03-27 Mikhail Khodjaiants
|
||||||
|
Moved the extraction of the stop symbol to the launch.
|
||||||
|
* CDIDebugModel.java
|
||||||
|
* CDebugTarget.java
|
||||||
|
|
||||||
2006-03-06 Mikhail Khodjaiants
|
2006-03-06 Mikhail Khodjaiants
|
||||||
Fix for Bug 93777: Postmortem and Local launch need a default preference for selected debugger.
|
Fix for Bug 93777: Postmortem and Local launch need a default preference for selected debugger.
|
||||||
* CDebugCorePlugin.java
|
* CDebugCorePlugin.java
|
||||||
|
|
|
@ -65,6 +65,43 @@ public class CDIDebugModel {
|
||||||
return CDebugCorePlugin.getUniqueIdentifier();
|
return CDebugCorePlugin.getUniqueIdentifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates and returns a debug target for the given CDI target, with the specified name, and associates it with the given process for console I/O. The debug
|
||||||
|
* target is added to the given launch.
|
||||||
|
*
|
||||||
|
* @param launch the launch the new debug target will be contained in
|
||||||
|
* @param project the project to use to persist breakpoints.
|
||||||
|
* @param cdiTarget the CDI target to create a debug target for
|
||||||
|
* @param name the name to associate with this target, which will be returned from <code>IDebugTarget.getName</code>.
|
||||||
|
* @param debuggeeProcess the process to associate with the debug target, which will be returned from <code>IDebugTarget.getProcess</code>
|
||||||
|
* @param file the executable to debug.
|
||||||
|
* @param allowTerminate allow terminate().
|
||||||
|
* @param allowDisconnect allow disconnect().
|
||||||
|
* @param stopSymbol place temporary breakpoint at <code>stopSymbol</code>, ignore if <code>null</code> or empty.
|
||||||
|
* @param resumeTarget resume target.
|
||||||
|
* @return a debug target
|
||||||
|
* @throws DebugException
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public static IDebugTarget newDebugTarget( final ILaunch launch, final IProject project, final ICDITarget cdiTarget, final String name, final IProcess debuggeeProcess, final IBinaryObject file, final boolean allowTerminate, final boolean allowDisconnect, final String stopSymbol, final boolean resumeTarget ) throws DebugException {
|
||||||
|
final IDebugTarget[] target = new IDebugTarget[1];
|
||||||
|
IWorkspaceRunnable r = new IWorkspaceRunnable() {
|
||||||
|
|
||||||
|
public void run( IProgressMonitor m ) throws CoreException {
|
||||||
|
target[0] = new CDebugTarget( launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect );
|
||||||
|
((CDebugTarget)target[0]).start( stopSymbol, resumeTarget );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
ResourcesPlugin.getWorkspace().run( r, null );
|
||||||
|
}
|
||||||
|
catch( CoreException e ) {
|
||||||
|
CDebugCorePlugin.log( e );
|
||||||
|
throw new DebugException( e.getStatus() );
|
||||||
|
}
|
||||||
|
return target[0];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and returns a debug target for the given CDI target, with the specified name, and associates it with the given process for console I/O. The debug
|
* Creates and returns a debug target for the given CDI target, with the specified name, and associates it with the given process for console I/O. The debug
|
||||||
* target is added to the given launch.
|
* target is added to the given launch.
|
||||||
|
@ -81,14 +118,18 @@ public class CDIDebugModel {
|
||||||
* @param resumeTarget resume target.
|
* @param resumeTarget resume target.
|
||||||
* @return a debug target
|
* @return a debug target
|
||||||
* @throws DebugException
|
* @throws DebugException
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public static IDebugTarget newDebugTarget( final ILaunch launch, final IProject project, final ICDITarget cdiTarget, final String name, final IProcess debuggeeProcess, final IBinaryObject file, final boolean allowTerminate, final boolean allowDisconnect, final boolean stopInMain, final boolean resumeTarget ) throws DebugException {
|
public static IDebugTarget newDebugTarget( final ILaunch launch, final IProject project, final ICDITarget cdiTarget, final String name, final IProcess debuggeeProcess, final IBinaryObject file, final boolean allowTerminate, final boolean allowDisconnect, final boolean stopInMain, final boolean resumeTarget ) throws DebugException {
|
||||||
final IDebugTarget[] target = new IDebugTarget[1];
|
final IDebugTarget[] target = new IDebugTarget[1];
|
||||||
IWorkspaceRunnable r = new IWorkspaceRunnable() {
|
IWorkspaceRunnable r = new IWorkspaceRunnable() {
|
||||||
|
|
||||||
public void run( IProgressMonitor m ) throws CoreException {
|
public void run( IProgressMonitor m ) throws CoreException {
|
||||||
|
String stopSymbol = null;
|
||||||
|
if ( stopInMain )
|
||||||
|
stopSymbol = launch.getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
|
||||||
target[0] = new CDebugTarget( launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect );
|
target[0] = new CDebugTarget( launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect );
|
||||||
((CDebugTarget)target[0]).start( stopInMain, resumeTarget );
|
((CDebugTarget)target[0]).start( stopSymbol, resumeTarget );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
@ -118,7 +159,7 @@ public class CDIDebugModel {
|
||||||
* @throws DebugException
|
* @throws DebugException
|
||||||
*/
|
*/
|
||||||
public static IDebugTarget newDebugTarget( ILaunch launch, IProject project, ICDITarget cdiTarget, final String name, IProcess debuggeeProcess, IBinaryObject file, boolean allowTerminate, boolean allowDisconnect, boolean resumeTarget ) throws DebugException {
|
public static IDebugTarget newDebugTarget( ILaunch launch, IProject project, ICDITarget cdiTarget, final String name, IProcess debuggeeProcess, IBinaryObject file, boolean allowTerminate, boolean allowDisconnect, boolean resumeTarget ) throws DebugException {
|
||||||
return newDebugTarget( launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect, false, resumeTarget );
|
return newDebugTarget( launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect, null, resumeTarget );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -454,7 +495,10 @@ public class CDIDebugModel {
|
||||||
*/
|
*/
|
||||||
public static IDebugTarget newDebugTarget( ILaunch launch, ICDITarget target, String name, IProcess iprocess, IProcess debuggerProcess, IFile file, boolean allowTerminate, boolean allowDisconnect, boolean stopInMain ) throws CoreException {
|
public static IDebugTarget newDebugTarget( ILaunch launch, ICDITarget target, String name, IProcess iprocess, IProcess debuggerProcess, IFile file, boolean allowTerminate, boolean allowDisconnect, boolean stopInMain ) throws CoreException {
|
||||||
IBinaryExecutable exeFile = getBinary( file );
|
IBinaryExecutable exeFile = getBinary( file );
|
||||||
return newDebugTarget( launch, file.getProject(), target, name, iprocess, exeFile, allowTerminate, allowDisconnect, stopInMain, true );
|
String stopSymbol = null;
|
||||||
|
if ( stopInMain )
|
||||||
|
stopSymbol = launch.getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
|
||||||
|
return newDebugTarget( launch, file.getProject(), target, name, iprocess, exeFile, allowTerminate, allowDisconnect, stopSymbol, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -270,11 +270,32 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start( boolean stopInMain, boolean resume ) throws DebugException {
|
public void start( boolean stopInMain, boolean resume ) throws DebugException {
|
||||||
|
String stopSymbol = null;
|
||||||
|
try {
|
||||||
|
if ( stopInMain )
|
||||||
|
stopSymbol = getLaunch().getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
|
||||||
|
}
|
||||||
|
catch( CoreException e ) {
|
||||||
|
throw new DebugException( e.getStatus() );
|
||||||
|
}
|
||||||
ICDITargetConfiguration config = getConfiguration();
|
ICDITargetConfiguration config = getConfiguration();
|
||||||
if ( config.supportsBreakpoints() ) {
|
if ( config.supportsBreakpoints() ) {
|
||||||
getBreakpointManager().setInitialBreakpoints();
|
getBreakpointManager().setInitialBreakpoints();
|
||||||
if ( stopInMain ) {
|
if ( stopSymbol != null && stopSymbol.length() != 0 ) {
|
||||||
stopInMain();
|
stopAtSymbol( stopSymbol );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( config.supportsResume() && resume ) {
|
||||||
|
resume();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start( String stopSymbol, boolean resume ) throws DebugException {
|
||||||
|
ICDITargetConfiguration config = getConfiguration();
|
||||||
|
if ( config.supportsBreakpoints() ) {
|
||||||
|
getBreakpointManager().setInitialBreakpoints();
|
||||||
|
if ( stopSymbol != null && stopSymbol.length() != 0 ) {
|
||||||
|
stopAtSymbol( stopSymbol );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( config.supportsResume() && resume ) {
|
if ( config.supportsResume() && resume ) {
|
||||||
|
@ -1699,6 +1720,21 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
getBreakpointManager().skipBreakpoints( enabled );
|
getBreakpointManager().skipBreakpoints( enabled );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void stopAtSymbol( String stopSymbol ) throws DebugException {
|
||||||
|
try {
|
||||||
|
ICDILocation location = getCDITarget().createFunctionLocation( "", stopSymbol ); //$NON-NLS-1$
|
||||||
|
setInternalTemporaryBreakpoint( location );
|
||||||
|
}
|
||||||
|
catch( CoreException e ) {
|
||||||
|
String message = MessageFormat.format( DebugCoreMessages.getString( "CDebugModel.0" ), new String[]{ e.getStatus().getMessage() } ); //$NON-NLS-1$
|
||||||
|
IStatus newStatus = new Status( IStatus.WARNING, e.getStatus().getPlugin(), ICDebugInternalConstants.STATUS_CODE_QUESTION, message, null );
|
||||||
|
if ( !CDebugUtils.question( newStatus, this ) ) {
|
||||||
|
terminate();
|
||||||
|
throw new DebugException( new Status( IStatus.OK, e.getStatus().getPlugin(), e.getStatus().getCode(), e.getStatus().getMessage(), null ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void stopInMain() throws DebugException {
|
protected void stopInMain() throws DebugException {
|
||||||
String mainSymbol = new String( ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
|
String mainSymbol = new String( ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2006-03-27 Mikhail Khodjaiants
|
||||||
|
Moved the extraction of the stop symbol to the launch.
|
||||||
|
* LocalCDILaunchDelegate.java
|
||||||
|
* LocalRunLaunchDelegate.java
|
||||||
|
|
||||||
2006-03-15 Mikhail Khodjaiants
|
2006-03-15 Mikhail Khodjaiants
|
||||||
Reversing previous changes. The existing "verifyProgramPath" method can be used.
|
Reversing previous changes. The existing "verifyProgramPath" method can be used.
|
||||||
* AbstractCLaunchDelegate.java
|
* AbstractCLaunchDelegate.java
|
||||||
|
|
|
@ -142,6 +142,9 @@ public class LocalCDILaunchDelegate extends AbstractCLaunchDelegate {
|
||||||
monitor.worked( 1 );
|
monitor.worked( 1 );
|
||||||
|
|
||||||
boolean stopInMain = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false );
|
boolean stopInMain = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false );
|
||||||
|
String stopSymbol = null;
|
||||||
|
if ( stopInMain )
|
||||||
|
stopSymbol = launch.getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
|
||||||
ICDITarget[] targets = dsession.getTargets();
|
ICDITarget[] targets = dsession.getTargets();
|
||||||
for( int i = 0; i < targets.length; i++ ) {
|
for( int i = 0; i < targets.length; i++ ) {
|
||||||
Process process = targets[i].getProcess();
|
Process process = targets[i].getProcess();
|
||||||
|
@ -149,7 +152,7 @@ public class LocalCDILaunchDelegate extends AbstractCLaunchDelegate {
|
||||||
if ( process != null ) {
|
if ( process != null ) {
|
||||||
iprocess = DebugPlugin.newProcess( launch, process, renderProcessLabel( exePath.toOSString() ), getDefaultProcessMap() );
|
iprocess = DebugPlugin.newProcess( launch, process, renderProcessLabel( exePath.toOSString() ), getDefaultProcessMap() );
|
||||||
}
|
}
|
||||||
CDIDebugModel.newDebugTarget( launch, project.getProject(), targets[i], renderTargetLabel( debugConfig ), iprocess, exeFile, true, false, stopInMain, true );
|
CDIDebugModel.newDebugTarget( launch, project.getProject(), targets[i], renderTargetLabel( debugConfig ), iprocess, exeFile, true, false, stopSymbol, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( CoreException e ) {
|
catch( CoreException e ) {
|
||||||
|
|
|
@ -96,6 +96,9 @@ public class LocalRunLaunchDelegate extends AbstractCLaunchDelegate {
|
||||||
monitor.worked(1);
|
monitor.worked(1);
|
||||||
boolean stopInMain = config
|
boolean stopInMain = config
|
||||||
.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
|
.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
|
||||||
|
String stopSymbol = null;
|
||||||
|
if ( stopInMain )
|
||||||
|
stopSymbol = launch.getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
|
||||||
|
|
||||||
ICDITarget[] targets = dsession.getTargets();
|
ICDITarget[] targets = dsession.getTargets();
|
||||||
for (int i = 0; i < targets.length; i++) {
|
for (int i = 0; i < targets.length; i++) {
|
||||||
|
@ -105,7 +108,7 @@ public class LocalRunLaunchDelegate extends AbstractCLaunchDelegate {
|
||||||
iprocess = DebugPlugin.newProcess(launch, process, renderProcessLabel(exePath.toOSString()), getDefaultProcessMap());
|
iprocess = DebugPlugin.newProcess(launch, process, renderProcessLabel(exePath.toOSString()), getDefaultProcessMap());
|
||||||
}
|
}
|
||||||
CDIDebugModel.newDebugTarget(launch, project.getProject(), targets[i], renderTargetLabel(debugConfig),
|
CDIDebugModel.newDebugTarget(launch, project.getProject(), targets[i], renderTargetLabel(debugConfig),
|
||||||
iprocess, exeFile, true, false, stopInMain, true);
|
iprocess, exeFile, true, false, stopSymbol, true);
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue