mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 21:05:37 +02:00
[202346] Support for postmortem debugging in DSF-GDB
This commit is contained in:
parent
2646066384
commit
ea4d177c6c
19 changed files with 834 additions and 223 deletions
|
@ -109,6 +109,39 @@
|
|||
<associatedDelegate delegate="org.eclipse.cdt.dsf.gdb.launch.attachCLaunch"/>
|
||||
<placement after="org.eclipse.debug.ui.sourceLookupTab"/>
|
||||
</tab>
|
||||
|
||||
<!-- PostMortem launch tabs-->
|
||||
<tab
|
||||
id="org.eclipse.cdt.dsf.gdb.launch.coreLaunch.mainTab"
|
||||
group="org.eclipse.cdt.launch.postmortemLaunchTabGroup"
|
||||
name="%launchTab.main.name"
|
||||
class="org.eclipse.cdt.dsf.gdb.internal.ui.launching.CMainCoreTab">
|
||||
<associatedDelegate delegate="org.eclipse.cdt.dsf.gdb.launch.coreCLaunch"/>
|
||||
</tab>
|
||||
<tab
|
||||
id="org.eclipse.cdt.dsf.gdb.launch.coreLaunch.debuggerTab"
|
||||
group="org.eclipse.cdt.launch.postmortemLaunchTabGroup"
|
||||
name="%launchTab.debugger.name"
|
||||
class="org.eclipse.cdt.dsf.gdb.internal.ui.launching.CoreFileDebuggerTab">
|
||||
<associatedDelegate delegate="org.eclipse.cdt.dsf.gdb.launch.coreCLaunch"/>
|
||||
<placement after="org.eclipse.cdt.dsf.gdb.launch.mainTab"/>
|
||||
</tab>
|
||||
<tab
|
||||
id="org.eclipse.cdt.dsf.gdb.launch.coreLaunch.sourceLookupTab"
|
||||
group="org.eclipse.cdt.launch.postmortemLaunchTabGroup"
|
||||
name="%launchTab.sourceLookup.name"
|
||||
class="org.eclipse.debug.ui.sourcelookup.SourceLookupTab">
|
||||
<associatedDelegate delegate="org.eclipse.cdt.dsf.gdb.launch.coreCLaunch"/>
|
||||
<placement after="org.eclipse.cdt.dsf.gdb.launch.debuggerTab"/>
|
||||
</tab>
|
||||
<tab
|
||||
id="org.eclipse.cdt.dsf.gdb.launch.coreLaunch.commonTab"
|
||||
group="org.eclipse.cdt.launch.postmortemLaunchTabGroup"
|
||||
name="%launchTab.common.name"
|
||||
class="org.eclipse.debug.ui.CommonTab">
|
||||
<associatedDelegate delegate="org.eclipse.cdt.dsf.gdb.launch.coreCLaunch"/>
|
||||
<placement after="org.eclipse.debug.ui.sourceLookupTab"/>
|
||||
</tab>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
|
@ -160,6 +193,12 @@
|
|||
id="org.eclipse.cdt.dsf.gdb.ui.processPrompter"
|
||||
plugin="org.eclipse.cdt.dsf.gdb.ui">
|
||||
</statusHandler>
|
||||
<statusHandler
|
||||
class="org.eclipse.cdt.dsf.gdb.internal.ui.launching.CoreFilePrompter"
|
||||
code="1001"
|
||||
id="org.eclipse.cdt.dsf.gdb.ui.coreFilePrompter"
|
||||
plugin="org.eclipse.cdt.dsf.gdb.ui">
|
||||
</statusHandler>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.debug.ui.CDebuggerPage">
|
||||
|
|
|
@ -13,17 +13,11 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||
|
||||
import java.io.IOException;
|
||||
import com.ibm.icu.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
|
@ -39,8 +33,6 @@ import org.eclipse.cdt.dsf.gdb.service.SessionType;
|
|||
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.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -59,6 +51,8 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.ibm.icu.text.Collator;
|
||||
|
||||
public class CDebuggerTab extends AbstractCDebuggerTab {
|
||||
|
||||
/**
|
||||
|
@ -68,13 +62,14 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
public static final String TAB_ID = "org.eclipse.cdt.dsf.gdb.launch.debuggerTab";
|
||||
public static final String TAB_ID = "org.eclipse.cdt.dsf.gdb.launch.debuggerTab"; //$NON-NLS-1$
|
||||
|
||||
private final static String LOCAL_DEBUGGER_ID = "org.eclipse.cdt.dsf.gdb.GdbDebugger";//$NON-NLS-1$
|
||||
private final static String REMOTE_DEBUGGER_ID = "org.eclipse.cdt.dsf.gdb.GdbServerDebugger";//$NON-NLS-1$
|
||||
|
||||
protected boolean fAttachMode = false;
|
||||
protected boolean fRemoteMode = false;
|
||||
protected boolean fCoreMode = false;
|
||||
|
||||
protected Button fStopInMain;
|
||||
protected Text fStopInMainSymbol;
|
||||
|
@ -84,7 +79,11 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
private Composite fContents;
|
||||
|
||||
public CDebuggerTab(SessionType sessionType, boolean attach) {
|
||||
if (sessionType == SessionType.REMOTE) fRemoteMode = true;
|
||||
if (sessionType == SessionType.REMOTE) {
|
||||
fRemoteMode = true;
|
||||
} else if (sessionType == SessionType.CORE) {
|
||||
fCoreMode = true;
|
||||
}
|
||||
fAttachMode = attach;
|
||||
|
||||
ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDefaultDebugConfiguration();
|
||||
|
@ -125,7 +124,6 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
}
|
||||
|
||||
protected void loadDebuggerComboBox(ILaunchConfiguration config, String selection) {
|
||||
// String configPlatform = getPlatform(config);
|
||||
ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
|
||||
Arrays.sort(debugConfigs, new Comparator<ICDebugConfiguration>() {
|
||||
public int compare(ICDebugConfiguration c1, ICDebugConfiguration c2) {
|
||||
|
@ -144,17 +142,12 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
}
|
||||
String defaultSelection = selection;
|
||||
for (ICDebugConfiguration debugConfig: debugConfigs) {
|
||||
// Note that for an attach session, we don't know yet if the user will want to do a
|
||||
// remote session. So, we must allow for the remote debugger even if fRemote is false,
|
||||
// in the case of attach
|
||||
if (((fRemoteMode || fAttachMode) && debugConfig.getID().equals(REMOTE_DEBUGGER_ID)) ||
|
||||
(!fRemoteMode && debugConfig.getID().equals(LOCAL_DEBUGGER_ID))) {
|
||||
// String debuggerPlatform = debugConfig.getPlatform();
|
||||
// if (validatePlatform(config, debugConfig)) {
|
||||
list.add(debugConfig);
|
||||
// // select first exact matching debugger for platform or
|
||||
// // requested selection
|
||||
// if ((defaultSelection.equals("") && debuggerPlatform.equalsIgnoreCase(configPlatform))) { //$NON-NLS-1$
|
||||
// defaultSelection = debugConfig.getID();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
// if no selection meaning nothing in config the force initdefault on tab
|
||||
|
@ -180,12 +173,15 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
} else if (fRemoteMode) {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
|
||||
} else if (fCoreMode){
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
|
||||
} else {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
|
||||
}
|
||||
|
||||
if (!fAttachMode) {
|
||||
if (!fAttachMode && !fCoreMode) {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT);
|
||||
}
|
||||
|
@ -252,16 +248,18 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
} else if (fRemoteMode) {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
|
||||
} else if (fCoreMode){
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
|
||||
} else {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
|
||||
}
|
||||
if (!fAttachMode) {
|
||||
if (!fAttachMode && !fCoreMode) {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
|
||||
fStopInMain.getSelection());
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
|
||||
fStopInMainSymbol.getText());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -270,22 +268,6 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
if (!validateDebuggerConfig(config)) {
|
||||
return false;
|
||||
}
|
||||
// ICDebugConfiguration debugConfig = getDebugConfig();
|
||||
// if (fAttachMode && !debugConfig.supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
|
||||
// setErrorMessage(MessageFormat.format(LaunchMessages.getString("CDebuggerTab.Mode_not_supported"), //$NON-NLS-1$
|
||||
// (Object[]) new String[]{ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH}));
|
||||
// return false;
|
||||
// }
|
||||
// if (fRemoteMode && !debugConfig.supportsMode(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE)) {
|
||||
// setErrorMessage(MessageFormat.format(LaunchMessages.getString("CDebuggerTab.Mode_not_supported"), //$NON-NLS-1$
|
||||
// (Object[]) new String[]{IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE}));
|
||||
// return false;
|
||||
// }
|
||||
// if (!fAttachMode && !fRemoteMode && !debugConfig.supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
|
||||
// setErrorMessage(MessageFormat.format(LaunchMessages.getString("CDebuggerTab.Mode_not_supported"), //$NON-NLS-1$
|
||||
// (Object[]) new String[]{ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN}));
|
||||
// return false;
|
||||
// }
|
||||
if (fStopInMain != null && fStopInMainSymbol != null) {
|
||||
// The "Stop on startup at" field must not be empty
|
||||
String mainSymbol = fStopInMainSymbol.getText().trim();
|
||||
|
@ -300,54 +282,6 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
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 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) {
|
||||
|
@ -375,7 +309,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
GridLayout layout = new GridLayout(numberOfColumns, false);
|
||||
optionsComp.setLayout(layout);
|
||||
optionsComp.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false, 1, 1));
|
||||
if (!fAttachMode) {
|
||||
if (!fAttachMode && !fCoreMode) {
|
||||
fStopInMain = createCheckButton(optionsComp, LaunchMessages.getString("CDebuggerTab.Stop_at_main_on_startup")); //$NON-NLS-1$
|
||||
fStopInMain.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
|
@ -425,13 +359,13 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
|
||||
protected void initializeCommonControls(ILaunchConfiguration config) {
|
||||
try {
|
||||
if (!fAttachMode) {
|
||||
if (!fAttachMode && !fCoreMode) {
|
||||
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());
|
||||
} else {
|
||||
} else if (fAttachMode) {
|
||||
// In attach mode, figure out if we are doing a remote connect based on the currently
|
||||
// chosen debugger
|
||||
if (getDebugConfig().getID().equals(REMOTE_DEBUGGER_ID)) fRemoteMode = true;
|
||||
|
|
|
@ -18,6 +18,6 @@ package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
|||
*/
|
||||
public class CMainAttachTab extends CMainTab {
|
||||
public CMainAttachTab() {
|
||||
super(2);// In some case, we don't need to specify an executable
|
||||
super(CMainTab.DONT_CHECK_PROGRAM);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/*******************************************************************************
|
||||
* 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 API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||
|
||||
|
||||
/**
|
||||
* Main tab to use for an attach launch configuration.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
public class CMainCoreTab extends CMainTab {
|
||||
public CMainCoreTab() {
|
||||
super(CMainTab.SPECIFY_CORE_FILE);
|
||||
}
|
||||
}
|
|
@ -29,7 +29,6 @@ import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
|||
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
||||
import org.eclipse.cdt.dsf.gdb.launching.LaunchMessages;
|
||||
import org.eclipse.cdt.ui.CElementLabelProvider;
|
||||
import org.eclipse.cdt.utils.pty.PTY;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
|
@ -78,7 +77,7 @@ public class CMainTab extends CLaunchConfigurationTab {
|
|||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
public static final String TAB_ID = "org.eclipse.cdt.dsf.gdb.launch.mainTab";
|
||||
public static final String TAB_ID = "org.eclipse.cdt.dsf.gdb.launch.mainTab"; //$NON-NLS-1$
|
||||
|
||||
// Project UI widgets
|
||||
protected Label fProjLabel;
|
||||
|
@ -90,29 +89,28 @@ public class CMainTab extends CLaunchConfigurationTab {
|
|||
protected Text fProgText;
|
||||
protected Button fSearchButton;
|
||||
|
||||
private final boolean fWantsTerminalOption;
|
||||
protected Button fTerminalButton;
|
||||
// Core file UI widgets
|
||||
protected Label fCoreLabel;
|
||||
protected Text fCoreText;
|
||||
protected Button fCoreButton;
|
||||
|
||||
private final boolean dontCheckProgram;
|
||||
private final boolean fDontCheckProgram;
|
||||
private final boolean fSpecifyCoreFile;
|
||||
|
||||
protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||
|
||||
private String filterPlatform = EMPTY_STRING;
|
||||
|
||||
public static final int WANTS_TERMINAL = 1;
|
||||
public static final int DONT_CHECK_PROGRAM = 2;
|
||||
public static final int SPECIFY_CORE_FILE = 4;
|
||||
|
||||
public CMainTab() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public CMainTab(boolean terminalOption) {
|
||||
this(terminalOption ? WANTS_TERMINAL : 0);
|
||||
}
|
||||
|
||||
public CMainTab(int flags) {
|
||||
fWantsTerminalOption = (flags & WANTS_TERMINAL) != 0;
|
||||
dontCheckProgram = (flags & DONT_CHECK_PROGRAM) != 0;
|
||||
fDontCheckProgram = (flags & DONT_CHECK_PROGRAM) != 0;
|
||||
fSpecifyCoreFile = (flags & SPECIFY_CORE_FILE) != 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -133,9 +131,10 @@ public class CMainTab extends CLaunchConfigurationTab {
|
|||
createProjectGroup(comp, 1);
|
||||
createExeFileGroup(comp, 1);
|
||||
createVerticalSpacer(comp, 1);
|
||||
if (wantsTerminalOption() /* && ProcessFactory.supportesTerminal() */) {
|
||||
createTerminalOption(comp, 1);
|
||||
if (fSpecifyCoreFile) {
|
||||
createCoreFileGroup(comp, 1);
|
||||
}
|
||||
|
||||
GdbUIPlugin.setDialogShell(parent.getShell());
|
||||
}
|
||||
|
||||
|
@ -210,41 +209,57 @@ public class CMainTab extends CLaunchConfigurationTab {
|
|||
}
|
||||
});
|
||||
|
||||
Button fBrowseForBinaryButton;
|
||||
fBrowseForBinaryButton = createPushButton(mainComp, LaunchMessages.getString("Launch.common.Browse_2"), null); //$NON-NLS-1$
|
||||
fBrowseForBinaryButton.addSelectionListener(new SelectionAdapter() {
|
||||
Button browseForBinaryButton;
|
||||
browseForBinaryButton = createPushButton(mainComp, LaunchMessages.getString("Launch.common.Browse_2"), null); //$NON-NLS-1$
|
||||
browseForBinaryButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent evt) {
|
||||
handleBinaryBrowseButtonSelected();
|
||||
String text = handleBrowseButtonSelected();
|
||||
if (text != null) {
|
||||
fProgText.setText(text);
|
||||
}
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected boolean wantsTerminalOption() {
|
||||
return fWantsTerminalOption;
|
||||
}
|
||||
|
||||
protected void createTerminalOption(Composite parent, int colSpan) {
|
||||
Composite mainComp = new Composite(parent, SWT.NONE);
|
||||
GridLayout mainLayout = new GridLayout();
|
||||
mainLayout.numColumns = 1;
|
||||
mainLayout.marginHeight = 0;
|
||||
mainLayout.marginWidth = 0;
|
||||
mainComp.setLayout(mainLayout);
|
||||
}
|
||||
|
||||
/** @since 2.0 */
|
||||
protected void createCoreFileGroup(Composite parent, int colSpan) {
|
||||
Composite coreComp = new Composite(parent, SWT.NONE);
|
||||
GridLayout coreLayout = new GridLayout();
|
||||
coreLayout.numColumns = 3;
|
||||
coreLayout.marginHeight = 0;
|
||||
coreLayout.marginWidth = 0;
|
||||
coreComp.setLayout(coreLayout);
|
||||
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd.horizontalSpan = colSpan;
|
||||
mainComp.setLayoutData(gd);
|
||||
|
||||
fTerminalButton = createCheckButton(mainComp, LaunchMessages.getString("CMainTab.UseTerminal")); //$NON-NLS-1$
|
||||
fTerminalButton.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent evt) {
|
||||
coreComp.setLayoutData(gd);
|
||||
fCoreLabel = new Label(coreComp, SWT.NONE);
|
||||
fCoreLabel.setText(LaunchMessages.getString("CMainTab.CoreFile_path")); //$NON-NLS-1$
|
||||
gd = new GridData();
|
||||
gd.horizontalSpan = 3;
|
||||
fCoreLabel.setLayoutData(gd);
|
||||
fCoreText = new Text(coreComp, SWT.SINGLE | SWT.BORDER);
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
fCoreText.setLayoutData(gd);
|
||||
fCoreText.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent evt) {
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
});
|
||||
|
||||
Button browseForCoreButton;
|
||||
browseForCoreButton = createPushButton(coreComp, LaunchMessages.getString("Launch.common.Browse_2"), null); //$NON-NLS-1$
|
||||
browseForCoreButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent evt) {
|
||||
String text = handleBrowseButtonSelected();
|
||||
if (text != null) {
|
||||
fCoreText.setText(text);
|
||||
}
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
});
|
||||
fTerminalButton.setEnabled(PTY.isSupported());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -256,19 +271,7 @@ public class CMainTab extends CLaunchConfigurationTab {
|
|||
filterPlatform = getPlatform(config);
|
||||
updateProjectFromConfig(config);
|
||||
updateProgramFromConfig(config);
|
||||
updateTerminalFromConfig(config);
|
||||
}
|
||||
|
||||
protected void updateTerminalFromConfig(ILaunchConfiguration config) {
|
||||
if (fTerminalButton != null) {
|
||||
boolean useTerminal = true;
|
||||
try {
|
||||
useTerminal = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, ICDTLaunchConfigurationConstants.USE_TERMINAL_DEFAULT);
|
||||
} catch (CoreException e) {
|
||||
GdbUIPlugin.log(e);
|
||||
}
|
||||
fTerminalButton.setSelection(useTerminal);
|
||||
}
|
||||
updateCoreFromConfig(config);
|
||||
}
|
||||
|
||||
protected void updateProjectFromConfig(ILaunchConfiguration config) {
|
||||
|
@ -290,6 +293,19 @@ public class CMainTab extends CLaunchConfigurationTab {
|
|||
}
|
||||
fProgText.setText(programName);
|
||||
}
|
||||
|
||||
/** @since 2.0 */
|
||||
protected void updateCoreFromConfig(ILaunchConfiguration config) {
|
||||
if (fCoreText != null) {
|
||||
String coreName = EMPTY_STRING;
|
||||
try {
|
||||
coreName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, EMPTY_STRING);
|
||||
} catch (CoreException ce) {
|
||||
GdbUIPlugin.log(ce);
|
||||
}
|
||||
fCoreText.setText(coreName);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
@ -318,8 +334,8 @@ public class CMainTab extends CLaunchConfigurationTab {
|
|||
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, fProjText.getText());
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, fProgText.getText());
|
||||
if (fTerminalButton != null) {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, fTerminalButton.getSelection());
|
||||
if (fCoreText != null) {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, fCoreText.getText());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -397,23 +413,12 @@ public class CMainTab extends CLaunchConfigurationTab {
|
|||
}
|
||||
|
||||
/**
|
||||
* Show a dialog that lets the user select a project. This in turn provides context for the main
|
||||
* type, allowing the user to key a main type name, or constraining the search for main types to
|
||||
* the specified project.
|
||||
* Show a dialog that lets the user select a file.
|
||||
*/
|
||||
protected void handleBinaryBrowseButtonSelected() {
|
||||
final ICProject cproject = getCProject();
|
||||
if (cproject == null) {
|
||||
MessageDialog.openInformation(getShell(), LaunchMessages.getString("CMainTab.Project_required"), //$NON-NLS-1$
|
||||
LaunchMessages.getString("CMainTab.Enter_project_before_browsing_for_program")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
protected String handleBrowseButtonSelected() {
|
||||
FileDialog fileDialog = new FileDialog(getShell(), SWT.NONE);
|
||||
fileDialog.setFileName(fProgText.getText());
|
||||
String text= fileDialog.open();
|
||||
if (text != null) {
|
||||
fProgText.setText(text);
|
||||
}
|
||||
return fileDialog.open();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -537,57 +542,73 @@ public class CMainTab extends CLaunchConfigurationTab {
|
|||
setErrorMessage(null);
|
||||
setMessage(null);
|
||||
|
||||
if (dontCheckProgram)
|
||||
return true;
|
||||
if (!fDontCheckProgram) {
|
||||
String name = fProjText.getText().trim();
|
||||
if (name.length() == 0) {
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Project_not_specified")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
if (!ResourcesPlugin.getWorkspace().getRoot().getProject(name).exists()) {
|
||||
setErrorMessage(LaunchMessages.getString("Launch.common.Project_does_not_exist")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
|
||||
if (!project.isOpen()) {
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Project_must_be_opened")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
|
||||
String name = fProjText.getText().trim();
|
||||
if (name.length() == 0) {
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Project_not_specified")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
if (!ResourcesPlugin.getWorkspace().getRoot().getProject(name).exists()) {
|
||||
setErrorMessage(LaunchMessages.getString("Launch.common.Project_does_not_exist")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
|
||||
if (!project.isOpen()) {
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Project_must_be_opened")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
|
||||
name = fProgText.getText().trim();
|
||||
if (name.length() == 0) {
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Program_not_specified")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
if (name.equals(".") || name.equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
IPath exePath = new Path(name);
|
||||
if (!exePath.isAbsolute()) {
|
||||
if (!project.getFile(name).exists()) {
|
||||
name = fProgText.getText().trim();
|
||||
if (name.length() == 0) {
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Program_not_specified")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
if (name.equals(".") || name.equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
exePath = project.getFile(name).getLocation();
|
||||
} else {
|
||||
if (!exePath.toFile().exists()) {
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$
|
||||
IPath exePath = new Path(name);
|
||||
if (!exePath.isAbsolute()) {
|
||||
if (!project.getFile(name).exists()) {
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
exePath = project.getFile(name).getLocation();
|
||||
} else {
|
||||
if (!exePath.toFile().exists()) {
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (!isBinary(project, exePath)) {
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Program_is_not_a_recongnized_executable")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
GdbUIPlugin.log(e);
|
||||
setErrorMessage(e.getLocalizedMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (!isBinary(project, exePath)) {
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Program_is_not_a_recongnized_executable")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
GdbUIPlugin.log(e);
|
||||
setErrorMessage(e.getLocalizedMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fCoreText != null) {
|
||||
String coreName = fCoreText.getText().trim();
|
||||
// We accept an empty string. This should trigger a prompt to the user
|
||||
// This allows to re-use the launch, with a different core file.
|
||||
if (!coreName.equals(EMPTY_STRING)) {
|
||||
if (coreName.equals(".") || coreName.equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Core_does_not_exist")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
IPath corePath = new Path(coreName);
|
||||
if (!corePath.toFile().exists()) {
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Core_does_not_exist")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -625,25 +646,21 @@ public class CMainTab extends CLaunchConfigurationTab {
|
|||
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
|
||||
*/
|
||||
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
|
||||
// We set empty attributes for project & program so that when one config
|
||||
// is
|
||||
// compared to another, the existence of empty attributes doesn't cause
|
||||
// an
|
||||
// incorrect result (the performApply() method can result in empty
|
||||
// values
|
||||
// We set empty attributes for project & program so that when one config is
|
||||
// compared to another, the existence of empty attributes doesn't cause and
|
||||
// incorrect result (the performApply() method can result in empty values
|
||||
// for these attributes being set on a config if there is nothing in the
|
||||
// corresponding text boxes)
|
||||
// plus getContext will use this to base context from if set.
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, EMPTY_STRING);
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, EMPTY_STRING);
|
||||
|
||||
ICElement cElement = null;
|
||||
cElement = getContext(config, getPlatform(config));
|
||||
if (cElement != null) {
|
||||
initializeCProject(cElement, config);
|
||||
initializeProgramName(cElement, config);
|
||||
}
|
||||
if (wantsTerminalOption()) {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, ICDTLaunchConfigurationConstants.USE_TERMINAL_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/*******************************************************************************
|
||||
* 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 API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||
|
||||
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
|
||||
import org.eclipse.cdt.debug.ui.ICDebuggerPage;
|
||||
import org.eclipse.cdt.dsf.gdb.service.SessionType;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
|
||||
/**
|
||||
* @since 2.0
|
||||
*/
|
||||
public class CoreFileDebuggerTab extends CDebuggerTab {
|
||||
public CoreFileDebuggerTab() {
|
||||
super(SessionType.CORE, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadDynamicDebugArea() {
|
||||
// Dispose of any current child widgets in the tab holder area
|
||||
Control[] children = getDynamicTabHolder().getChildren();
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
children[i].dispose();
|
||||
}
|
||||
|
||||
ICDebugConfiguration debugConfig = getConfigForCurrentDebugger();
|
||||
if (debugConfig == null) {
|
||||
setDynamicTab(null);
|
||||
} else {
|
||||
ICDebuggerPage tab = new GdbCoreDebuggerPage();
|
||||
setDynamicTab(tab);
|
||||
}
|
||||
setDebugConfig(debugConfig);
|
||||
|
||||
if (getDynamicTab() == null) {
|
||||
return;
|
||||
}
|
||||
// Ask the dynamic UI to create its Control
|
||||
getDynamicTab().setLaunchConfigurationDialog(getLaunchConfigurationDialog());
|
||||
getDynamicTab().createControl(getDynamicTabHolder());
|
||||
getDynamicTab().getControl().setVisible(true);
|
||||
getDynamicTabHolder().layout(true);
|
||||
contentsChanged();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/*******************************************************************************
|
||||
* 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 API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
||||
import org.eclipse.cdt.dsf.gdb.launching.LaunchMessages;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.IStatusHandler;
|
||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||
import org.eclipse.swt.widgets.FileDialog;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
/**
|
||||
* @since 2.0
|
||||
*/
|
||||
public class CoreFilePrompter implements IStatusHandler {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus,
|
||||
* java.lang.Object)
|
||||
*/
|
||||
public Object handleStatus(IStatus status, Object params) throws CoreException {
|
||||
final Shell shell = GdbUIPlugin.getShell();
|
||||
if (shell == null) {
|
||||
IStatus error = new Status(IStatus.ERROR, GdbUIPlugin.getUniqueIdentifier(),
|
||||
ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR,
|
||||
LaunchMessages.getString("CoreFileLaunchDelegate.No_Shell_available_in_Launch"), null); //$NON-NLS-1$
|
||||
throw new CoreException(error);
|
||||
}
|
||||
|
||||
FileDialog dialog = new FileDialog(shell);
|
||||
dialog.setText(LaunchMessages.getString("CoreFileLaunchDelegate.Select_Corefile")); //$NON-NLS-1$
|
||||
String res = dialog.open();
|
||||
if (res != null) {
|
||||
File file = new File(res);
|
||||
if (!file.exists() || !file.canRead()) {
|
||||
ErrorDialog.openError(shell, LaunchMessages.getString("CoreFileLaunchDelegate.postmortem_debugging_failed"), //$NON-NLS-1$
|
||||
LaunchMessages.getString("CoreFileLaunchDelegate.Corefile_not_accessible"), //$NON-NLS-1$
|
||||
new Status(IStatus.ERROR, GdbUIPlugin.getUniqueIdentifier(),
|
||||
ICDTLaunchConfigurationConstants.ERR_NO_COREFILE,
|
||||
LaunchMessages.getString("CoreFileLaunchDelegate.Corefile_not_readable"), null)); //$NON-NLS-1$
|
||||
}
|
||||
return res;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,302 @@
|
|||
/*******************************************************************************
|
||||
* 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 API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
import org.eclipse.cdt.debug.ui.AbstractCDebuggerPage;
|
||||
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.swt.SWT;
|
||||
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.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.FileDialog;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.TabFolder;
|
||||
import org.eclipse.swt.widgets.TabItem;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
/**
|
||||
* The dynamic tab for gdb-based debugger implementations that do post mortem debugging.
|
||||
* It is the same as the GdbDebuggerPage class without non-stop or reverse check boxes.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
public class GdbCoreDebuggerPage extends AbstractCDebuggerPage implements Observer {
|
||||
|
||||
protected TabFolder fTabFolder;
|
||||
protected Text fGDBCommandText;
|
||||
protected Text fGDBInitText;
|
||||
|
||||
private IMILaunchConfigurationComponent fSolibBlock;
|
||||
private boolean fIsInitializing = false;
|
||||
|
||||
public void createControl(Composite parent) {
|
||||
Composite comp = new Composite(parent, SWT.NONE);
|
||||
comp.setLayout(new GridLayout());
|
||||
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
fTabFolder = new TabFolder(comp, SWT.NONE);
|
||||
fTabFolder.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL));
|
||||
createTabs(fTabFolder);
|
||||
fTabFolder.setSelection(0);
|
||||
setControl(parent);
|
||||
}
|
||||
|
||||
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
|
||||
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
|
||||
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
|
||||
|
||||
if (fSolibBlock != null)
|
||||
fSolibBlock.setDefaults(configuration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(ILaunchConfiguration launchConfig) {
|
||||
boolean valid = fGDBCommandText.getText().length() != 0;
|
||||
if (valid) {
|
||||
setErrorMessage(null);
|
||||
setMessage(null);
|
||||
}
|
||||
else {
|
||||
setErrorMessage(LaunchUIMessages.getString("GDBDebuggerPage.0")); //$NON-NLS-1$
|
||||
setMessage(null);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
public void initializeFrom(ILaunchConfiguration configuration) {
|
||||
setInitializing(true);
|
||||
String gdbCommand = IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT;
|
||||
String gdbInit = IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT;
|
||||
|
||||
try {
|
||||
gdbCommand = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
|
||||
}
|
||||
catch(CoreException e) {
|
||||
}
|
||||
try {
|
||||
gdbInit = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
|
||||
}
|
||||
catch(CoreException e) {
|
||||
}
|
||||
|
||||
|
||||
if (fSolibBlock != null)
|
||||
fSolibBlock.initializeFrom(configuration);
|
||||
fGDBCommandText.setText(gdbCommand);
|
||||
fGDBInitText.setText(gdbInit);
|
||||
|
||||
setInitializing(false);
|
||||
}
|
||||
|
||||
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
|
||||
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
|
||||
fGDBCommandText.getText().trim());
|
||||
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
|
||||
fGDBInitText.getText().trim());
|
||||
|
||||
if (fSolibBlock != null)
|
||||
fSolibBlock.performApply(configuration);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return LaunchUIMessages.getString("GDBDebuggerPage.1"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getShell()
|
||||
*/
|
||||
@Override
|
||||
protected Shell getShell() {
|
||||
return super.getShell();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
|
||||
*/
|
||||
@Override
|
||||
protected void updateLaunchConfigurationDialog() {
|
||||
super.updateLaunchConfigurationDialog();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.util.Observer#update(java.util.Observable, java.lang.Object)
|
||||
*/
|
||||
public void update(Observable o, Object arg) {
|
||||
if (!isInitializing())
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
|
||||
public IMILaunchConfigurationComponent createSolibBlock(Composite parent) {
|
||||
IMILaunchConfigurationComponent block = new GDBSolibBlock( new SolibSearchPathBlock(), true, true);
|
||||
block.createControl(parent);
|
||||
return block;
|
||||
}
|
||||
|
||||
public void createTabs(TabFolder tabFolder) {
|
||||
createMainTab(tabFolder);
|
||||
createSolibTab(tabFolder);
|
||||
}
|
||||
|
||||
public void createMainTab(TabFolder tabFolder) {
|
||||
TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
|
||||
tabItem.setText(LaunchUIMessages.getString("GDBDebuggerPage.2")); //$NON-NLS-1$
|
||||
Composite comp = ControlFactory.createCompositeEx(tabFolder, 1, GridData.FILL_BOTH);
|
||||
((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
|
||||
comp.setFont(tabFolder.getFont());
|
||||
tabItem.setControl(comp);
|
||||
Composite subComp = ControlFactory.createCompositeEx(comp, 3, GridData.FILL_HORIZONTAL);
|
||||
((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
|
||||
subComp.setFont(tabFolder.getFont());
|
||||
Label label = ControlFactory.createLabel(subComp, LaunchUIMessages.getString("GDBDebuggerPage.3")); //$NON-NLS-1$
|
||||
GridData gd = new GridData();
|
||||
// gd.horizontalSpan = 2;
|
||||
label.setLayoutData(gd);
|
||||
fGDBCommandText = ControlFactory.createTextField(subComp, SWT.SINGLE | SWT.BORDER);
|
||||
fGDBCommandText.addModifyListener(new ModifyListener() {
|
||||
|
||||
public void modifyText(ModifyEvent evt) {
|
||||
if (!isInitializing())
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
});
|
||||
Button button = createPushButton(subComp, LaunchUIMessages.getString("GDBDebuggerPage.4"), null); //$NON-NLS-1$
|
||||
button.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent evt) {
|
||||
handleGDBButtonSelected();
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
|
||||
private void handleGDBButtonSelected() {
|
||||
FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
|
||||
dialog.setText(LaunchUIMessages.getString("GDBDebuggerPage.5")); //$NON-NLS-1$
|
||||
String gdbCommand = fGDBCommandText.getText().trim();
|
||||
int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
|
||||
if (lastSeparatorIndex != -1) {
|
||||
dialog.setFilterPath(gdbCommand.substring(0, lastSeparatorIndex));
|
||||
}
|
||||
String res = dialog.open();
|
||||
if (res == null) {
|
||||
return;
|
||||
}
|
||||
fGDBCommandText.setText(res);
|
||||
}
|
||||
});
|
||||
label = ControlFactory.createLabel(subComp, LaunchUIMessages.getString("GDBDebuggerPage.6")); //$NON-NLS-1$
|
||||
gd = new GridData();
|
||||
// gd.horizontalSpan = 2;
|
||||
label.setLayoutData(gd);
|
||||
fGDBInitText = ControlFactory.createTextField(subComp, SWT.SINGLE | SWT.BORDER);
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
fGDBInitText.setLayoutData(gd);
|
||||
fGDBInitText.addModifyListener(new ModifyListener() {
|
||||
|
||||
public void modifyText(ModifyEvent evt) {
|
||||
if (!isInitializing())
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
});
|
||||
button = createPushButton(subComp, LaunchUIMessages.getString("GDBDebuggerPage.7"), null); //$NON-NLS-1$
|
||||
button.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent evt) {
|
||||
handleGDBInitButtonSelected();
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
|
||||
private void handleGDBInitButtonSelected() {
|
||||
FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
|
||||
dialog.setText(LaunchUIMessages.getString("GDBDebuggerPage.8")); //$NON-NLS-1$
|
||||
String gdbCommand = fGDBInitText.getText().trim();
|
||||
int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
|
||||
if (lastSeparatorIndex != -1) {
|
||||
dialog.setFilterPath(gdbCommand.substring(0, lastSeparatorIndex));
|
||||
}
|
||||
String res = dialog.open();
|
||||
if (res == null) {
|
||||
return;
|
||||
}
|
||||
fGDBInitText.setText(res);
|
||||
}
|
||||
});
|
||||
|
||||
label = ControlFactory.createLabel(subComp, LaunchUIMessages.getString("GDBDebuggerPage.9"), //$NON-NLS-1$
|
||||
200, SWT.DEFAULT, SWT.WRAP);
|
||||
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd.horizontalSpan = 3;
|
||||
gd.widthHint = 200;
|
||||
label.setLayoutData(gd);
|
||||
}
|
||||
|
||||
public void createSolibTab(TabFolder tabFolder) {
|
||||
TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
|
||||
tabItem.setText(LaunchUIMessages.getString("GDBDebuggerPage.10")); //$NON-NLS-1$
|
||||
Composite comp = ControlFactory.createCompositeEx(fTabFolder, 1, GridData.FILL_BOTH);
|
||||
comp.setFont(tabFolder.getFont());
|
||||
tabItem.setControl(comp);
|
||||
fSolibBlock = createSolibBlock(comp);
|
||||
if (fSolibBlock instanceof Observable)
|
||||
((Observable)fSolibBlock).addObserver(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (fSolibBlock != null) {
|
||||
if (fSolibBlock instanceof Observable)
|
||||
((Observable)fSolibBlock).deleteObserver(this);
|
||||
fSolibBlock.dispose();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
|
||||
*/
|
||||
@Override
|
||||
public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
|
||||
// Override the default behavior
|
||||
}
|
||||
|
||||
protected boolean isInitializing() {
|
||||
return fIsInitializing;
|
||||
}
|
||||
|
||||
private void setInitializing(boolean isInitializing) {
|
||||
fIsInitializing = isInitializing;
|
||||
}
|
||||
}
|
|
@ -34,6 +34,16 @@
|
|||
sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
|
||||
sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
|
||||
</launchDelegate>
|
||||
<launchDelegate
|
||||
id="org.eclipse.cdt.dsf.gdb.launch.coreCLaunch"
|
||||
type="org.eclipse.cdt.launch.postmortemLaunchType"
|
||||
modes="debug"
|
||||
delegate="org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate"
|
||||
name="GDB (DSF) Postmortem Debugger"
|
||||
delegateDescription="Load an application dump under into the GDB debugger integrated using the Debugger Services Framework (DSF)."
|
||||
sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
|
||||
sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
|
||||
</launchDelegate>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetAutoSolib;
|
|||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetNonStop;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetSolibSearchPath;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetSelect;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetSelectCore;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.commands.RawCommand;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||
|
@ -47,6 +48,8 @@ import org.eclipse.core.runtime.IPath;
|
|||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.IStatusHandler;
|
||||
|
||||
public class FinalLaunchSequence extends Sequence {
|
||||
|
||||
|
@ -298,6 +301,61 @@ public class FinalLaunchSequence extends Sequence {
|
|||
|
||||
sourceLookup.setSourceLookupPath(sourceLookupDmc, locator.getSourceContainers(), requestMonitor);
|
||||
}},
|
||||
/*
|
||||
* Specify the core file to be debugged if we are launching such a debug session.
|
||||
*/
|
||||
new Step() {
|
||||
private String promptForCoreFilePath() throws CoreException {
|
||||
IStatus promptStatus = new Status(IStatus.INFO, "org.eclipse.debug.ui", 200/*STATUS_HANDLER_PROMPT*/, "", null); //$NON-NLS-1$//$NON-NLS-2$
|
||||
IStatus filePrompt = new Status(IStatus.INFO, "org.eclipse.cdt.dsf.gdb.ui", 1001, "", null); //$NON-NLS-1$//$NON-NLS-2$
|
||||
// consult a status handler
|
||||
IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus);
|
||||
if (prompter != null) {
|
||||
Object result = prompter.handleStatus(filePrompt, null);
|
||||
if (result instanceof String) {
|
||||
return (String)result;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public void execute(final RequestMonitor requestMonitor) {
|
||||
if (fSessionType == SessionType.CORE) {
|
||||
Exception exception = null;
|
||||
String coreFile;
|
||||
try {
|
||||
coreFile = fLaunch.getLaunchConfiguration().getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, ""); //$NON-NLS-1$
|
||||
|
||||
if (coreFile != null) {
|
||||
if (coreFile.length() == 0) {
|
||||
coreFile = promptForCoreFilePath();
|
||||
if (coreFile == null || coreFile.length()== 0) {
|
||||
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot get core file path", exception)); //$NON-NLS-1$
|
||||
requestMonitor.done();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fCommandControl.queueCommand(
|
||||
new MITargetSelectCore(fCommandControl.getContext(), coreFile),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
requestMonitor.done();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
exception = e;
|
||||
}
|
||||
|
||||
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot get core file path", exception)); //$NON-NLS-1$
|
||||
requestMonitor.done();
|
||||
} else {
|
||||
requestMonitor.done();
|
||||
}
|
||||
}},
|
||||
/*
|
||||
* If remote debugging, connect to target.
|
||||
*/
|
||||
|
@ -429,10 +487,14 @@ public class FinalLaunchSequence extends Sequence {
|
|||
*/
|
||||
new Step() { @Override
|
||||
public void execute(final RequestMonitor requestMonitor) {
|
||||
MIBreakpointsManager bpmService = fTracker.getService(MIBreakpointsManager.class);
|
||||
IBreakpointsTargetDMContext breakpointDmc = (IBreakpointsTargetDMContext)fCommandControl.getContext();
|
||||
if (fSessionType != SessionType.CORE) {
|
||||
MIBreakpointsManager bpmService = fTracker.getService(MIBreakpointsManager.class);
|
||||
IBreakpointsTargetDMContext breakpointDmc = (IBreakpointsTargetDMContext)fCommandControl.getContext();
|
||||
|
||||
bpmService.startTrackingBreakpoints(breakpointDmc, requestMonitor);
|
||||
bpmService.startTrackingBreakpoints(breakpointDmc, requestMonitor);
|
||||
} else {
|
||||
requestMonitor.done();
|
||||
}
|
||||
}},
|
||||
/*
|
||||
* Start the program.
|
||||
|
@ -440,7 +502,11 @@ public class FinalLaunchSequence extends Sequence {
|
|||
new Step() {
|
||||
@Override
|
||||
public void execute(final RequestMonitor requestMonitor) {
|
||||
fCommandControl.start(fLaunch, requestMonitor);
|
||||
if (fSessionType != SessionType.CORE) {
|
||||
fCommandControl.start(fLaunch, requestMonitor);
|
||||
} else {
|
||||
requestMonitor.done();
|
||||
}
|
||||
}
|
||||
},
|
||||
/*
|
||||
|
|
|
@ -98,6 +98,8 @@ public class GdbLaunchDelegate extends LaunchConfigurationDelegate
|
|||
|
||||
if (sessionType == SessionType.REMOTE) {
|
||||
monitor.subTask( "Debugging remote C/C++ application" );
|
||||
} else if (sessionType == SessionType.CORE) {
|
||||
monitor.subTask( "Post Mortem Debugging of C/C++ application" );
|
||||
} else {
|
||||
monitor.subTask( "Debugging local C/C++ application" );
|
||||
}
|
||||
|
@ -161,7 +163,7 @@ public class GdbLaunchDelegate extends LaunchConfigurationDelegate
|
|||
|
||||
// Add the CLI and "inferior" process objects to the launch.
|
||||
launch.addCLIProcess("gdb"); //$NON-NLS-1$
|
||||
if (!attach) {
|
||||
if (!attach && sessionType != SessionType.CORE) {
|
||||
launch.addInferiorProcess(exePath.lastSegment());
|
||||
}
|
||||
|
||||
|
|
|
@ -85,9 +85,11 @@ CMainTab.Project_not_specified=Project not specified
|
|||
CMainTab.Program_not_specified=Program not specified
|
||||
CMainTab.Project_must_be_opened=Project must be opened
|
||||
CMainTab.Program_does_not_exist=Program does not exist
|
||||
CMainTab.Core_does_not_exist=Core file does not exist
|
||||
CMainTab.Main=Main
|
||||
CMainTab.&ProjectColon=&Project:
|
||||
CMainTab.C/C++_Application=C/C++ Application:
|
||||
CMainTab.CoreFile_path=Core file (leave blank to trigger prompt:)
|
||||
CMainTab.Search...=Searc&h Project...
|
||||
CMainTab.Choose_program_to_run=Choose a &program to run:
|
||||
CMainTab.Choose_program_to_run_from_NAME=Choose a program to run from {0}:
|
||||
|
|
|
@ -151,8 +151,34 @@ public class GDBRunControl extends MIRunControl {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void canResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
|
||||
if (fGdb.getSessionType() == SessionType.CORE) {
|
||||
rm.setData(false);
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
super.canResume(context, rm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void canSuspend(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
|
||||
if (fGdb.getSessionType() == SessionType.CORE) {
|
||||
rm.setData(false);
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
super.canSuspend(context, rm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void canStep(final IExecutionDMContext context, StepType stepType, final DataRequestMonitor<Boolean> rm) {
|
||||
if (fGdb.getSessionType() == SessionType.CORE) {
|
||||
rm.setData(false);
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
if (context instanceof IContainerDMContext) {
|
||||
rm.setData(false);
|
||||
rm.done();
|
||||
|
|
|
@ -71,6 +71,11 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
|
|||
fGdb = getServicesTracker().getService(IGDBBackend.class);
|
||||
fProcService = getServicesTracker().getService(IMIProcesses.class);
|
||||
|
||||
if (fGdb.getSessionType() == SessionType.CORE) {
|
||||
// No execution for core files, so no support for reverse
|
||||
fReverseSupported = false;
|
||||
}
|
||||
|
||||
register(new String[]{IRunControl.class.getName(), MIRunControl.class.getName(),
|
||||
IReverseRunControl.class.getName()},
|
||||
new Hashtable<String,String>());
|
||||
|
@ -131,8 +136,34 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void canResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
|
||||
if (fGdb.getSessionType() == SessionType.CORE) {
|
||||
rm.setData(false);
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
super.canResume(context, rm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void canSuspend(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
|
||||
if (fGdb.getSessionType() == SessionType.CORE) {
|
||||
rm.setData(false);
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
super.canSuspend(context, rm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void canStep(final IExecutionDMContext context, StepType stepType, final DataRequestMonitor<Boolean> rm) {
|
||||
if (fGdb.getSessionType() == SessionType.CORE) {
|
||||
rm.setData(false);
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
if (context instanceof IContainerDMContext) {
|
||||
rm.setData(false);
|
||||
rm.done();
|
||||
|
@ -179,6 +210,15 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
|
|||
}
|
||||
|
||||
if (stepType == StepType.STEP_RETURN) {
|
||||
|
||||
// Check the stuff we know first, before going to the backend for
|
||||
// stack info
|
||||
if (!fReverseModeEnabled || !doCanResume(context)) {
|
||||
rm.setData(false);
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
// A step return will always be done in the top stack frame.
|
||||
// If the top stack frame is the only stack frame, it does not make sense
|
||||
// to do a step return since GDB will reject it.
|
||||
|
|
|
@ -229,7 +229,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
|||
|
||||
// Tell GDB to use this PTY
|
||||
queueCommand(
|
||||
new MIInferiorTTYSet((ICommandControlDMContext)fControlDmc, fPty.getSlaveName()),
|
||||
new MIInferiorTTYSet(fControlDmc, fPty.getSlaveName()),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
|
||||
@Override
|
||||
protected void handleFailure() {
|
||||
|
@ -248,7 +248,9 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
|||
|
||||
|
||||
public boolean canRestart() {
|
||||
if (fMIBackend.getIsAttachSession()) return false;
|
||||
if (fMIBackend.getIsAttachSession() || fMIBackend.getSessionType() == SessionType.CORE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Before GDB6.8, the Linux gdbserver would restart a new
|
||||
// process when getting a -exec-run but the communication
|
||||
|
|
|
@ -230,7 +230,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
|
|||
|
||||
// Tell GDB to use this PTY
|
||||
queueCommand(
|
||||
new MIInferiorTTYSet((ICommandControlDMContext)fControlDmc, fPty.getSlaveName()),
|
||||
new MIInferiorTTYSet(fControlDmc, fPty.getSlaveName()),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
|
||||
@Override
|
||||
protected void handleFailure() {
|
||||
|
@ -249,7 +249,9 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl {
|
|||
|
||||
|
||||
public boolean canRestart() {
|
||||
if (fMIBackend.getIsAttachSession()) return false;
|
||||
if (fMIBackend.getIsAttachSession()|| fMIBackend.getSessionType() == SessionType.CORE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Before GDB6.8, the Linux gdbserver would restart a new
|
||||
// process when getting a -exec-run but the communication
|
||||
|
|
|
@ -51,8 +51,9 @@ class GDBInferiorProcess extends MIInferiorProcess {
|
|||
// never (we don't kill an independent process.)
|
||||
// - For Program session:
|
||||
// if the inferior is still running.
|
||||
// - For PostMortem(Core): send event
|
||||
// else noop
|
||||
// - For PostMortem(Core):
|
||||
// no need to do anything since the inferior
|
||||
// is not running
|
||||
if (fBackend.getIsAttachSession() == false) {
|
||||
// Try to interrupt the inferior, first.
|
||||
if (getState() == State.RUNNING) {
|
||||
|
|
|
@ -18,6 +18,13 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
|||
*/
|
||||
public class MITargetSelect extends MICommand<MIInfo> {
|
||||
|
||||
/**
|
||||
* @since 2.0
|
||||
*/
|
||||
protected MITargetSelect(IDMContext ctx, String[] params) {
|
||||
super(ctx, "-target-select", null, params); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
|
@ -31,5 +38,4 @@ public class MITargetSelect extends MICommand<MIInfo> {
|
|||
public MITargetSelect(IDMContext ctx, String serialDevice, boolean extended) {
|
||||
super(ctx, "-target-select", new String[] { extended ? "extended-remote" : "remote", serialDevice}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/*******************************************************************************
|
||||
* 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 API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.mi.service.command.commands;
|
||||
|
||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||
|
||||
/**
|
||||
* This command sets up a connection with a core file.
|
||||
* @since 2.0
|
||||
*/
|
||||
public class MITargetSelectCore extends MITargetSelect {
|
||||
|
||||
public MITargetSelectCore(IDMContext ctx, String coreFilePath) {
|
||||
super(ctx, new String[] { "core", coreFilePath}); //$NON-NLS-1$
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue