mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 23:05:47 +02:00
[273833] Add a text box to specify the core file to the CDI Postmortem launch. This aligns both DSF-GDB and CDI-GDB Portmortem launches.
This commit is contained in:
parent
ec8730ff11
commit
da50919f62
6 changed files with 131 additions and 7 deletions
|
@ -89,7 +89,7 @@ CMainTab.Core_does_not_exist=Core file does not exist
|
||||||
CMainTab.Main=Main
|
CMainTab.Main=Main
|
||||||
CMainTab.&ProjectColon=&Project:
|
CMainTab.&ProjectColon=&Project:
|
||||||
CMainTab.C/C++_Application=C/C++ Application:
|
CMainTab.C/C++_Application=C/C++ Application:
|
||||||
CMainTab.CoreFile_path=Core file (leave blank to trigger prompt:)
|
CMainTab.CoreFile_path=Core file (leave blank to trigger prompt):
|
||||||
CMainTab.Search...=Searc&h Project...
|
CMainTab.Search...=Searc&h Project...
|
||||||
CMainTab.Choose_program_to_run=Choose a &program to run:
|
CMainTab.Choose_program_to_run=Choose a &program to run:
|
||||||
CMainTab.Choose_program_to_run_from_NAME=Choose a program to run from {0}:
|
CMainTab.Choose_program_to_run_from_NAME=Choose a program to run from {0}:
|
||||||
|
|
|
@ -159,7 +159,7 @@
|
||||||
id="org.eclipse.cdt.cdi.launch.postmortemLaunch.mainTab"
|
id="org.eclipse.cdt.cdi.launch.postmortemLaunch.mainTab"
|
||||||
group="org.eclipse.cdt.launch.postmortemLaunchTabGroup"
|
group="org.eclipse.cdt.launch.postmortemLaunchTabGroup"
|
||||||
name="%MainLaunchTab.name"
|
name="%MainLaunchTab.name"
|
||||||
class="org.eclipse.cdt.launch.ui.CMainAttachTab">
|
class="org.eclipse.cdt.launch.ui.CMainCoreTab">
|
||||||
<associatedDelegate delegate="org.eclipse.cdt.cdi.launch.coreFileCLaunch"/>
|
<associatedDelegate delegate="org.eclipse.cdt.cdi.launch.coreFileCLaunch"/>
|
||||||
</tab>
|
</tab>
|
||||||
<tab
|
<tab
|
||||||
|
|
|
@ -272,7 +272,7 @@ public class LocalCDILaunchDelegate extends AbstractCLaunchDelegate {
|
||||||
ILaunchConfigurationWorkingCopy wc = null;
|
ILaunchConfigurationWorkingCopy wc = null;
|
||||||
ICDebugConfiguration debugConfig = getDebugConfig( config );
|
ICDebugConfiguration debugConfig = getDebugConfig( config );
|
||||||
String path = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, (String)null );
|
String path = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, (String)null );
|
||||||
if ( path == null ) {
|
if ( path == null || path.length() == 0) {
|
||||||
ICProject project = verifyCProject( config );
|
ICProject project = verifyCProject( config );
|
||||||
IPath corefile = promptForCoreFilePath( (IProject)project.getResource(), debugConfig );
|
IPath corefile = promptForCoreFilePath( (IProject)project.getResource(), debugConfig );
|
||||||
if ( corefile == null ) {
|
if ( corefile == null ) {
|
||||||
|
@ -323,8 +323,6 @@ public class LocalCDILaunchDelegate extends AbstractCLaunchDelegate {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if ( wc != null )
|
|
||||||
wc.setAttribute( ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, (String)null );
|
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,9 +71,11 @@ CMainTab.Project_not_specified=Project not specified
|
||||||
CMainTab.Program_not_specified=Program not specified
|
CMainTab.Program_not_specified=Program not specified
|
||||||
CMainTab.Project_must_be_opened=Project must be opened
|
CMainTab.Project_must_be_opened=Project must be opened
|
||||||
CMainTab.Program_does_not_exist=Program does not exist
|
CMainTab.Program_does_not_exist=Program does not exist
|
||||||
|
CMainTab.Core_does_not_exist=Core file does not exist
|
||||||
CMainTab.Main=Main
|
CMainTab.Main=Main
|
||||||
CMainTab.&ProjectColon=&Project:
|
CMainTab.&ProjectColon=&Project:
|
||||||
CMainTab.C/C++_Application=C/C++ Application:
|
CMainTab.C/C++_Application=C/C++ Application:
|
||||||
|
CMainTab.CoreFile_path=Core file (leave blank to trigger prompt):
|
||||||
CMainTab.Search...=Searc&h Project...
|
CMainTab.Search...=Searc&h Project...
|
||||||
CMainTab.Choose_program_to_run=Choose a &program to run:
|
CMainTab.Choose_program_to_run=Choose a &program to run:
|
||||||
CMainTab.Choose_program_to_run_from_NAME=Choose a program to run from {0}:
|
CMainTab.Choose_program_to_run_from_NAME=Choose a program to run from {0}:
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.launch.ui;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 6.0
|
||||||
|
*/
|
||||||
|
public class CMainCoreTab extends CMainTab {
|
||||||
|
public CMainCoreTab() {
|
||||||
|
super(CMainTab.SPECIFY_CORE_FILE);
|
||||||
|
}
|
||||||
|
}
|
|
@ -99,6 +99,15 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
protected Label fProgLabel;
|
protected Label fProgLabel;
|
||||||
protected Text fProgText;
|
protected Text fProgText;
|
||||||
protected Button fSearchButton;
|
protected Button fSearchButton;
|
||||||
|
|
||||||
|
// Core file UI widgets
|
||||||
|
/** @since 6.0 */
|
||||||
|
protected Label fCoreLabel;
|
||||||
|
/** @since 6.0 */
|
||||||
|
protected Text fCoreText;
|
||||||
|
/** @since 6.0 */
|
||||||
|
protected Button fCoreButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
|
@ -108,6 +117,7 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
protected Button fTerminalButton;
|
protected Button fTerminalButton;
|
||||||
|
|
||||||
private final boolean dontCheckProgram;
|
private final boolean dontCheckProgram;
|
||||||
|
private final boolean fSpecifyCoreFile;
|
||||||
|
|
||||||
protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -115,6 +125,9 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
|
|
||||||
public static final int WANTS_TERMINAL = 1;
|
public static final int WANTS_TERMINAL = 1;
|
||||||
public static final int DONT_CHECK_PROGRAM = 2;
|
public static final int DONT_CHECK_PROGRAM = 2;
|
||||||
|
/** @since 6.0 */
|
||||||
|
public static final int SPECIFY_CORE_FILE = 4;
|
||||||
|
|
||||||
|
|
||||||
public CMainTab() {
|
public CMainTab() {
|
||||||
this(WANTS_TERMINAL);
|
this(WANTS_TERMINAL);
|
||||||
|
@ -127,6 +140,7 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
public CMainTab(int flags) {
|
public CMainTab(int flags) {
|
||||||
fWantsTerminalOption = (flags & WANTS_TERMINAL) != 0;
|
fWantsTerminalOption = (flags & WANTS_TERMINAL) != 0;
|
||||||
dontCheckProgram = (flags & DONT_CHECK_PROGRAM) != 0;
|
dontCheckProgram = (flags & DONT_CHECK_PROGRAM) != 0;
|
||||||
|
fSpecifyCoreFile = (flags & SPECIFY_CORE_FILE) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -148,6 +162,9 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
createBuildConfigCombo(comp, 1);
|
createBuildConfigCombo(comp, 1);
|
||||||
createExeFileGroup(comp, 1);
|
createExeFileGroup(comp, 1);
|
||||||
createVerticalSpacer(comp, 1);
|
createVerticalSpacer(comp, 1);
|
||||||
|
if (fSpecifyCoreFile) {
|
||||||
|
createCoreFileGroup(comp, 1);
|
||||||
|
}
|
||||||
if (wantsTerminalOption() /* && ProcessFactory.supportesTerminal() */) {
|
if (wantsTerminalOption() /* && ProcessFactory.supportesTerminal() */) {
|
||||||
createTerminalOption(comp, 1);
|
createTerminalOption(comp, 1);
|
||||||
}
|
}
|
||||||
|
@ -296,6 +313,45 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @since 6.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;
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean wantsTerminalOption() {
|
protected boolean wantsTerminalOption() {
|
||||||
return fWantsTerminalOption;
|
return fWantsTerminalOption;
|
||||||
}
|
}
|
||||||
|
@ -331,6 +387,7 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
filterPlatform = getPlatform(config);
|
filterPlatform = getPlatform(config);
|
||||||
updateProjectFromConfig(config);
|
updateProjectFromConfig(config);
|
||||||
updateProgramFromConfig(config);
|
updateProgramFromConfig(config);
|
||||||
|
updateCoreFromConfig(config);
|
||||||
updateTerminalFromConfig(config);
|
updateTerminalFromConfig(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,6 +426,19 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
fProgText.setText(programName);
|
fProgText.setText(programName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @since 6.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) {
|
||||||
|
LaunchUIPlugin.log(ce);
|
||||||
|
}
|
||||||
|
fCoreText.setText(coreName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -389,6 +459,9 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, fProjText.getText());
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, fProjText.getText());
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, (String)fBuildConfigCombo.getData(Integer.toString(fBuildConfigCombo.getSelectionIndex())));
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, (String)fBuildConfigCombo.getData(Integer.toString(fBuildConfigCombo.getSelectionIndex())));
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, fProgText.getText());
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, fProgText.getText());
|
||||||
|
if (fCoreText != null) {
|
||||||
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, fCoreText.getText());
|
||||||
|
}
|
||||||
if (fTerminalButton != null) {
|
if (fTerminalButton != null) {
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, fTerminalButton.getSelection());
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, fTerminalButton.getSelection());
|
||||||
}
|
}
|
||||||
|
@ -487,6 +560,17 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a dialog that lets the user select a file.
|
||||||
|
*
|
||||||
|
* @since 6.0
|
||||||
|
*/
|
||||||
|
protected String handleBrowseButtonSelected() {
|
||||||
|
FileDialog fileDialog = new FileDialog(getShell(), SWT.NONE);
|
||||||
|
fileDialog.setFileName(fProgText.getText());
|
||||||
|
return fileDialog.open();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate through and suck up all of the executable files that we can find.
|
* Iterate through and suck up all of the executable files that we can find.
|
||||||
*/
|
*/
|
||||||
|
@ -608,8 +692,7 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
setErrorMessage(null);
|
setErrorMessage(null);
|
||||||
setMessage(null);
|
setMessage(null);
|
||||||
|
|
||||||
if (dontCheckProgram)
|
if (!dontCheckProgram) {
|
||||||
return true;
|
|
||||||
|
|
||||||
String name = fProjText.getText().trim();
|
String name = fProjText.getText().trim();
|
||||||
if (name.length() == 0) {
|
if (name.length() == 0) {
|
||||||
|
@ -674,7 +757,25 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
setErrorMessage(e.getLocalizedMessage());
|
setErrorMessage(e.getLocalizedMessage());
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -726,6 +827,8 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
// plus getContext will use this to base context from if set.
|
// plus getContext will use this to base context from if set.
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, EMPTY_STRING);
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, EMPTY_STRING);
|
||||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, EMPTY_STRING);
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, EMPTY_STRING);
|
||||||
|
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, EMPTY_STRING);
|
||||||
|
|
||||||
ICElement cElement = null;
|
ICElement cElement = null;
|
||||||
cElement = getContext(config, getPlatform(config));
|
cElement = getContext(config, getPlatform(config));
|
||||||
if (cElement != null) {
|
if (cElement != null) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue