mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 221505
Moves the code out of org.eclipse.dd.gdb.launch.ui into org.eclipse.dd.gdb.ui to allow people to extend the classes without taking in the extensions defined by org.eclipse.dd.gdb.launch.ui
This commit is contained in:
parent
89c5e765ba
commit
8c8a9fddff
5 changed files with 632 additions and 4 deletions
|
@ -15,6 +15,9 @@ Require-Bundle: org.eclipse.ui,
|
|||
org.eclipse.dd.mi,
|
||||
org.eclipse.dd.gdb,
|
||||
org.eclipse.dd.dsf.debug,
|
||||
org.eclipse.cdt.debug.ui
|
||||
org.eclipse.cdt.debug.ui,
|
||||
org.eclipse.cdt.core,
|
||||
org.eclipse.cdt.launch
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Export-Package: org.eclipse.dd.gdb.internal.ui.launching
|
||||
|
|
|
@ -0,0 +1,556 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2007, 2008 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ken Ryall (Nokia) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=118894
|
||||
* IBM Corporation
|
||||
* Ericsson
|
||||
*******************************************************************************/
|
||||
package org.eclipse.dd.gdb.internal.ui.launching;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.Collator;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.IBinaryParser;
|
||||
import org.eclipse.cdt.core.ICExtensionReference;
|
||||
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
|
||||
import org.eclipse.cdt.debug.core.ICDebugConstants;
|
||||
import org.eclipse.cdt.debug.ui.ICDebuggerPage;
|
||||
import org.eclipse.cdt.launch.internal.ui.AbstractCDebuggerTab;
|
||||
import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
|
||||
import org.eclipse.cdt.launch.ui.ICDTLaunchHelpContextIds;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.dd.gdb.IGDBLaunchConfigurationConstants;
|
||||
import org.eclipse.dd.gdb.service.command.GDBControl.SessionType;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.accessibility.AccessibleAdapter;
|
||||
import org.eclipse.swt.accessibility.AccessibleEvent;
|
||||
import org.eclipse.swt.custom.ScrolledComposite;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
public class CDebuggerTab extends AbstractCDebuggerTab {
|
||||
|
||||
public class AdvancedDebuggerOptionsDialog extends Dialog {
|
||||
|
||||
private Button fVarBookKeeping;
|
||||
|
||||
private Button fRegBookKeeping;
|
||||
|
||||
/**
|
||||
* Constructor for AdvancedDebuggerOptionsDialog.
|
||||
*/
|
||||
protected AdvancedDebuggerOptionsDialog(Shell parentShell) {
|
||||
super(parentShell);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
Composite composite = (Composite)super.createDialogArea(parent);
|
||||
Group group = new Group(composite, SWT.NONE);
|
||||
group.setText(LaunchMessages.getString("CDebuggerTab.Automatically_track_values_of")); //$NON-NLS-1$
|
||||
GridLayout layout = new GridLayout();
|
||||
group.setLayout(layout);
|
||||
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
fVarBookKeeping = new Button(group, SWT.CHECK);
|
||||
fVarBookKeeping.setText(LaunchMessages.getString("CDebuggerTab.Variables")); //$NON-NLS-1$
|
||||
fRegBookKeeping = new Button(group, SWT.CHECK);
|
||||
fRegBookKeeping.setText(LaunchMessages.getString("CDebuggerTab.Registers")); //$NON-NLS-1$
|
||||
initialize();
|
||||
return composite;
|
||||
}
|
||||
|
||||
protected void okPressed() {
|
||||
saveValues();
|
||||
super.okPressed();
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
Map attr = getAdvancedAttributes();
|
||||
Object varBookkeeping = attr.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING);
|
||||
fVarBookKeeping.setSelection( (varBookkeeping instanceof Boolean) ? !((Boolean)varBookkeeping).booleanValue() : true);
|
||||
Object regBookkeeping = attr.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING);
|
||||
fRegBookKeeping.setSelection( (regBookkeeping instanceof Boolean) ? !((Boolean)regBookkeeping).booleanValue() : true);
|
||||
}
|
||||
|
||||
private void saveValues() {
|
||||
Map attr = getAdvancedAttributes();
|
||||
Boolean varBookkeeping = Boolean.valueOf( !fVarBookKeeping.getSelection() );
|
||||
attr.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, varBookkeeping);
|
||||
Boolean regBookkeeping = Boolean.valueOf( !fRegBookKeeping.getSelection() );
|
||||
attr.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING, regBookkeeping);
|
||||
update();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
protected void configureShell(Shell newShell) {
|
||||
super.configureShell(newShell);
|
||||
newShell.setText(LaunchMessages.getString("CDebuggerTab.Advanced_Options_Dialog_Title")); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
final protected SessionType fSessionType;
|
||||
|
||||
protected Button fAdvancedButton;
|
||||
protected Button fStopInMain;
|
||||
protected Text fStopInMainSymbol;
|
||||
protected Button fAttachButton;
|
||||
|
||||
private Map fAdvancedAttributes = new HashMap(5);
|
||||
|
||||
private ScrolledComposite fContainer;
|
||||
|
||||
private Composite fContents;
|
||||
|
||||
public CDebuggerTab(SessionType type) {
|
||||
fSessionType = type;
|
||||
|
||||
// If the default debugger has not been set, use the MI debugger.
|
||||
// The MI plug-in also does this, but it may not have been loaded yet. Bug 158391.
|
||||
ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDefaultDebugConfiguration();
|
||||
if (dc == null) {
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault(ICDebugConstants.PREF_DEFAULT_DEBUGGER_TYPE, "org.eclipse.cdt.debug.mi.core.CDebuggerNew"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
public void createControl(Composite parent) {
|
||||
fContainer = new ScrolledComposite( parent, SWT.V_SCROLL | SWT.H_SCROLL );
|
||||
fContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
fContainer.setLayout( new FillLayout() );
|
||||
fContainer.setExpandHorizontal(true);
|
||||
fContainer.setExpandVertical(true);
|
||||
|
||||
fContents = new Composite( fContainer, SWT.NONE );
|
||||
setControl(fContainer);
|
||||
/*GdbUILaunchPlugin.getDefault()*/PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
|
||||
ICDTLaunchHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_DEBBUGER_TAB);
|
||||
int numberOfColumns = (fSessionType == SessionType.ATTACH) ? 2 : 1;
|
||||
GridLayout layout = new GridLayout(numberOfColumns, false);
|
||||
fContents.setLayout(layout);
|
||||
GridData gd = new GridData( GridData.BEGINNING, GridData.CENTER, true, false );
|
||||
fContents.setLayoutData(gd);
|
||||
|
||||
createDebuggerCombo(fContents, (fSessionType == SessionType.ATTACH) ? 1 : 2 );
|
||||
createOptionsComposite(fContents);
|
||||
createDebuggerGroup(fContents, 2);
|
||||
|
||||
fContainer.setContent( fContents );
|
||||
}
|
||||
|
||||
protected void loadDebuggerComboBox(ILaunchConfiguration config, String selection) {
|
||||
ICDebugConfiguration[] debugConfigs;
|
||||
String configPlatform = getPlatform(config);
|
||||
debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
|
||||
Arrays.sort(debugConfigs, new Comparator<ICDebugConfiguration>() {
|
||||
public int compare(ICDebugConfiguration c1, ICDebugConfiguration c2) {
|
||||
return Collator.getInstance().compare(c1.getName(), c2.getName());
|
||||
}
|
||||
});
|
||||
List list = new ArrayList();
|
||||
String mode;
|
||||
if (fSessionType == SessionType.ATTACH) {
|
||||
mode = ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH;
|
||||
} else if (fSessionType == SessionType.REMOTE) {
|
||||
mode = IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE;
|
||||
} else {
|
||||
mode = ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN;
|
||||
}
|
||||
if (selection.equals("")) { //$NON-NLS-1$
|
||||
ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDebugConfiguration();
|
||||
if (dc == null) {
|
||||
CDebugCorePlugin.getDefault().saveDefaultDebugConfiguration("org.eclipse.cdt.debug.mi.core.CDebuggerNew");
|
||||
dc = CDebugCorePlugin.getDefault().getDefaultDebugConfiguration();
|
||||
}
|
||||
if (dc != null)
|
||||
selection = dc.getID();
|
||||
}
|
||||
String defaultSelection = selection;
|
||||
for (int i = 0; i < debugConfigs.length; i++) {
|
||||
if (mode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE) || debugConfigs[i].supportsMode(mode)) {
|
||||
String debuggerPlatform = debugConfigs[i].getPlatform();
|
||||
if (validatePlatform(config, debugConfigs[i])) {
|
||||
list.add(debugConfigs[i]);
|
||||
// select first exact matching debugger for platform or
|
||||
// requested selection
|
||||
if ( (defaultSelection.equals("") && debuggerPlatform.equalsIgnoreCase(configPlatform))) { //$NON-NLS-1$
|
||||
defaultSelection = debugConfigs[i].getID();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if no selection meaning nothing in config the force initdefault on
|
||||
// tab
|
||||
setInitializeDefault(selection.equals("") ? true : false); //$NON-NLS-1$
|
||||
loadDebuggerCombo((ICDebugConfiguration[])list.toArray(new ICDebugConfiguration[list.size()]), defaultSelection);
|
||||
}
|
||||
|
||||
protected void updateComboFromSelection() {
|
||||
super.updateComboFromSelection();
|
||||
initializeCommonControls(getLaunchConfiguration());
|
||||
}
|
||||
|
||||
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
|
||||
super.setDefaults(config);
|
||||
if (fSessionType == SessionType.ATTACH) {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH);
|
||||
} else if (fSessionType == SessionType.REMOTE) {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT);
|
||||
} else {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT);
|
||||
}
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, false);
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING, false);
|
||||
|
||||
// Set the default debugger based on the active toolchain on the project (if possible)
|
||||
String defaultDebugger = null;
|
||||
try {
|
||||
String projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
|
||||
if (projectName.length() > 0) {
|
||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
||||
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project);
|
||||
ICConfigurationDescription configDesc = projDesc.getActiveConfiguration();
|
||||
String configId = configDesc.getId();
|
||||
ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
|
||||
outer: for (int i = 0; i < debugConfigs.length; ++i) {
|
||||
ICDebugConfiguration debugConfig = debugConfigs[i];
|
||||
String[] patterns = debugConfig.getSupportedBuildConfigPatterns();
|
||||
if (patterns != null) {
|
||||
for (int j = 0; j < patterns.length; ++j) {
|
||||
if (configId.matches(patterns[j])) {
|
||||
defaultDebugger = debugConfig.getID();
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
|
||||
if (defaultDebugger == null) {
|
||||
ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDebugConfiguration();
|
||||
if (dc != null) {
|
||||
defaultDebugger = dc.getID();
|
||||
}
|
||||
}
|
||||
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, defaultDebugger);
|
||||
}
|
||||
|
||||
public void initializeFrom(ILaunchConfiguration config) {
|
||||
setInitializing(true);
|
||||
super.initializeFrom(config);
|
||||
try {
|
||||
String id = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, ""); //$NON-NLS-1$
|
||||
loadDebuggerComboBox(config, id);
|
||||
initializeCommonControls(config);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
setInitializing(false);
|
||||
}
|
||||
|
||||
public void performApply(ILaunchConfigurationWorkingCopy config) {
|
||||
super.performApply(config);
|
||||
if (fSessionType == SessionType.ATTACH) {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH);
|
||||
} else {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, fStopInMain.getSelection());
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, fStopInMainSymbol.getText());
|
||||
if (fSessionType == SessionType.REMOTE) {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
|
||||
} else {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
|
||||
}
|
||||
}
|
||||
applyAdvancedAttributes(config);
|
||||
}
|
||||
|
||||
public boolean isValid(ILaunchConfiguration config) {
|
||||
if (!validateDebuggerConfig(config)) {
|
||||
return false;
|
||||
}
|
||||
ICDebugConfiguration debugConfig = getDebugConfig();
|
||||
String mode = ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN;
|
||||
if (fSessionType == SessionType.ATTACH) mode = ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH;
|
||||
else if (fSessionType == SessionType.REMOTE) mode = IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE;
|
||||
|
||||
if (!mode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE) && !debugConfig.supportsMode(mode)) {
|
||||
setErrorMessage(MessageFormat.format(LaunchMessages.getString("CDebuggerTab.Mode_not_supported"), new String[]{mode})); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
if ( fStopInMain != null && fStopInMainSymbol != null ) {
|
||||
// The "Stop on startup at" field must not be empty
|
||||
String mainSymbol = fStopInMainSymbol.getText().trim();
|
||||
if (fStopInMain.getSelection() && mainSymbol.length() == 0) {
|
||||
setErrorMessage( LaunchMessages.getString("CDebuggerTab.Stop_on_startup_at_can_not_be_empty")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (super.isValid(config) == false) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean validatePlatform(ILaunchConfiguration config, ICDebugConfiguration debugConfig) {
|
||||
String configPlatform = getPlatform(config);
|
||||
String debuggerPlatform = debugConfig.getPlatform();
|
||||
return (debuggerPlatform.equals("*") || debuggerPlatform.equalsIgnoreCase(configPlatform)); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
protected boolean validateCPU(ILaunchConfiguration config, ICDebugConfiguration debugConfig) {
|
||||
IBinaryObject binaryFile = null;
|
||||
try {
|
||||
binaryFile = getBinary(config);
|
||||
} catch (CoreException e) {
|
||||
setErrorMessage(e.getLocalizedMessage());
|
||||
}
|
||||
String projectCPU = ICDebugConfiguration.CPU_NATIVE;
|
||||
if (binaryFile != null) {
|
||||
projectCPU = binaryFile.getCPU();
|
||||
}
|
||||
return debugConfig.supportsCPU(projectCPU);
|
||||
}
|
||||
|
||||
protected IBinaryObject getBinary(ILaunchConfiguration config) throws CoreException {
|
||||
String programName = null;
|
||||
String projectName = null;
|
||||
try {
|
||||
projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
|
||||
programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
if (programName != null ) {
|
||||
IPath exePath = new Path(programName);
|
||||
if (projectName != null && !projectName.equals("")) { //$NON-NLS-1$
|
||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
||||
if (!project.isAccessible()) {
|
||||
return null;
|
||||
}
|
||||
if (!exePath.isAbsolute()) {
|
||||
exePath = project.getLocation().append(exePath);
|
||||
}
|
||||
ICExtensionReference[] parserRef = CCorePlugin.getDefault().getBinaryParserExtensions(project);
|
||||
for (int i = 0; i < parserRef.length; i++) {
|
||||
try {
|
||||
IBinaryParser parser = (IBinaryParser)parserRef[i].createExtension();
|
||||
IBinaryObject exe = (IBinaryObject)parser.getBinary(exePath);
|
||||
if (exe != null) {
|
||||
return exe;
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
IBinaryParser parser = CCorePlugin.getDefault().getDefaultBinaryParser();
|
||||
try {
|
||||
IBinaryObject exe = (IBinaryObject)parser.getBinary(exePath);
|
||||
return exe;
|
||||
} catch (ClassCastException e) {
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected boolean validateDebuggerConfig(ILaunchConfiguration config) {
|
||||
ICDebugConfiguration debugConfig = getDebugConfig();
|
||||
if (debugConfig == null) {
|
||||
setErrorMessage(LaunchMessages.getString("CDebuggerTab.No_debugger_available")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
// We do not validate platform and CPU compatibility to avoid accidentally disabling
|
||||
// a valid configuration. It's much better to let an incompatible configuration through
|
||||
// than to disable a valid one.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
|
||||
*/
|
||||
protected void update() {
|
||||
if (!isInitializing()) {
|
||||
super.updateLaunchConfigurationDialog();
|
||||
}
|
||||
}
|
||||
|
||||
protected void createOptionsComposite(Composite parent) {
|
||||
Composite optionsComp = new Composite(parent, SWT.NONE);
|
||||
int numberOfColumns = (fSessionType == SessionType.ATTACH) ? 1 : 3;
|
||||
GridLayout layout = new GridLayout( numberOfColumns, false );
|
||||
optionsComp.setLayout( layout );
|
||||
optionsComp.setLayoutData( new GridData( GridData.BEGINNING, GridData.CENTER, true, false, 1, 1 ) );
|
||||
if (fSessionType != SessionType.ATTACH) {
|
||||
fStopInMain = createCheckButton( optionsComp, LaunchMessages.getString( "CDebuggerTab.Stop_at_main_on_startup" ) ); //$NON-NLS-1$
|
||||
fStopInMain.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
fStopInMainSymbol.setEnabled(fStopInMain.getSelection());
|
||||
update();
|
||||
}
|
||||
});
|
||||
fStopInMainSymbol = new Text(optionsComp, SWT.SINGLE | SWT.BORDER);
|
||||
final GridData gridData = new GridData(GridData.FILL, GridData.CENTER, false, false);
|
||||
gridData.widthHint = 100;
|
||||
fStopInMainSymbol.setLayoutData(gridData);
|
||||
fStopInMainSymbol.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent evt) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
fStopInMainSymbol.getAccessible().addAccessibleListener(
|
||||
new AccessibleAdapter() {
|
||||
public void getName(AccessibleEvent e) {
|
||||
e.result = LaunchMessages.getString( "CDebuggerTab.Stop_at_main_on_startup"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
fAdvancedButton = createPushButton(optionsComp, LaunchMessages.getString("CDebuggerTab.Advanced"), null); //$NON-NLS-1$
|
||||
((GridData)fAdvancedButton.getLayoutData()).horizontalAlignment = GridData.END;
|
||||
fAdvancedButton.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
Dialog dialog = new AdvancedDebuggerOptionsDialog(getShell());
|
||||
dialog.open();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected Map getAdvancedAttributes() {
|
||||
return fAdvancedAttributes;
|
||||
}
|
||||
|
||||
private void initializeAdvancedAttributes(ILaunchConfiguration config) {
|
||||
Map attr = getAdvancedAttributes();
|
||||
try {
|
||||
Boolean varBookkeeping = (config.getAttribute(
|
||||
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, false))
|
||||
? Boolean.TRUE
|
||||
: Boolean.FALSE;
|
||||
attr.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, varBookkeeping);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
try {
|
||||
Boolean regBookkeeping = (config.getAttribute(
|
||||
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING, false))
|
||||
? Boolean.TRUE
|
||||
: Boolean.FALSE;
|
||||
attr.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING, regBookkeeping);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
|
||||
private void applyAdvancedAttributes(ILaunchConfigurationWorkingCopy config) {
|
||||
Map attr = getAdvancedAttributes();
|
||||
Object varBookkeeping = attr.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING);
|
||||
if (varBookkeeping instanceof Boolean)
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING,
|
||||
((Boolean)varBookkeeping).booleanValue());
|
||||
Object regBookkeeping = attr.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING);
|
||||
if (regBookkeeping instanceof Boolean)
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING,
|
||||
((Boolean)regBookkeeping).booleanValue());
|
||||
}
|
||||
|
||||
protected Shell getShell() {
|
||||
return super.getShell();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
|
||||
*/
|
||||
public void dispose() {
|
||||
getAdvancedAttributes().clear();
|
||||
ICDebuggerPage debuggerPage = getDynamicTab();
|
||||
if ( debuggerPage != null )
|
||||
debuggerPage.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
protected void initializeCommonControls(ILaunchConfiguration config) {
|
||||
try {
|
||||
if (fSessionType != SessionType.ATTACH) {
|
||||
fStopInMain.setSelection(config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT));
|
||||
fStopInMainSymbol.setText(config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT));
|
||||
fStopInMainSymbol.setEnabled(fStopInMain.getSelection());
|
||||
}
|
||||
initializeAdvancedAttributes(config);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.launch.internal.ui.AbstractCDebuggerTab#setInitializeDefault(boolean)
|
||||
*/
|
||||
protected void setInitializeDefault(boolean init) {
|
||||
super.setInitializeDefault(init);
|
||||
}
|
||||
|
||||
protected void contentsChanged() {
|
||||
fContainer.setMinSize(fContents.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.dd.gdb.internal.ui.launching;
|
||||
|
||||
import org.eclipse.cdt.launch.ui.CMainTab;
|
||||
import org.eclipse.dd.gdb.service.command.GDBControl.SessionType;
|
||||
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
|
||||
import org.eclipse.debug.ui.CommonTab;
|
||||
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
||||
import org.eclipse.debug.ui.ILaunchConfigurationTab;
|
||||
import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
|
||||
|
||||
public class GdbLocalRunLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
|
||||
*/
|
||||
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
|
||||
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
|
||||
new CMainTab(true),
|
||||
new CDebuggerTab(SessionType.RUN),
|
||||
new SourceLookupTab(),
|
||||
new CommonTab()
|
||||
};
|
||||
setTabs(tabs);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 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 API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.dd.gdb.internal.ui.launching;
|
||||
|
||||
import org.eclipse.cdt.launch.ui.CMainTab;
|
||||
import org.eclipse.dd.gdb.service.command.GDBControl.SessionType;
|
||||
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
|
||||
import org.eclipse.debug.ui.CommonTab;
|
||||
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
||||
import org.eclipse.debug.ui.ILaunchConfigurationTab;
|
||||
import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
|
||||
|
||||
public class GdbRemoteRunLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
|
||||
*/
|
||||
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
|
||||
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
|
||||
new CMainTab(true),
|
||||
new CDebuggerTab(SessionType.REMOTE),
|
||||
new SourceLookupTab(),
|
||||
new CommonTab()
|
||||
};
|
||||
setTabs(tabs);
|
||||
}
|
||||
}
|
|
@ -5,7 +5,6 @@ Bundle-SymbolicName: org.eclipse.dd.tests.gdb;singleton:=true
|
|||
Bundle-Version: 1.0.0
|
||||
Bundle-Activator: org.eclipse.dd.tests.gdb.launching.TestsPlugin
|
||||
Bundle-Vendor: Ericsson
|
||||
Bundle-Localization: plugin
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.dd.dsf,
|
||||
org.eclipse.dd.dsf.debug,
|
||||
|
@ -17,8 +16,7 @@ Require-Bundle: org.eclipse.core.runtime,
|
|||
org.eclipse.debug.core,
|
||||
org.eclipse.cdt.debug.mi.core,
|
||||
org.eclipse.swt,
|
||||
org.eclipse.dd.gdb,
|
||||
org.eclipse.dd.gdb.launch
|
||||
org.eclipse.dd.gdb
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Bundle-ClassPath: .
|
||||
|
|
Loading…
Add table
Reference in a new issue