Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2011-05-27 00:08:55 +0000
committerSergey Prigogin2011-05-27 00:08:55 +0000
commit56b100f37cfb2a88a7ab3b447a96a43b969c9588 (patch)
treeb891ca4aea61c6e33c6adab96f410b2926938ebb
parent3a5209e6ff26d99181848a75f18f60c94092d583 (diff)
downloadorg.eclipse.cdt-56b100f37cfb2a88a7ab3b447a96a43b969c9588.tar.gz
org.eclipse.cdt-56b100f37cfb2a88a7ab3b447a96a43b969c9588.tar.xz
org.eclipse.cdt-56b100f37cfb2a88a7ab3b447a96a43b969c9588.zip
Bug 347245 - Add configurable defaults for Stop in main and for Non-stop mode. Use global preferences for Debug As command.
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CApplicationLaunchShortcut.java3
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java51
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java12
4 files changed, 54 insertions, 18 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CApplicationLaunchShortcut.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CApplicationLaunchShortcut.java
index 42a8260be9a..8ddf6aba751 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CApplicationLaunchShortcut.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CApplicationLaunchShortcut.java
@@ -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());
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java
index 7d1598ba58b..ff77183abb2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java
@@ -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.
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java
index 69202d5859b..08983ed3982 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java
@@ -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
*/
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java
index 59d6aba46b9..5a1278bf8d2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java
@@ -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),

Back to the top