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

Bug 347245 - Add configurable defaults for Stop in main and for Non-stop mode. Use global preferences for Debug As command.

This commit is contained in:
Sergey Prigogin 2011-05-27 00:08:55 +00:00
parent 3a5209e6ff
commit 56b100f37c
4 changed files with 54 additions and 18 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 QNX Software Systems and others.
* Copyright (c) 2005, 2011 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -195,7 +195,6 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut2 {
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, bin.getCProject().getElementName());
wc.setMappedResources(new IResource[] { bin.getResource().getProject() });
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true);
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, debugConfig.getID());

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2010 Ericsson and others.
* Copyright (c) 2008, 2011 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -10,6 +10,7 @@
* Nokia - create and use backend service.
* IBM Corporation
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.launching;
@ -48,7 +49,6 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunch;
public class FinalLaunchSequence extends ReflectionSequence {
// The launchConfiguration attributes
private Map<String, Object> fAttributes;
@ -256,7 +256,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
boolean isNonStop = CDebugUtils.getAttribute(
fAttributes,
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT);
LaunchUtils.getIsNonStopModeDefault());
// GDBs that don't support non-stop don't allow you to set it to false.
// We really should set it to false when GDB supports it though.

View file

@ -8,6 +8,7 @@
* Contributors:
* Ericsson - Initial API and implementation
* Ericsson - Added support for Mac OS
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.launching;
@ -57,6 +58,8 @@ import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.ILaunchConfiguration;
public class LaunchUtils {
private static final String GDB_UI_PLUGIN_ID = "org.eclipse.cdt.dsf.gdb.ui"; //$NON-NLS-1$
/**
* A prefix that we use to indicate that a GDB version is for MAC OS
* @since 3.0
@ -210,7 +213,7 @@ public class LaunchUtils {
}
public static IPath getGDBPath(ILaunchConfiguration configuration) {
String defaultGdbCommand = Platform.getPreferencesService().getString("org.eclipse.cdt.dsf.gdb.ui", //$NON-NLS-1$
String defaultGdbCommand = Platform.getPreferencesService().getString(GDB_UI_PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND,
IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT, null);
@ -428,24 +431,56 @@ public class LaunchUtils {
}
/**
* This methods return true if the launch is meant to be in Non-Stop mode.
* Returns false otherwise.
* Returns <code>true</code> if the launch is meant to be in Non-Stop mode.
* Returns <code>false</code> otherwise.
*
* @since 4.0
*/
public static boolean getIsNonStopMode(ILaunchConfiguration config) {
try {
boolean nonStopMode = config.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT);
return nonStopMode;
return config.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
getIsNonStopModeDefault());
} catch (CoreException e) {
}
return false;
}
/**
* This methods return true if the launch is meant to be for post-mortem
* tracing. Returns false otherwise.
* Returns workspace-level default for the Non-Stop mode.
*
* @since 4.0
*/
public static boolean getIsNonStopModeDefault() {
return Platform.getPreferencesService().getBoolean(GDB_UI_PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP,
IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT, null);
}
/**
* Returns workspace-level default for the Stop in main option.
*
* @since 4.0
*/
public static boolean getStopInMainDefault() {
return Platform.getPreferencesService().getBoolean(GDB_UI_PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN,
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT, null);
}
/**
* Returns workspace-level default for the Stop in main symbol.
*
* @since 4.0
*/
public static String getStopInMainSymbolDefault() {
return Platform.getPreferencesService().getString(GDB_UI_PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_DEFAULT_STOP_AT_MAIN_SYMBOL,
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT, null);
}
/**
* Returns <code>true</code> if the launch is meant to be for post-mortem
* tracing. Returns <code>false</code> otherwise.
*
* @since 4.0
*/

View file

@ -7,6 +7,7 @@
*
* Contributors:
* Ericsson - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service;
@ -30,6 +31,7 @@ import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.IGdbDebugConstants;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.gdb.launching.InferiorRuntimeProcess;
import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils;
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
@ -103,7 +105,6 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
protected boolean getUserBreakpointIsOnMain() {
return fUserBreakpointIsOnMain;
}
public StartOrRestartProcessSequence_7_0(DsfExecutor executor, IContainerDMContext containerDmc,
Map<String, Object> attributes, boolean restart, DataRequestMonitor<IContainerDMContext> rm) {
@ -183,21 +184,22 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
}
/**
* If the user requested a 'stopOnMain', let's set the temporary breakpoint
* If the user requested a 'stopAtMain', let's set the temporary breakpoint
* where the user specified.
*/
@Execute
public void stepInsertStopOnMainBreakpoint(final RequestMonitor rm) {
boolean userRequestedStop = CDebugUtils.getAttribute(fAttributes,
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
false);
LaunchUtils.getStopInMainDefault());
if (userRequestedStop) {
String userStopSymbol = CDebugUtils.getAttribute(fAttributes,
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
LaunchUtils.getStopInMainSymbolDefault());
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(getContainerContext(), IBreakpointsTargetDMContext.class);
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(getContainerContext(),
IBreakpointsTargetDMContext.class);
fCommandControl.queueCommand(
fCommandFactory.createMIBreakInsert(bpTargetDmc, true, false, null, 0, userStopSymbol, 0),