1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 228265

Update GdbLaunchDelegate to no longer require anything from
org.eclipse.cdt.launch.

Also triggers a build when necessary before launching, as the CDT does.

Also introduces a LaunchMessages class which uses a resourceBundle for
launch messages that has been added as org.eclipse.dd.gdb.internal.provisional.launching.LaunchMessages
This commit is contained in:
Marc Khouzam 2008-04-25 15:20:13 +00:00
parent bf9f5fbabd
commit 41f3028662
4 changed files with 479 additions and 114 deletions

View file

@ -12,8 +12,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.debug.core, org.eclipse.debug.core,
org.eclipse.cdt.core, org.eclipse.cdt.core,
org.eclipse.cdt.debug.core, org.eclipse.cdt.debug.core,
org.eclipse.cdt.debug.mi.core, org.eclipse.cdt.debug.mi.core
org.eclipse.cdt.launch
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.dd.gdb.internal.provisional, Export-Package: org.eclipse.dd.gdb.internal.provisional,

View file

@ -1,31 +1,41 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2006 QNX Software Systems and others. * Copyright (c) 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
* Windriver and Ericsson - Updated for DSF
*******************************************************************************/ *******************************************************************************/
package org.eclipse.dd.gdb.internal.provisional.launching; package org.eclipse.dd.gdb.internal.provisional.launching;
import java.io.File; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
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;
import org.eclipse.cdt.core.model.ICModelMarker;
import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.launch.AbstractCLaunchDelegate; import org.eclipse.core.resources.IFile;
import org.eclipse.cdt.launch.internal.ui.LaunchMessages; import org.eclipse.core.resources.IMarker;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin; import org.eclipse.core.resources.IProject;
import org.eclipse.cdt.utils.pty.PTY; import org.eclipse.core.resources.IResource;
import org.eclipse.cdt.utils.spawner.ProcessFactory; 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.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.dd.dsf.concurrent.ThreadSafe; import org.eclipse.dd.dsf.concurrent.ThreadSafe;
import org.eclipse.dd.gdb.internal.GdbPlugin; import org.eclipse.dd.gdb.internal.GdbPlugin;
@ -40,22 +50,19 @@ import org.eclipse.debug.core.IStatusHandler;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate2; import org.eclipse.debug.core.model.ILaunchConfigurationDelegate2;
import org.eclipse.debug.core.model.IPersistableSourceLocator; import org.eclipse.debug.core.model.IPersistableSourceLocator;
import org.eclipse.debug.core.model.ISourceLocator; import org.eclipse.debug.core.model.ISourceLocator;
import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
import org.eclipse.debug.core.sourcelookup.IPersistableSourceLocator2; import org.eclipse.debug.core.sourcelookup.IPersistableSourceLocator2;
/** /**
* The launch configuration delegate for the CDI debugger session types. * The shared launch configuration delegate for the DSF/GDB debugger.
* This delegate supports all configuration types (local, remote, attach, etc)
*/ */
@ThreadSafe @ThreadSafe
public class GdbLaunchDelegate extends AbstractCLaunchDelegate public class GdbLaunchDelegate extends LaunchConfigurationDelegate
implements ILaunchConfigurationDelegate2 implements ILaunchConfigurationDelegate2
{ {
public final static String GDB_DEBUG_MODEL_ID = "org.eclipse.dd.gdb"; //$NON-NLS-1$ public final static String GDB_DEBUG_MODEL_ID = "org.eclipse.dd.gdb"; //$NON-NLS-1$
private SessionType fSessionType;
/* (non-Javadoc)
* @see org.eclipse.cdt.launch.AbstractCLaunchDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
public void launch( ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor ) throws CoreException { public void launch( ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor ) throws CoreException {
if ( monitor == null ) { if ( monitor == null ) {
monitor = new NullProgressMonitor(); monitor = new NullProgressMonitor();
@ -70,21 +77,9 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate
if ( monitor.isCanceled() ) { if ( monitor.isCanceled() ) {
return; return;
} }
try {
String debugMode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
fSessionType = SessionType.RUN;
} else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
fSessionType = SessionType.ATTACH;
} else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) {
fSessionType = SessionType.CORE;
} else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE)) {
fSessionType = SessionType.REMOTE;
} else {
fSessionType = SessionType.RUN;
}
launchDebugSession( config, launch, monitor ); try {
launchDebugSession( config, launch, monitor );
} }
finally { finally {
monitor.done(); monitor.done();
@ -95,9 +90,11 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate
if ( monitor.isCanceled() ) { if ( monitor.isCanceled() ) {
return; return;
} }
SessionType sessionType = getSessionType(config);
final GdbLaunch launch = (GdbLaunch)l; final GdbLaunch launch = (GdbLaunch)l;
if (fSessionType == SessionType.REMOTE) { if (sessionType == SessionType.REMOTE) {
monitor.subTask( "Debugging remote C/C++ application" ); //$NON-NLS-1$ monitor.subTask( "Debugging remote C/C++ application" ); //$NON-NLS-1$
} else { } else {
monitor.subTask( "Debugging local C/C++ application" ); //$NON-NLS-1$ monitor.subTask( "Debugging local C/C++ application" ); //$NON-NLS-1$
@ -114,7 +111,7 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate
// If we are attaching, get the process id now, so as to avoid starting the launch // If we are attaching, get the process id now, so as to avoid starting the launch
// and canceling it if the user does not put the pid properly. // and canceling it if the user does not put the pid properly.
int pid = -1; int pid = -1;
if (fSessionType == SessionType.ATTACH) { if (sessionType == SessionType.ATTACH) {
try { try {
// have we already been given the pid (maybe from a JUnit test launch or something) // have we already been given the pid (maybe from a JUnit test launch or something)
pid = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_ATTACH_PROCESS_ID, -1); pid = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_ATTACH_PROCESS_ID, -1);
@ -130,8 +127,6 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate
LaunchMessages.getString("LocalAttachLaunchDelegate.No_Process_ID_selected"))); //$NON-NLS-1$ LaunchMessages.getString("LocalAttachLaunchDelegate.No_Process_ID_selected"))); //$NON-NLS-1$
} }
} }
setDefaultSourceLocator(launch, config);
// Create and invoke the launch sequence to create the debug control and services // Create and invoke the launch sequence to create the debug control and services
final ServicesLaunchSequence servicesLaunchSequence = final ServicesLaunchSequence servicesLaunchSequence =
@ -156,10 +151,10 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate
// Create and invoke the final launch sequence to setup GDB // Create and invoke the final launch sequence to setup GDB
final FinalLaunchSequence finalLaunchSequence; final FinalLaunchSequence finalLaunchSequence;
if (fSessionType == SessionType.ATTACH) { if (sessionType == SessionType.ATTACH) {
finalLaunchSequence = new FinalLaunchSequence(launch.getSession().getExecutor(), launch, pid); finalLaunchSequence = new FinalLaunchSequence(launch.getSession().getExecutor(), launch, pid);
} else { } else {
finalLaunchSequence = new FinalLaunchSequence(launch.getSession().getExecutor(), launch, fSessionType); finalLaunchSequence = new FinalLaunchSequence(launch.getSession().getExecutor(), launch, sessionType);
} }
launch.getSession().getExecutor().execute(finalLaunchSequence); launch.getSession().getExecutor().execute(finalLaunchSequence);
try { try {
@ -171,6 +166,23 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate
} }
} }
private SessionType getSessionType(ILaunchConfiguration config) {
try {
String debugMode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
return SessionType.RUN;
} else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
return SessionType.ATTACH;
} else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) {
return SessionType.CORE;
} else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE)) {
return SessionType.REMOTE;
}
} catch (CoreException e) {
}
return SessionType.RUN;
}
// Copied from the CDT // Copied from the CDT
protected int promptForProcessID(ILaunchConfiguration config) throws CoreException { protected int promptForProcessID(ILaunchConfiguration config) throws CoreException {
IStatus fPromptStatus = new Status(IStatus.INFO, "org.eclipse.debug.ui", 200, "", null); //$NON-NLS-1$//$NON-NLS-2$ IStatus fPromptStatus = new Status(IStatus.INFO, "org.eclipse.debug.ui", 200, "", null); //$NON-NLS-1$//$NON-NLS-2$
@ -186,92 +198,17 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate
return -1; return -1;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.launch.AbstractCLaunchDelegate#getPluginID()
*/
@Override
protected String getPluginID() {
return LaunchUIPlugin.getUniqueIdentifier();
}
/**
* Performs a runtime exec on the given command line in the context of the
* specified working directory, and returns the resulting process. If the
* current runtime does not support the specification of a working
* directory, the status handler for error code
* <code>ERR_WORKING_DIRECTORY_NOT_SUPPORTED</code> is queried to see if
* the exec should be re-executed without specifying a working directory.
*
* @param cmdLine
* the command line
* @param workingDirectory
* the working directory, or <code>null</code>
* @return the resulting process or <code>null</code> if the exec is
* cancelled
* @see Runtime
*/
protected Process exec( String[] cmdLine, String[] environ, File workingDirectory, boolean usePty ) throws CoreException {
Process p = null;
try {
if ( workingDirectory == null ) {
p = ProcessFactory.getFactory().exec( cmdLine, environ );
}
else {
if ( usePty && PTY.isSupported() ) {
p = ProcessFactory.getFactory().exec( cmdLine, environ, workingDirectory, new PTY() );
}
else {
p = ProcessFactory.getFactory().exec( cmdLine, environ, workingDirectory );
}
}
}
catch( IOException e ) {
if ( p != null ) {
p.destroy();
}
abort( "Error starting process.", e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR ); //$NON-NLS-1$
}
catch( NoSuchMethodError e ) {
// attempting launches on 1.2.* - no ability to set working
// directory
IStatus status = new Status( IStatus.ERROR, LaunchUIPlugin.getUniqueIdentifier(), ICDTLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_NOT_SUPPORTED, LaunchMessages.getString( "LocalDsfLaunchDelegate.9" ), e ); //$NON-NLS-1$
IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler( status );
if ( handler != null ) {
Object result = handler.handleStatus( status, this );
if ( result instanceof Boolean && ((Boolean)result).booleanValue() ) {
p = exec( cmdLine, environ, null, usePty );
}
}
}
return p;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.launch.AbstractCLaunchDelegate#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.cdt.launch.AbstractCLaunchDelegate#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/ */
@Override @Override
public boolean preLaunchCheck( ILaunchConfiguration config, String mode, IProgressMonitor monitor ) throws CoreException { public boolean preLaunchCheck( ILaunchConfiguration config, String mode, IProgressMonitor monitor ) throws CoreException {
// no pre launch check for core file // no pre launch check for core file
if ( mode.equals( ILaunchManager.DEBUG_MODE ) ) { if (mode.equals(ILaunchManager.DEBUG_MODE) && getSessionType(config) == SessionType.CORE) return true;
if ( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE.equals( config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN ) ) )
return true;
}
return super.preLaunchCheck( config, mode, monitor ); return super.preLaunchCheck( config, mode, monitor );
} }
///////////////////////////////////////////////////////////////////////////
// ILaunchConfigurationDelegate2
@Override
public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
return false;
}
@Override
public boolean finalLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
return true;
}
@Override @Override
public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws CoreException { public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws CoreException {
// Need to configure the source locator before creating the launch // Need to configure the source locator before creating the launch
@ -303,4 +240,228 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate
} }
return null; return null;
} }
/**
* Throws a core exception with an error status object built from the given
* message, lower level exception, and error code.
*
* @param message
* the status message
* @param exception
* lower level exception associated with the error, or
* <code>null</code> if none
* @param code
* error code
*/
protected void abort(String message, Throwable exception, int code) throws CoreException {
MultiStatus status = new MultiStatus(GdbPlugin.PLUGIN_ID, code, message, exception);
status.add(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, code, exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$
exception));
throw new CoreException(status);
}
public static ICProject getCProject(ILaunchConfiguration configuration) throws CoreException {
String projectName = getProjectName(configuration);
if (projectName != null) {
projectName = projectName.trim();
if (projectName.length() > 0) {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
ICProject cProject = CCorePlugin.getDefault().getCoreModel().create(project);
if (cProject != null && cProject.exists()) {
return cProject;
}
}
}
return null;
}
public static String getProjectName(ILaunchConfiguration configuration) throws CoreException {
return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
}
public static String getProgramName(ILaunchConfiguration configuration) throws CoreException {
return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
}
public static IPath getProgramPath(ILaunchConfiguration configuration) throws CoreException {
String path = getProgramName(configuration);
if (path == null) {
return null;
}
return new Path(path);
}
protected ICProject verifyCProject(ILaunchConfiguration config) throws CoreException {
String name = getProjectName(config);
if (name == null) {
abort(LaunchMessages.getString("AbstractCLaunchDelegate.C_Project_not_specified"), null, //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROJECT);
}
ICProject cproject = getCProject(config);
if (cproject == null) {
IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
if (!proj.exists()) {
abort(
LaunchMessages.getFormattedString("AbstractCLaunchDelegate.Project_NAME_does_not_exist", name), null, //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
} else if (!proj.isOpen()) {
abort(LaunchMessages.getFormattedString("AbstractCLaunchDelegate.Project_NAME_is_closed", name), null, //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
}
abort(LaunchMessages.getString("AbstractCLaunchDelegate.Not_a_C_CPP_project"), null, //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
}
return cproject;
}
protected IPath verifyProgramPath(ILaunchConfiguration config) throws CoreException {
ICProject cproject = verifyCProject(config);
IPath programPath = getProgramPath(config);
if (programPath == null || programPath.isEmpty()) {
return null;
}
if (!programPath.isAbsolute()) {
IFile wsProgramPath = cproject.getProject().getFile(programPath);
programPath = wsProgramPath.getLocation();
}
if (!programPath.toFile().exists()) {
abort(
LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_does_not_exist"), //$NON-NLS-1$
new FileNotFoundException(
LaunchMessages.getFormattedString(
"AbstractCLaunchDelegate.PROGRAM_PATH_not_found", programPath.toOSString())), //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
}
return programPath;
}
/**
* @param project
* @param exePath
* @return
* @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();
try {
return (IBinaryObject)parser.getBinary(exePath);
} catch (ClassCastException e) {
} catch (IOException e) {
}
Throwable exception = new FileNotFoundException(LaunchMessages.getFormattedString(
"AbstractCLaunchDelegate.Program_is_not_a_recongnized_executable", exePath.toOSString())); //$NON-NLS-1$
int code = ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_BINARY;
MultiStatus status = new MultiStatus(GdbPlugin.PLUGIN_ID, code,
LaunchMessages.getString("AbstractCLaunchDelegate.Program_is_not_a_recongnized_executable"), exception); //$NON-NLS-1$
status.add(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, code, exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$
exception));
throw new CoreException(status);
}
/**
* Recursively creates a set of projects referenced by the current project
*
* @param proj
* The current project
* @param referencedProjSet
* A set of referenced projects
* @throws CoreException
* if an error occurs while getting referenced projects from the
* current project
*/
private HashSet<IProject> getReferencedProjectSet(IProject proj, HashSet<IProject> referencedProjSet) throws CoreException {
// The top project is a reference too and it must be added at the top to avoid cycles
referencedProjSet.add(proj);
IProject[] projects = proj.getReferencedProjects();
for (IProject refProject : projects) {
if (refProject.exists() && !referencedProjSet.contains(refProject)) {
getReferencedProjectSet(refProject, referencedProjSet);
}
}
return referencedProjSet;
}
/**
* Returns the order list of projects to build before launching.
* Used in buildForLaunch()
*/
@Override
protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
IProject[] orderedProjects = null;
ArrayList<IProject> orderedProjList = null;
ICProject cProject = getCProject(configuration);
if (cProject != null) {
HashSet<IProject> projectSet = getReferencedProjectSet(cProject.getProject(), new HashSet<IProject>());
String[] orderedNames = ResourcesPlugin.getWorkspace().getDescription().getBuildOrder();
if (orderedNames != null) {
//Projects may not be in the build order but should still be built if selected
ArrayList<IProject> unorderedProjects = new ArrayList<IProject>(projectSet.size());
unorderedProjects.addAll(projectSet);
orderedProjList = new ArrayList<IProject>(projectSet.size());
for (String projectName : orderedNames) {
for (IProject proj : unorderedProjects) {
if (proj.getName().equals(projectName)) {
orderedProjList.add(proj);
unorderedProjects.remove(proj);
break;
}
}
}
// Add any remaining projects to the end of the list
orderedProjList.addAll(unorderedProjects);
orderedProjects = orderedProjList.toArray(new IProject[orderedProjList.size()]);
} else {
// Try the project prerequisite order then
IProject[] projects = projectSet.toArray(new IProject[projectSet.size()]);
orderedProjects = ResourcesPlugin.getWorkspace().computeProjectOrder(projects).projects;
}
}
return orderedProjects;
}
/* Used in finalLaunchCheck() */
@Override
protected IProject[] getProjectsForProblemSearch(ILaunchConfiguration configuration, String mode) throws CoreException {
return getBuildOrder(configuration, mode);
}
/**
* Searches for compile errors in the specified project
* Used in finalLaunchCheck()
* @param proj
* The project to search
* @return true if compile errors exist, otherwise false
*/
@Override
protected boolean existsProblems(IProject proj) throws CoreException {
IMarker[] markers = proj.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
if (markers.length > 0) {
for (IMarker marker : markers) {
Integer severity = (Integer)marker.getAttribute(IMarker.SEVERITY);
if (severity != null) {
return severity.intValue() >= IMarker.SEVERITY_ERROR;
}
}
}
return false;
}
} }

View file

@ -0,0 +1,46 @@
/*******************************************************************************
* Copyright (c) 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - initial API and implementation
* Ericsson - Update for DSF
*******************************************************************************/
package org.eclipse.dd.gdb.internal.provisional.launching;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class LaunchMessages {
private static final String BUNDLE_NAME = "org.eclipse.dd.gdb.internal.provisional.launching.LaunchMessages";//$NON-NLS-1$
private static ResourceBundle RESOURCE_BUNDLE = null;
static {
try {
RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
}
catch (MissingResourceException x) {
}
}
private LaunchMessages() {}
public static String getFormattedString(String key, String arg) {
return MessageFormat.format(getString(key), (Object[])new String[]{arg});
}
public static String getFormattedString(String key, String[] args) {
return MessageFormat.format(getString(key), (Object[])args);
}
public static String getString(String key) {
if (RESOURCE_BUNDLE == null) return '!' + key + '!';
return RESOURCE_BUNDLE.getString(key);
}
}

View file

@ -0,0 +1,159 @@
###############################################################################
# Copyright (c) 2008 QNX Software Systems and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# QNX Software Systems - Initial API and implementation
# Monta Vista - Joanne Woo - Bug 87556
# Nokia - Ken Ryall - Bug 118894
###############################################################################
AbstractCLaunchDelegate.Debugger_not_installed=CDT Debugger not installed
AbstractCLaunchDelegate.C_Project_not_specified=C Project not specified
AbstractCLaunchDelegate.Not_a_C_CPP_project=Project is not a C/C++ project
AbstractCLaunchDelegate.Program_file_not_specified=Program file not specified
AbstractCLaunchDelegate.Program_file_does_not_exist=Program file does not exist
AbstractCLaunchDelegate.PROGRAM_PATH_not_found={0} not found
AbstractCLaunchDelegate.Working_directory_does_not_exist=Working directory does not exist
AbstractCLaunchDelegate.WORKINGDIRECTORY_PATH_not_found=The working directory {0} does not exist.
AbstractCLaunchDelegate.Project_NAME_does_not_exist=Project {0} does not exist
AbstractCLaunchDelegate.Project_NAME_is_closed=Project {0} is closed
AbstractCLaunchDelegate.Debugger_Process=Debugger Process
AbstractCLaunchDelegate.building_projects=Building prerequisite project list
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_is_not_a_recongnized_executable=Program is 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, environment or working directory.
LocalRunLaunchDelegate.Error_starting_process=Error starting process
LocalRunLaunchDelegate.Does_not_support_working_dir=Eclipse runtime does not support working directory
LocalAttachLaunchDelegate.Attaching_to_Local_C_Application=Attaching to Local C/C++ Application
LocalAttachLaunchDelegate.No_Process_ID_selected=No Process ID selected
LocalAttachLaunchDelegate.Select_Process=Select Process
LocalAttachLaunchDelegate.Platform_cannot_list_processes=Current platform does not support listing processes
LocalAttachLaunchDelegate.Select_Process_to_attach_debugger_to=Select a Process to attach debugger to:
LocalAttachLaunchDelegate.CDT_Launch_Error=CDT Launch Error
CoreFileLaunchDelegate.Launching_postmortem_debugger=Launching postmortem debugger
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
CApplicationLaunchShortcut.ChooseConfigToRun=Choose a configuration to run
CApplicationLaunchShortcut.CLocalApplication=C Local Application
CApplicationLaunchShortcut.ChooseLocalAppToDebug=Choose a local application to debug
CApplicationLaunchShortcut.ChooseLocalAppToRun=Choose a local application to run
CApplicationLaunchShortcut.Launch_failed_no_binaries=Launch failed no binaries
CApplicationLaunchShortcut.LaunchFailed=Launch failed
CApplicationLaunchShortcut.LaunchDebugConfigSelection=Launch Debug Configuration Selection
CApplicationLaunchShortcut.LaunchConfigSelection=Launch Configuration Selection
CApplicationLaunchShortcut.Invalid_launch_mode_1=Invalid launch mode
CApplicationLaunchShortcut.Invalid_launch_mode_2=Invalid launch mode.
CApplicationLaunchShortcut.Invalid_launch_mode_3=Invalid launch mode.
CApplicationLaunchShortcut.ChooseLaunchConfigToDebug=Choose a launch configuration to debug
CApplicationLaunchShortcut.ChooseLaunchConfigToRun=Choose a launch configuration to run
CApplicationLaunchShortcut.Launch_failed_no_project_selected=Launch failed no project selected
AbstractCDebuggerTab.No_debugger_available=No debugger available
AbstractCDebuggerTab.Debugger=Debugger
AbstractCDebuggerTab.ErrorLoadingDebuggerPage=Error Loading Debugger UI Component.
LaunchUIPlugin.Error=Error
CMainTab.Project_required=Project required
CMainTab.Enter_project_before_searching_for_program=Project must first be entered before searching for a program
CMainTab.Program_Selection=Program Selection
CMainTab.Enter_project_before_browsing_for_program=Project must first be entered before browsing for a program
CMainTab.Program_selection=Program selection
CMainTab.Selection_must_be_file=Selection must be a file
CMainTab.Selection_must_be_binary_file=Selection must be a binary file
CMainTab.Project_Selection=Project Selection
CMainTab.Choose_project_to_constrain_search_for_program=Choose a &project to constrain the search for a program
CMainTab.Project_not_specified=Project not specified
CMainTab.Program_not_specified=Program not specified
CMainTab.Project_must_be_opened=Project must be opened
CMainTab.Program_does_not_exist=Program does not exist
CMainTab.Main=Main
CMainTab.&ProjectColon=&Project:
CMainTab.C/C++_Application=C/C++ Application:
CMainTab.Search...=Searc&h Project...
CMainTab.Choose_program_to_run=Choose a &program to run:
CMainTab.Choose_program_to_run_from_NAME=Choose a program to run from {0}:
CMainTab.UseTerminal=Connect process input & output to a terminal.
CMainTab.Program_is_not_a_recongnized_executable=Program is not a recognized executable.
CDebuggerTab.Advanced_Options_Dialog_Title=Advanced Options
CDebuggerTab.Stop_at_main_on_startup=Stop on startup at:
CDebuggerTab.Automatically_track_values_of=Automatically track the values of
CDebuggerTab.Stop_on_startup_at_can_not_be_empty=The "Stop on startup at" field can not be empty.
CDebuggerTab.Debugger_Options=Debugger Options
CDebuggerTab.Mode_not_supported=Mode ''{0}'' is not supported by selected debugger
CDebuggerTab.Advanced=Advanced...
CDebuggerTab.Variables=Variables
CDebuggerTab.Registers=Registers
CDebuggerTab.No_debugger_available=No debugger available
CDebuggerTab.CPU_is_not_supported=The CPU is not supported by selected debugger.
CDebuggerTab.Platform_is_not_supported=The project platform is not supported by the selected debugger.
CoreFileDebuggerTab.No_debugger_available=No debugger available
CoreFileDebuggerTab.platform_is_not_supported=The project platform is not supported by the selected debugger.
CEnvironmentTab.Edit_Variable=Edit Variable
CEnvironmentTab.New_Variable=New Variable
CEnvironmentTab.NameColon=Name:
CEnvironmentTab.ValueColon=Value:
CEnvironmentTab.Name=Name
CEnvironmentTab.Value=Value
CEnvironmentTab.New...=New...
CEnvironmentTab.Import...=Import...
CEnvironmentTab.Edit...=Edit...
CEnvironmentTab.Remove=Remove
CEnvironmentTab.Environment=Environment
CEnvironmentTab.Existing_Environment_Variable=Existing Environment Variable
CEnvironmentTab.Environment_variable_NAME_exists=Environment variable \" {0} \" exists.\nDo you want to overwrite?
CArgumentsTab.C/C++_Program_Arguments=Program arguments:
CArgumentsTab.Arguments=Arguments
CArgumentsTab.Variables=Variables...
WorkingDirectoryBlock.4=Select a &workspace relative working directory:
WorkingDirectoryBlock.7=Select a working directory for the launch configuration:
WorkingDirectoryBlock.0=W&orkspace...
WorkingDirectoryBlock.Working_Directory_8=Working Directory
WorkingDirectoryBlock.Working_directory=Working directory:
WorkingDirectoryBlock.10=Working directory does not exist
WorkingDirectoryBlock.Use_default=Use de&fault
WorkingDirectoryBlock.17=Variabl&es...
WorkingDirectoryBlock.1=File S&ystem...
WorkingDirectoryBlock.Exception_occurred_reading_configuration___15=Exception occurred reading configuration:
Launch.common.Exception_occurred_reading_configuration_EXCEPTION=Exception occurred reading configuration {0}
Launch.common.DebuggerColon=Debugger:
Launch.common.BinariesColon=Binaries:
Launch.common.QualifierColon=Qualifier:
Launch.common.Browse_1=&Browse...
Launch.common.Browse_2=B&rowse...
Launch.common.Project_does_not_exist=Project does not exist
LocalCDILaunchDelegate.0=Launching Local C/C++ Application
LocalCDILaunchDelegate.1=Launching debugger session
LocalCDILaunchDelegate.2=Debugging local C/C++ application
LocalCDILaunchDelegate.3=Attaching to Local C/C++ Application
LocalCDILaunchDelegate.4=No Process ID selected.
LocalCDILaunchDelegate.5=Launching postmortem debugger session
LocalCDILaunchDelegate.6=No core file selected
LocalCDILaunchDelegate.7=Core file does not exist or is not readable.
LocalCDILaunchDelegate.8=Error starting process.
LocalCDILaunchDelegate.9=Eclipse runtime does not support working directory.
LocalCDILaunchDelegate.10=Failed to set program arguments, environment or working directory.