mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +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
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
protected IBinaryObject verifyBinary(ICProject proj, IPath exePath) 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;
|
Exception exception;
|
||||||
try {
|
try {
|
||||||
return (IBinaryObject)parser.getBinary(exePath);
|
return LaunchUtils.getBinary(proj.getProject(), exePath);
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
exception = e;
|
exception = e;
|
||||||
} catch (IOException e) {
|
|
||||||
exception = e;
|
|
||||||
}
|
}
|
||||||
Status status = new Status(IStatus.ERROR,getPluginID(),
|
Status status = new Status(IStatus.ERROR,getPluginID(),
|
||||||
ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_BINARY,
|
ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_BINARY,
|
||||||
|
|
|
@ -10,12 +10,22 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.launch;
|
package org.eclipse.cdt.launch;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||||
import org.eclipse.cdt.utils.CommandLineUtil;
|
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.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.variables.IStringVariableManager;
|
import org.eclipse.core.variables.IStringVariableManager;
|
||||||
import org.eclipse.core.variables.VariablesPlugin;
|
import org.eclipse.core.variables.VariablesPlugin;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
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.
|
* Utility methods.
|
||||||
|
@ -41,6 +51,51 @@ public class LaunchUtils {
|
||||||
return args;
|
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.
|
* 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.ICDebugConfiguration;
|
||||||
import org.eclipse.cdt.debug.core.ICDebugConstants;
|
import org.eclipse.cdt.debug.core.ICDebugConstants;
|
||||||
import org.eclipse.cdt.debug.ui.ICDebuggerPage;
|
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.AbstractCDebuggerTab;
|
||||||
import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
|
import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
|
||||||
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
|
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
|
||||||
|
@ -372,35 +373,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
if (programName != null ) {
|
if (programName != null ) {
|
||||||
IPath exePath = new Path(programName);
|
return LaunchUtils.getBinary(programName, projectName);
|
||||||
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;
|
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.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
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.LaunchImages;
|
||||||
import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
|
import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
|
||||||
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
|
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
|
||||||
|
@ -679,24 +680,10 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
protected boolean isBinary(IProject project, IPath exePath) 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 {
|
try {
|
||||||
IBinaryParser parser = (IBinaryParser)parserRef[i].createExtension();
|
IBinaryObject exe = LaunchUtils.getBinary(project, exePath);
|
||||||
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);
|
|
||||||
return exe != null;
|
return exe != null;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
} catch (IOException e) {
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue