Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Khodjaiants2005-06-15 17:58:08 +0000
committerMikhail Khodjaiants2005-06-15 17:58:08 +0000
commit0467fe740a2765d2f06fd54fae74de6e1e137521 (patch)
treef99c0b9ae4f28987145a4ac27910f7a0e83d4fcd /launch/org.eclipse.cdt.launch
parentd0824d23fdea280c513e0a5fc6a65e38240bd731 (diff)
downloadorg.eclipse.cdt-0467fe740a2765d2f06fd54fae74de6e1e137521.tar.gz
org.eclipse.cdt-0467fe740a2765d2f06fd54fae74de6e1e137521.tar.xz
org.eclipse.cdt-0467fe740a2765d2f06fd54fae74de6e1e137521.zip
Bug 87556: Post-mortem debug fails silently if core file is inaccessible. Applied patch from Joanne Woo (Monta Vista).
Diffstat (limited to 'launch/org.eclipse.cdt.launch')
-rw-r--r--launch/org.eclipse.cdt.launch/ChangeLog7
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java17
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/CoreFilePrompter.java17
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties6
4 files changed, 42 insertions, 5 deletions
diff --git a/launch/org.eclipse.cdt.launch/ChangeLog b/launch/org.eclipse.cdt.launch/ChangeLog
index e90556cb197..cc92a806292 100644
--- a/launch/org.eclipse.cdt.launch/ChangeLog
+++ b/launch/org.eclipse.cdt.launch/ChangeLog
@@ -1,3 +1,10 @@
+2005-05-15 Mikhail Khodjaiants
+ Bug 87556: Post-mortem debug fails silently if core file is inaccessible.
+ Applied patch from Joanne Woo (Monta Vista).
+ * CoreFilePrompter.java
+ * CoreFileLaunchDelegate.java
+ * LaunchMessages.properties
+
2005-05-18 David Inglis
Fixed bug 39581 & part of 46746
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java
index 0ab6e74ab9f..d8dc69bbd07 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java
@@ -4,10 +4,14 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
- * Contributors: QNX Software Systems - Initial API and implementation
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ * Monta Vista - Joanne Woo - Bug 87556
**************************************************************************************************/
package org.eclipse.cdt.launch.internal;
+import java.io.File;
+
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.debug.core.CDIDebugModel;
@@ -37,7 +41,6 @@ import org.eclipse.debug.core.model.IProcess;
public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
-
if (monitor == null) {
monitor = new NullProgressMonitor();
}
@@ -63,12 +66,22 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
cancel(LaunchMessages.getString("CoreFileLaunchDelegate.No_Corefile_selected"), //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_NO_COREFILE);
}
+ File file = new File(corefile.toString());
+ if (!file.exists() || !file.canRead()) {
+ cancel(LaunchMessages.getString("CoreFileLaunchDelegate.Corefile_not_readable"), //$NON-NLS-1$
+ ICDTLaunchConfigurationConstants.ERR_NO_COREFILE);
+ }
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, corefile.toString());
wc.launch(mode, new SubProgressMonitor(monitor, 9));
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, (String)null);
cancel("", -1); //$NON-NLS-1$
} else {
+ File file = new File(path);
+ if (!file.exists() || !file.canRead()) {
+ abort(LaunchMessages.getString("CoreFileLaunchDelegate.Corefile_not_readable"), null, //$NON-NLS-1$
+ ICDTLaunchConfigurationConstants.ERR_NO_COREFILE);
+ }
dsession = debugConfig.createDebugger().createDebuggerSession(launch, exeFile, new SubProgressMonitor(monitor, 8));
try {
// set the source locator
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/CoreFilePrompter.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/CoreFilePrompter.java
index c8d92a3e79b..275682c0bd2 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/CoreFilePrompter.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/CoreFilePrompter.java
@@ -3,10 +3,14 @@
* accompanying materials are made available under the terms of the Common Public License v1.0 which
* accompanies this distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html
*
- * Contributors: QNX Software Systems - initial API and implementation
+ * Contributors:
+ * QNX Software Systems - initial API and implementation
+ * Monta Vista - Joanne Woo - Bug 87556
**************************************************************************************************/
package org.eclipse.cdt.launch.internal.ui;
+import java.io.File;
+
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
import org.eclipse.core.resources.IProject;
@@ -18,6 +22,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.IStatusHandler;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.jface.dialogs.ErrorDialog;
public class CoreFilePrompter implements IStatusHandler {
@@ -52,9 +57,17 @@ public class CoreFilePrompter implements IStatusHandler {
dialog.setFilterPath(initPath);
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, LaunchUIPlugin.getUniqueIdentifier(),
+ ICDTLaunchConfigurationConstants.ERR_NO_COREFILE,
+ LaunchMessages.getString("CoreFileLaunchDelegate.Corefile_not_readable"), null)); //$NON-NLS-1$
+ }
return new Path(res);
}
return null;
}
-} \ No newline at end of file
+}
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties
index 2a7a35efd4f..8441dcfea33 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties
@@ -6,7 +6,8 @@
# http://www.eclipse.org/legal/cpl-v10.html
#
# Contributors:
-# QNX Software Systems - Initial API and implementation
+# QNX Software Systems - Initial API and implementation
+# Monta Vista - Joanne Woo - Bug 87556
#######################################################################
AbstractCLaunchDelegate.Debugger_not_installed=CDT Debugger not installed
@@ -43,6 +44,9 @@ CoreFileLaunchDelegate.Launching_postmortem_debugger=Launching postmortem debugg
CoreFileLaunchDelegate.No_Corefile_selected=No Corefile selected
CoreFileLaunchDelegate.No_Shell_available_in_Launch=No Shell available in Launch
CoreFileLaunchDelegate.Select_Corefile=Select Corefile
+CoreFileLaunchDelegate.Corefile_not_accessible=Core file is not accessible.
+CoreFileLaunchDelegate.Corefile_not_readable=Core file does not exist or is not readable.
+CoreFileLaunchDelegate.postmortem_debugging_failed=Post-mortem debugging failed
CApplicationLaunchShortcut.Application_Launcher=Application Launcher
CApplicationLaunchShortcut.ChooseConfigToDebug=Choose a debug configuration to debug

Back to the top