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

Bug 120162: [launch] Allow to specify the default version of gdb

This commit is contained in:
Marc Khouzam 2010-11-21 19:20:59 +00:00
parent 8eb53df381
commit c0a7a5724f
5 changed files with 26 additions and 52 deletions

View file

@ -43,9 +43,9 @@ public class TracingConsoleManager implements ILaunchesListener2, IPropertyChang
* we need to use <code>this</code>. * we need to use <code>this</code>.
*/ */
public void startup() { public void startup() {
GdbUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore(); IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
store.addPropertyChangeListener(this);
fTracingEnabled = store.getBoolean(IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE); fTracingEnabled = store.getBoolean(IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE);
if (fTracingEnabled) { if (fTracingEnabled) {

View file

@ -1,41 +0,0 @@
/*******************************************************************************
* Copyright (c) 2009 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Ericsson - initial implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
import org.eclipse.debug.ui.IDebugUIConstants;
/**
* @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
* @deprecated Has been replaced with org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants
*/
@Deprecated
public interface IGdbDebugPreferenceConstants {
/**
* Debug UI plug-in identifier (value <code>"org.eclipse.cdt.dsf.gdb.ui"</code>).
*/
public static final String PLUGIN_ID = "org.eclipse.cdt.dsf.gdb.ui"; //$NON-NLS-1$;
/**
* Boolean preference whether to enable GDB traces. Default is <code>true</code>.
*
*/
public static final String PREF_TRACES_ENABLE = "tracesEnable"; //$NON-NLS-1$
/**
* Help prefixes.
*/
public static final String PREFIX = IDebugUIConstants.PLUGIN_ID + "."; //$NON-NLS-1$
public static final String PREFERENCE_PAGE= PREFIX + "preference_page_context"; //$NON-NLS-1$
}

View file

@ -37,6 +37,7 @@ import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.gdb.service.SessionType; import org.eclipse.cdt.dsf.gdb.service.SessionType;
import org.eclipse.cdt.utils.spawner.ProcessFactory; import org.eclipse.cdt.utils.spawner.ProcessFactory;
@ -48,6 +49,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus; import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.core.variables.VariablesPlugin; import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
@ -208,10 +210,13 @@ public class LaunchUtils {
} }
public static IPath getGDBPath(ILaunchConfiguration configuration) { public static IPath getGDBPath(ILaunchConfiguration configuration) {
IPath retVal = new Path(IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT); String defaultGdbCommand = Platform.getPreferencesService().getString("org.eclipse.cdt.dsf.gdb.ui", //$NON-NLS-1$
IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND,
IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT, null);
IPath retVal = new Path(defaultGdbCommand);
try { try {
String gdb = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, String gdb = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, defaultGdbCommand);
IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
gdb = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(gdb, false); gdb = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(gdb, false);
retVal = new Path(gdb); retVal = new Path(gdb);
} catch (CoreException e) { } catch (CoreException e) {

View file

@ -32,6 +32,7 @@ import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor; import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.concurrent.Sequence; import org.eclipse.cdt.dsf.concurrent.Sequence;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils; import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils;
import org.eclipse.cdt.dsf.gdb.service.command.GDBControl.InitializationShutdownStep; import org.eclipse.cdt.dsf.gdb.service.command.GDBControl.InitializationShutdownStep;
@ -51,6 +52,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job; import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.variables.VariablesPlugin; import org.eclipse.core.variables.VariablesPlugin;
@ -196,8 +198,11 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend {
public String getGDBInitFile() throws CoreException { public String getGDBInitFile() throws CoreException {
if (fGDBInitFile == null) { if (fGDBInitFile == null) {
fGDBInitFile = fLaunchConfiguration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, String defaultGdbInit = Platform.getPreferencesService().getString("org.eclipse.cdt.dsf.gdb.ui", //$NON-NLS-1$
IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT); IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT,
IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT, null);
fGDBInitFile = fLaunchConfiguration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, defaultGdbInit);
} }
return fGDBInitFile; return fGDBInitFile;

View file

@ -34,7 +34,9 @@ import org.eclipse.cdt.debug.mi.core.MIPlugin;
import org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoryDescriptor; import org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoryDescriptor;
import org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoryManager; import org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoryManager;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
@ -360,8 +362,9 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
public void initializeFrom(ILaunchConfiguration configuration) { public void initializeFrom(ILaunchConfiguration configuration) {
try { try {
String gdbCommandAttr = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, String defaultGdbCommand = Platform.getPreferencesService().getString("org.eclipse.cdt.dsf.gdb.ui", //$NON-NLS-1$
IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT); IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND,"", null); //$NON-NLS-1$
String gdbCommandAttr = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, defaultGdbCommand);
gdbCommand.setText(gdbCommandAttr); gdbCommand.setText(gdbCommandAttr);
boolean useRemoteAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, boolean useRemoteAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET,
@ -450,8 +453,10 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
} }
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, String defaultGdbCommand = Platform.getPreferencesService().getString("org.eclipse.cdt.dsf.gdb.ui", //$NON-NLS-1$
IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT); IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND, "", null); //$NON-NLS-1$
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, defaultGdbCommand);
CommandFactoryManager cfManager = MIPlugin.getDefault().getCommandFactoryManager(); CommandFactoryManager cfManager = MIPlugin.getDefault().getCommandFactoryManager();
CommandFactoryDescriptor defDesc = cfManager.getDefaultDescriptor(IGDBJtagConstants.DEBUGGER_ID); CommandFactoryDescriptor defDesc = cfManager.getDefaultDescriptor(IGDBJtagConstants.DEBUGGER_ID);
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, defDesc.getName()); configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, defDesc.getName());