1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

fail launch on unrecognized binary file

This commit is contained in:
David Inglis 2004-10-27 14:51:58 +00:00
parent 119a911081
commit 08412e5d6d
5 changed files with 15 additions and 6 deletions

View file

@ -407,7 +407,6 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
LaunchMessages.getFormattedString(
"AbstractCLaunchDelegate.PROGRAM_PATH_not_found", programPath.toOSString())), //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
}
return programPath;
}
@ -750,7 +749,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
* @return
* @throws CoreException
*/
protected IBinaryExecutable createBinary(ICProject project, IPath exePath) throws CoreException {
protected IBinaryExecutable verifyBinary(ICProject project, IPath exePath) throws CoreException {
ICExtensionReference[] parserRef = CCorePlugin.getDefault().getBinaryParserExtensions(project.getProject());
for (int i = 0; i < parserRef.length; i++) {
try {
@ -766,9 +765,17 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
IBinaryParser parser = CCorePlugin.getDefault().getDefaultBinaryParser();
try {
return (IBinaryExecutable)parser.getBinary(exePath);
} catch (ClassCastException e) {
} catch (IOException e) {
}
return null;
Throwable exception = new FileNotFoundException(LaunchMessages.getFormattedString(
"AbstractCLaunchDelegate.PROGRAM_PATH_not_binary", exePath.toOSString()));
int code = ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_BINARY;
MultiStatus status = new MultiStatus(getPluginID(), code, LaunchMessages
.getString("AbstractCLaunchDelegate.Program_is_not_a_recongnized_executable"), exception);
status.add(new Status(IStatus.ERROR, getPluginID(), code, exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$
exception));
throw new CoreException(status);
}
/**

View file

@ -52,7 +52,7 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
monitor.worked(1);
IPath exePath = verifyProgramPath(config);
ICProject project = verifyCProject(config);
IBinaryExecutable exeFile = createBinary(project, exePath);
IBinaryExecutable exeFile = verifyBinary(project, exePath);
ICDebugConfiguration debugConfig = getDebugConfig(config);
ICDISession dsession = null;

View file

@ -65,7 +65,7 @@ public class LocalAttachLaunchDelegate extends AbstractCLaunchDelegate {
monitor.worked(1);
IPath exePath = verifyProgramPath(config);
ICProject project = verifyCProject(config);
IBinaryExecutable exeFile = createBinary(project, exePath);
IBinaryExecutable exeFile = verifyBinary(project, exePath);
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
ICDebugConfiguration debugConfig = getDebugConfig(config);

View file

@ -55,7 +55,7 @@ public class LocalRunLaunchDelegate extends AbstractCLaunchDelegate {
monitor.worked(1);
IPath exePath = verifyProgramPath(config);
ICProject project = verifyCProject(config);
IBinaryExecutable exeFile = createBinary(project, exePath);
IBinaryExecutable exeFile = verifyBinary(project, exePath);
String arguments[] = getProgramArgumentsArray(config);
// set the default source locator if required

View file

@ -25,6 +25,8 @@ AbstractCLaunchDelegate.building=Building
AbstractCLaunchDelegate.searching_for_errors=Searching for compile errors
AbstractCLaunchDelegate.searching_for_errors_in=Searching for compile errors in
AbstractCLaunchDelegate.20=Building prerequisite project list
AbstractCLaunchDelegate.PROGRAM_PATH_not_binary=Program not Binary
AbstractCLaunchDelegate.Program_is_not_a_recongnized_executable=Program not a recognized executable.
LocalRunLaunchDelegate.Launching_Local_C_Application=Launching Local C/C++ Application
LocalRunLaunchDelegate.Failed_setting_runtime_option_though_debugger=Failed to set program arguments, environemt or working directory.