From 66948345f02c12d4e7920c3ced4e223e86d4d30d Mon Sep 17 00:00:00 2001 From: John Cortell Date: Fri, 15 Dec 2006 18:00:09 +0000 Subject: [PATCH] Fixed bug 166774. Restart tries to set a breakpoint on main regardless of whether the stop on main checkbox is checked or not. --- .../cdt/debug/internal/core/model/CDebugTarget.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java index a32fe93f31f..d8fd18eb882 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java @@ -107,6 +107,7 @@ import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.IExpressionListener; import org.eclipse.debug.core.IExpressionManager; import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchListener; import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IDebugTarget; @@ -899,15 +900,19 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv if ( !canRestart() ) { return; } - String mainSymbol = new String( ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT ); try { - mainSymbol = getLaunch().getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT ); + ILaunchConfiguration launchConfig = getLaunch().getLaunchConfiguration(); + if (launchConfig.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false)) { + String mainSymbol = new String( ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT ); + mainSymbol = getLaunch().getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT ); + ICDILocation location = getCDITarget().createFunctionLocation( "", mainSymbol ); //$NON-NLS-1$ + setInternalTemporaryBreakpoint( location ); + } } catch( CoreException e ) { requestFailed( e.getMessage(), e ); } - ICDILocation location = getCDITarget().createFunctionLocation( "", mainSymbol ); //$NON-NLS-1$ - setInternalTemporaryBreakpoint( location ); + final CDebugElementState newState = CDebugElementState.RESTARTING; changeState( newState ); try {