Skip to main content
summaryrefslogtreecommitdiffstats
path: root/launch
diff options
context:
space:
mode:
authorKen Ryall2009-04-08 18:43:46 -0400
committerKen Ryall2009-04-08 18:43:46 -0400
commit833f436400f758d2cb0dc3517c2b2c800400f18f (patch)
tree16fff127354ec907e8c6b7c64e8dcf73ef657547 /launch
parent915afcd931293ce60effcbabc738aa8dbe0376ad (diff)
downloadorg.eclipse.cdt-833f436400f758d2cb0dc3517c2b2c800400f18f.tar.gz
org.eclipse.cdt-833f436400f758d2cb0dc3517c2b2c800400f18f.tar.xz
org.eclipse.cdt-833f436400f758d2cb0dc3517c2b2c800400f18f.zip
Bug 202006.
Diffstat (limited to 'launch')
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java17
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java55
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java31
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java17
4 files changed, 60 insertions, 60 deletions
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
index 77f7d83e34..01caa800fb 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
@@ -800,26 +800,11 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
* @throws CoreException
*/
protected IBinaryObject verifyBinary(ICProject proj, IPath exePath) throws CoreException {
- ICExtensionReference[] parserRef = CCorePlugin.getDefault().getBinaryParserExtensions(proj.getProject());
- 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();
Exception exception;
try {
- return (IBinaryObject)parser.getBinary(exePath);
+ return LaunchUtils.getBinary(proj.getProject(), exePath);
} catch (ClassCastException e) {
exception = e;
- } catch (IOException e) {
- exception = e;
}
Status status = new Status(IStatus.ERROR,getPluginID(),
ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_BINARY,
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java
index 149aec8bb4..d616f693bc 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java
@@ -10,12 +10,22 @@
*******************************************************************************/
package org.eclipse.cdt.launch;
+import java.io.IOException;
+
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.utils.CommandLineUtil;
+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.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
+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;
/**
* Utility methods.
@@ -40,7 +50,52 @@ public class LaunchUtils {
}
return args;
}
+
+ public static IBinaryObject getBinary(IProject project, IPath exePath) throws CoreException {
+ 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;
+ }
+
+ public static IBinaryObject getBinary(String programName, String projectName)
+ throws CoreException
+ {
+ if (programName != null ) {
+ IPath exePath = new Path(programName);
+ IProject project = null;
+ if (projectName != null && !projectName.equals("")) { //$NON-NLS-1$
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (project == null || project.getLocation() == null)
+ {
+ return null;
+ }
+ if (!exePath.isAbsolute()) {
+ exePath = project.getLocation().append(exePath);
+ }
+ }
+ return getBinary(project, exePath);
+ }
+ return null;
+ }
+
/**
* Convenience method.
*/
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java
index 0357677ba6..74c823d9b3 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java
@@ -34,6 +34,7 @@ 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.LaunchUtils;
import org.eclipse.cdt.launch.internal.ui.AbstractCDebuggerTab;
import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
@@ -372,35 +373,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
} 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 LaunchUtils.getBinary(programName, projectName);
}
return null;
}
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
index 8e4c9dbb07..ad5b86a7f8 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
@@ -29,6 +29,7 @@ import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.launch.LaunchUtils;
import org.eclipse.cdt.launch.internal.ui.LaunchImages;
import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
@@ -679,24 +680,10 @@ public class CMainTab extends CLaunchConfigurationTab {
* @throws CoreException
*/
protected boolean isBinary(IProject project, IPath exePath) throws CoreException {
- 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 true;
- }
- } catch (ClassCastException e) {
- } catch (IOException e) {
- }
- }
- IBinaryParser parser = CCorePlugin.getDefault().getDefaultBinaryParser();
try {
- IBinaryObject exe = (IBinaryObject)parser.getBinary(exePath);
+ IBinaryObject exe = LaunchUtils.getBinary(project, exePath);
return exe != null;
} catch (ClassCastException e) {
- } catch (IOException e) {
}
return false;
}

Back to the top