mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
Bug 202006.
This commit is contained in:
parent
915afcd931
commit
833f436400
4 changed files with 60 additions and 60 deletions
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue