Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 310304 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/cdt/debug/core/CDebugUtils.java (-1 / +128 lines)
Lines 12-21 Link Here
12
package org.eclipse.cdt.debug.core;
12
package org.eclipse.cdt.debug.core;
13
13
14
import java.io.ByteArrayOutputStream;
14
import java.io.ByteArrayOutputStream;
15
import java.io.FileNotFoundException;
15
import java.io.IOException;
16
import java.io.IOException;
16
import java.nio.charset.Charset;
17
import java.nio.charset.Charset;
17
import java.nio.charset.CharsetDecoder;
18
import java.nio.charset.CharsetDecoder;
18
import com.ibm.icu.text.MessageFormat;
19
import java.util.ArrayList;
19
import java.util.ArrayList;
20
import java.util.Arrays;
20
import java.util.Arrays;
21
import java.util.Iterator;
21
import java.util.Iterator;
Lines 40-45 Link Here
40
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
40
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
41
import org.eclipse.cdt.debug.core.model.ICWatchpoint2;
41
import org.eclipse.cdt.debug.core.model.ICWatchpoint2;
42
import org.eclipse.cdt.debug.internal.core.model.CFloatingPointValue;
42
import org.eclipse.cdt.debug.internal.core.model.CFloatingPointValue;
43
import org.eclipse.core.resources.IFile;
43
import org.eclipse.core.resources.IMarker;
44
import org.eclipse.core.resources.IMarker;
44
import org.eclipse.core.resources.IProject;
45
import org.eclipse.core.resources.IProject;
45
import org.eclipse.core.resources.ResourcesPlugin;
46
import org.eclipse.core.resources.ResourcesPlugin;
Lines 47-58 Link Here
47
import org.eclipse.core.runtime.IPath;
48
import org.eclipse.core.runtime.IPath;
48
import org.eclipse.core.runtime.IStatus;
49
import org.eclipse.core.runtime.IStatus;
49
import org.eclipse.core.runtime.Path;
50
import org.eclipse.core.runtime.Path;
51
import org.eclipse.core.runtime.Status;
50
import org.eclipse.debug.core.DebugPlugin;
52
import org.eclipse.debug.core.DebugPlugin;
51
import org.eclipse.debug.core.ILaunchConfiguration;
53
import org.eclipse.debug.core.ILaunchConfiguration;
52
import org.eclipse.debug.core.IStatusHandler;
54
import org.eclipse.debug.core.IStatusHandler;
53
import org.eclipse.debug.core.model.IBreakpoint;
55
import org.eclipse.debug.core.model.IBreakpoint;
54
import org.w3c.dom.Document;
56
import org.w3c.dom.Document;
55
57
58
import com.ibm.icu.text.MessageFormat;
59
56
/**
60
/**
57
 * Utility methods.
61
 * Utility methods.
58
 */
62
 */
Lines 561-564 Link Here
561
        }
565
        }
562
        return new Path(path);
566
        return new Path(path);
563
    }
567
    }
568
569
	/**
570
	 * Returns the ICProject associated with the project setting in the Main tab
571
	 * of a CDT launch configuration, or throws a CoreException providing a
572
	 * reason (e.g., the setting is empty, the project no longer exists, the
573
	 * isn't a CDT one, etc).
574
	 * 
575
	 * @param config
576
	 *            the launch configuration
577
	 * @return an ICProject; never null.
578
	 * @throws CoreException
579
	 * @since 7.0
580
	 */
581
	public static ICProject verifyCProject(ILaunchConfiguration config) throws CoreException {
582
		String name = CDebugUtils.getProjectName(config);
583
		if (name == null) {
584
			throwCoreException(DebugCoreMessages.getString("CDebugUtils.C_Project_not_specified"),  //$NON-NLS-1$
585
					ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROJECT);
586
		}
587
		ICProject cproject = CDebugUtils.getCProject(config);
588
		if (cproject == null) {
589
			IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
590
			if (!proj.exists()) {
591
				throwCoreException(DebugCoreMessages.getFormattedString("CDebugUtils.Project_NAME_does_not_exist", name),  //$NON-NLS-1$
592
						ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
593
			} else if (!proj.isOpen()) {
594
				throwCoreException(DebugCoreMessages.getFormattedString("CDebugUtils.Project_NAME_is_closed", name), //$NON-NLS-1$
595
						ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
596
			}
597
			throwCoreException(DebugCoreMessages.getString("CDebugUtils.Not_a_C_CPP_project"),  //$NON-NLS-1$
598
					ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
599
		}
600
		return cproject;
601
	}
602
603
	/**
604
	 * Returns an IPath for the file referenced in the <i>C/C++ Application</i>
605
	 * setting of a CDT launch configuration. Typically, the file is obtained by
606
	 * combining the <i>C/C++ Application</i> setting with the <i>Project</i>
607
	 * setting. If unable to combine and resolve these settings to a valid file,
608
	 * a CoreException is thrown that provides the reason why. There are many
609
	 * such possible reasons (a problem with the <i>Project</i> setting, an
610
	 * empty <i>C/C++ Application</i> setting, the combined settings doesn't
611
	 * resolve to an existing file, etc).
612
	 * 
613
	 * @param config
614
	 *            the launch configuration
615
	 * @param ignoreProjectSetting
616
	 *            if true, resolve the file using only the <i>C/C++
617
	 *            Application</i> setting. Do not take the <i>Project</i>
618
	 *            setting into account.
619
	 * @return an IPath; never null
620
	 * @throws CoreException
621
	 * @since 7.0
622
	 */
623
	public static IPath verifyProgramPath(ILaunchConfiguration config, boolean ignoreProjectSetting) throws CoreException {
624
		ICProject cproject = null;
625
		if (!ignoreProjectSetting) {
626
			cproject = verifyCProject(config);	// will throw exception if project setting not valid
627
		}
628
		IPath programPath = CDebugUtils.getProgramPath(config);
629
		if (programPath == null || programPath.isEmpty()) {
630
			throwCoreException(DebugCoreMessages.getString("CDebugUtils.Program_file_not_specified"), //$NON-NLS-1$
631
					ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROGRAM);
632
		}
633
		
634
		if (programPath != null) {	// this check is here only to avoid warning; compiler can't tell we'll throw an exception above
635
			if (!programPath.isAbsolute() && (cproject != null)) {
636
				// See if we can brute-force append the program path to the
637
				// project location. This allows us to support the program file
638
				// being outside the project, even outside the workspace, without
639
				// requiring a linked resource (e.g., the setting could be 
640
				// "..\..\some\dir\myprogram.exe")
641
				IPath location = cproject.getProject().getLocation();
642
				if (location != null) {
643
					programPath = location.append(programPath);
644
					if (!programPath.toFile().exists()) {
645
						// Try looking in the project for the file. This
646
						// supports linked resources.
647
						IFile projFile = null;
648
						try {
649
							projFile = cproject.getProject().getFile(CDebugUtils.getProgramPath(config));
650
						}
651
						catch (IllegalArgumentException exc) {
652
							// thrown if relative path that resolves to a root file (e.g., "..\somefile")							
653
						}	
654
						if (projFile != null && projFile.exists()) {
655
							programPath = projFile.getLocation();
656
						}
657
					}
658
				}
659
			}
660
			if (!programPath.toFile().exists()) {
661
				throwCoreException(
662
						DebugCoreMessages.getString("CDebugUtils.Program_file_does_not_exist"), //$NON-NLS-1$
663
						new FileNotFoundException(
664
								DebugCoreMessages.getFormattedString("CDebugUtils.PROGRAM_PATH_not_found", programPath.toOSString())), //$NON-NLS-1$
665
						ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
666
			}
667
		}
668
		return programPath;
669
	}
670
671
	/**
672
	 * Variant that expects (requires) the launch configuration to have a valid
673
	 * <i>Project</i> setting. See
674
	 * {@link #verifyProgramPath(ILaunchConfiguration, boolean)}
675
	 * 
676
	 * @since 7.0
677
	 */
678
	public static IPath verifyProgramPath(ILaunchConfiguration config) throws CoreException {
679
		return verifyProgramPath(config, false); 
680
	}
681
	
682
	/** Throws a CoreException. Clutter-reducing utility method. */
683
	private static void throwCoreException(String msg, int code) throws CoreException {
684
		throwCoreException(msg, null, code);
685
	}
686
687
	/** Throws a CoreException. Clutter-reducing utility method. */
688
	private static void throwCoreException(String msg, Exception innerException, int code) throws CoreException {
689
		throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), code, msg, innerException));
690
	}
564
}
691
}
(-)src/org/eclipse/cdt/debug/core/DebugCoreMessages.java (+10 lines)
Lines 13-18 Link Here
13
import java.util.MissingResourceException;
13
import java.util.MissingResourceException;
14
import java.util.ResourceBundle;
14
import java.util.ResourceBundle;
15
15
16
import com.ibm.icu.text.MessageFormat;
17
16
public class DebugCoreMessages {
18
public class DebugCoreMessages {
17
19
18
	private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.core.DebugCoreMessages";//$NON-NLS-1$
20
	private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.core.DebugCoreMessages";//$NON-NLS-1$
Lines 22-27 Link Here
22
	private DebugCoreMessages() {
24
	private DebugCoreMessages() {
23
	}
25
	}
24
26
27
	static String getFormattedString(String key, String arg) {
28
		return MessageFormat.format(getString(key), new String[]{arg});
29
	}
30
31
	static String getFormattedString(String key, String[] args) {
32
		return MessageFormat.format(getString(key), args);
33
	}
34
25
	public static String getString( String key ) {
35
	public static String getString( String key ) {
26
		try {
36
		try {
27
			return RESOURCE_BUNDLE.getString( key );
37
			return RESOURCE_BUNDLE.getString( key );
(-)src/org/eclipse/cdt/debug/core/DebugCoreMessages.properties (+8 lines)
Lines 23-26 Link Here
23
CDebugUtils.Hardware=Hardware
23
CDebugUtils.Hardware=Hardware
24
CDebugUtils.Temporary=Temporary
24
CDebugUtils.Temporary=Temporary
25
CDebugUtils.Software=Software
25
CDebugUtils.Software=Software
26
CDebugUtils.C_Project_not_specified=A project was not specified in the launch configuration.
27
CDebugUtils.Not_a_C_CPP_project=The project specified in the launch configuration is not a C/C++ one.
28
CDebugUtils.PROGRAM_PATH_not_found={0} not found
29
CDebugUtils.Program_file_does_not_exist=The program file specified in the launch configuration does not exist
30
CDebugUtils.Program_file_not_specified=A program file was not specified in the launch configuration.
31
CDebugUtils.Project_NAME_does_not_exist=Project {0} does not exist. Please check that your launch configuration specifies a valid project in your workspace.
32
CDebugUtils.Project_NAME_is_closed=Project {0} is closed
33
26
CDIDebugModel.0=Unable to parser binary information from file
34
CDIDebugModel.0=Unable to parser binary information from file
(-)src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFFinalLaunchSequence.java (-72 / +131 lines)
Lines 27-32 Link Here
27
import java.util.List;
27
import java.util.List;
28
import java.util.Properties;
28
import java.util.Properties;
29
29
30
import org.eclipse.cdt.debug.core.CDebugUtils;
30
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContribution;
31
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContribution;
31
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContributionFactory;
32
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContributionFactory;
32
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice;
33
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice;
Lines 350-356 Link Here
350
            // Below steps are specific to JTag hardware debugging
351
            // Below steps are specific to JTag hardware debugging
351
            
352
            
352
        /*
353
        /*
353
         * Retrieve the JTag device
354
         * Retrieve the IGDBJtagDevice instance
354
         */
355
         */
355
        new Step() {
356
        new Step() {
356
			@Override
357
			@Override
Lines 370-375 Link Here
370
				rm.done();
371
				rm.done();
371
            }},
372
            }},
372
        /*
373
        /*
374
         * Execute symbol loading
375
         */
376
        new Step() {
377
			@Override
378
			public void execute(RequestMonitor rm) {
379
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
380
				try {
381
					if (config.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS)) {
382
						String symbolsFileName = null;
383
384
						// New setting in Helios. Default is true. Check for existence
385
						// in order to support older launch configs
386
						if (config.hasAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS) &&
387
								config.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_SYMBOLS)) {
388
							IPath programFile = CDebugUtils.verifyProgramPath(config);
389
							if (programFile != null) {
390
								symbolsFileName = programFile.toOSString();
391
							}
392
						}
393
						else {
394
							symbolsFileName = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, IGDBJtagConstants.DEFAULT_SYMBOLS_FILE_NAME);
395
							if (symbolsFileName.length() > 0) {
396
								symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName);
397
							} else {
398
								symbolsFileName = null;
399
							}
400
						}
401
						
402
						if (symbolsFileName == null) {
403
		        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, Messages.getString("GDBJtagDebugger.err_no_img_file"), null)); //$NON-NLS-1$
404
		        			rm.done();
405
		        			return;
406
						}
407
408
						// Escape windows path separator characters TWICE, once for Java and once for GDB.						
409
						symbolsFileName = symbolsFileName.replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
410
411
						String symbolsOffset = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, IGDBJtagConstants.DEFAULT_SYMBOLS_OFFSET);
412
						if (symbolsOffset.length() > 0) {
413
							symbolsOffset = "0x" + symbolsOffset;					
414
						}
415
						List<String> commands = new ArrayList<String>();
416
						fGdbJtagDevice.doLoadSymbol(symbolsFileName, symbolsOffset, commands);
417
						queueCommands(commands, rm);									
418
						
419
					} else {
420
						rm.done();
421
					}
422
				} catch (CoreException e) {
423
        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot load symbol", e)); //$NON-NLS-1$
424
        			rm.done();
425
				}
426
			}},
427
428
        /*
373
         * Hook up to remote target
429
         * Hook up to remote target
374
         */
430
         */
375
        new Step() {
431
        new Step() {
Lines 410-416 Link Here
410
			public void execute(RequestMonitor rm) {
466
			public void execute(RequestMonitor rm) {
411
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
467
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
412
				try {
468
				try {
413
					if (config.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, true)) {
469
					if (config.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET)) {
414
						List<String> commands = new ArrayList<String>();
470
						List<String> commands = new ArrayList<String>();
415
						fGdbJtagDevice.doReset(commands);
471
						fGdbJtagDevice.doReset(commands);
416
						queueCommands(commands, rm);
472
						queueCommands(commands, rm);
Lines 447-453 Link Here
447
			public void execute(RequestMonitor rm) {
503
			public void execute(RequestMonitor rm) {
448
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
504
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
449
				try {
505
				try {
450
					if (config.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, true)) {
506
					if (config.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, IGDBJtagConstants.DEFAULT_DO_HALT)) {
451
						List<String> commands = new ArrayList<String>();
507
						List<String> commands = new ArrayList<String>();
452
						fGdbJtagDevice.doHalt(commands);
508
						fGdbJtagDevice.doHalt(commands);
453
						queueCommands(commands, rm);								
509
						queueCommands(commands, rm);								
Lines 467-482 Link Here
467
			public void execute(RequestMonitor rm) {
523
			public void execute(RequestMonitor rm) {
468
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
524
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
469
				try {
525
				try {
470
					String userCmd = config.getAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, ""); //$NON-NLS-1$
526
					String userCmd = config.getAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, IGDBJtagConstants.DEFAULT_INIT_COMMANDS);
471
					userCmd = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(userCmd);
527
					userCmd = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(userCmd);
472
					String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
528
					if (userCmd.length() > 0) {
473
					
529
						String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
474
					CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
530
						
475
					crm.setDoneCount(commands.length);
531
						CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
476
					for (int i = 0; i < commands.length; ++i) {
532
						crm.setDoneCount(commands.length);
477
						fCommandControl.queueCommand(
533
						for (int i = 0; i < commands.length; ++i) {
478
						    new CLICommand<MIInfo>(fCommandControl.getContext(), commands[i]),
534
							fCommandControl.queueCommand(
479
						    new DataRequestMonitor<MIInfo>(getExecutor(), crm));
535
							    new CLICommand<MIInfo>(fCommandControl.getContext(), commands[i]),
536
							    new DataRequestMonitor<MIInfo>(getExecutor(), crm));
537
						}
538
					}
539
					else {
540
						rm.done();
480
					}
541
					}
481
				} catch (CoreException e) {
542
				} catch (CoreException e) {
482
        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot run user defined init commands", e)); //$NON-NLS-1$
543
        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot run user defined init commands", e)); //$NON-NLS-1$
Lines 491-510 Link Here
491
			public void execute(RequestMonitor rm) {
552
			public void execute(RequestMonitor rm) {
492
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
553
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
493
				try {
554
				try {
555
					String imageFileName = null;
494
					if (config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE)) {
556
					if (config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE)) {
495
						// Escape windows path separator characters TWICE, once for Java and once for GDB.
557
						// New setting in Helios. Default is true. Check for existence
496
						String imageFileName = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, ""); //$NON-NLS-1$
558
						// in order to support older launch configs
497
						if (imageFileName.length() > 0) {
559
						if (config.hasAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE) &&
498
							imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName).replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
560
								config.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_IMAGE)) {
499
							String imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
561
							IPath programFile = CDebugUtils.verifyProgramPath(config);
500
							List<String> commands = new ArrayList<String>();
562
							if (programFile != null) {
501
							fGdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
563
								imageFileName = programFile.toOSString();
502
							queueCommands(commands, rm);									
564
							}
503
						} else {
504
							rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Image name cannot be empty", null)); //$NON-NLS-1$
505
							rm.done();
506
						}
565
						}
507
					} else {
566
						else {
567
							imageFileName = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, IGDBJtagConstants.DEFAULT_IMAGE_FILE_NAME); //$NON-NLS-1$
568
							if (imageFileName.length() > 0) {
569
								imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName);
570
							} else {
571
								imageFileName = null;
572
							}
573
						}
574
						
575
						if (imageFileName == null) {
576
		        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, Messages.getString("GDBJtagDebugger.err_no_img_file"), null)); //$NON-NLS-1$
577
		        			rm.done();
578
		        			return;
579
						}
580
581
						// Escape windows path separator characters TWICE, once for Java and once for GDB.						
582
						imageFileName = imageFileName.replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
583
584
						String imageOffset = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET);
585
						if (imageOffset.length() > 0) {
586
							imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET); //$NON-NLS-2$ //$NON-NLS-4$					
587
						}
588
						List<String> commands = new ArrayList<String>();
589
						fGdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
590
						queueCommands(commands, rm);									
591
					} 
592
					else {
508
						rm.done();
593
						rm.done();
509
					}
594
					}
510
				} catch (CoreException e) {
595
				} catch (CoreException e) {
Lines 512-547 Link Here
512
        			rm.done();
597
        			rm.done();
513
				}
598
				}
514
			}},
599
			}},
515
        /*
516
         * Execute symbol loading
517
         */
518
        new Step() {
519
			@Override
520
			public void execute(RequestMonitor rm) {
521
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
522
				try {
523
					if (config.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS)) {
524
						// Escape windows path separator characters TWICE, once for Java and once for GDB.
525
						String symbolsFileName = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, ""); //$NON-NLS-1$
526
						if (symbolsFileName.length() > 0) {
527
							symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName).replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
528
							String symbolsOffset = "0x" + config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, ""); //$NON-NLS-1$ //$NON-NLS-2$
529
							List<String> commands = new ArrayList<String>();
530
							fGdbJtagDevice.doLoadSymbol(symbolsFileName, symbolsOffset, commands);
531
							queueCommands(commands, rm);									
532
						} else {
533
							rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Symbol name cannot be empty", null)); //$NON-NLS-1$
534
							rm.done();
535
						}
536
					} else {
537
						rm.done();
538
					}
539
				} catch (CoreException e) {
540
        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot load symbol", e)); //$NON-NLS-1$
541
        			rm.done();
542
				}
543
			}
544
        },
545
        /* 
600
        /* 
546
         * Start tracking the breakpoints once we know we are connected to the target (necessary for remote debugging) 
601
         * Start tracking the breakpoints once we know we are connected to the target (necessary for remote debugging) 
547
         */
602
         */
Lines 566-572 Link Here
566
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
621
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
567
				try {
622
				try {
568
					if (config.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER)) {
623
					if (config.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER)) {
569
						String pcRegister = config.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, "")); //$NON-NLS-1$
624
						String pcRegister = config.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_PC_REGISTER)); //$NON-NLS-1$
570
						List<String> commands = new ArrayList<String>();
625
						List<String> commands = new ArrayList<String>();
571
						fGdbJtagDevice.doSetPC(pcRegister, commands);
626
						fGdbJtagDevice.doSetPC(pcRegister, commands);
572
						queueCommands(commands, rm);								
627
						queueCommands(commands, rm);								
Lines 587-593 Link Here
587
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
642
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
588
				try {
643
				try {
589
					if (config.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT)) {
644
					if (config.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT)) {
590
						String stopAt = config.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, ""); //$NON-NLS-1$
645
						String stopAt = config.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, IGDBJtagConstants.DEFAULT_STOP_AT); //$NON-NLS-1$
591
						List<String> commands = new ArrayList<String>();
646
						List<String> commands = new ArrayList<String>();
592
						fGdbJtagDevice.doStopAt(stopAt, commands);
647
						fGdbJtagDevice.doStopAt(stopAt, commands);
593
						queueCommands(commands, rm);								
648
						queueCommands(commands, rm);								
Lines 628-643 Link Here
628
			public void execute(RequestMonitor rm) {
683
			public void execute(RequestMonitor rm) {
629
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
684
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
630
				try {
685
				try {
631
					String userCmd = config.getAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, ""); //$NON-NLS-1$
686
					String userCmd = config.getAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, IGDBJtagConstants.DEFAULT_RUN_COMMANDS); //$NON-NLS-1$
632
					userCmd = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(userCmd);
687
					if (userCmd.length() > 0) {
633
					String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
688
						userCmd = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(userCmd);
634
					
689
						String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
635
					CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
690
						
636
					crm.setDoneCount(commands.length);
691
						CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
637
					for (int i = 0; i < commands.length; ++i) {
692
						crm.setDoneCount(commands.length);
638
						fCommandControl.queueCommand(
693
						for (int i = 0; i < commands.length; ++i) {
639
						    new CLICommand<MIInfo>(fCommandControl.getContext(), commands[i]),
694
							fCommandControl.queueCommand(
640
						    new DataRequestMonitor<MIInfo>(getExecutor(), crm));
695
							    new CLICommand<MIInfo>(fCommandControl.getContext(), commands[i]),
696
							    new DataRequestMonitor<MIInfo>(getExecutor(), crm));
697
						}
698
					}
699
					else {
700
						rm.done();
641
					}
701
					}
642
				} catch (CoreException e) {
702
				} catch (CoreException e) {
643
        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot run user defined run commands", e)); //$NON-NLS-1$
703
        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot run user defined run commands", e)); //$NON-NLS-1$
Lines 703-714 Link Here
703
	private IGDBJtagDevice getGDBJtagDevice (ILaunchConfiguration config) 
763
	private IGDBJtagDevice getGDBJtagDevice (ILaunchConfiguration config) 
704
	throws CoreException, NullPointerException {
764
	throws CoreException, NullPointerException {
705
		IGDBJtagDevice gdbJtagDevice = null;
765
		IGDBJtagDevice gdbJtagDevice = null;
706
		String jtagDeviceName = config.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, ""); //$NON-NLS-1$
766
		String jtagDeviceName = config.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, IGDBJtagConstants.DEFAULT_JTAG_DEVICE); //$NON-NLS-1$
707
		GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.
767
		GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance().getGDBJtagDeviceContribution();
708
			getInstance().getGDBJtagDeviceContribution();
768
		for (GDBJtagDeviceContribution availableDevice : availableDevices) {
709
		for (int i = 0; i < availableDevices.length; i++) {
769
			if (jtagDeviceName.equals(availableDevice.getDeviceName())) {
710
			if (jtagDeviceName.equals(availableDevices[i].getDeviceName())) {
770
				gdbJtagDevice = availableDevice.getDevice();
711
				gdbJtagDevice = availableDevices[i].getDevice();
712
				break;
771
				break;
713
			}
772
			}
714
		}
773
		}
(-)src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java (-28 / +87 lines)
Lines 24-29 Link Here
24
24
25
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
25
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
26
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
26
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
27
import org.eclipse.cdt.debug.core.CDebugUtils;
27
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
28
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
28
import org.eclipse.cdt.debug.core.cdi.ICDISession;
29
import org.eclipse.cdt.debug.core.cdi.ICDISession;
29
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
30
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
Lines 41-46 Link Here
41
import org.eclipse.cdt.debug.mi.core.command.MIGDBSetNewConsole;
42
import org.eclipse.cdt.debug.mi.core.command.MIGDBSetNewConsole;
42
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
43
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
43
import org.eclipse.core.runtime.CoreException;
44
import org.eclipse.core.runtime.CoreException;
45
import org.eclipse.core.runtime.IPath;
44
import org.eclipse.core.runtime.IProgressMonitor;
46
import org.eclipse.core.runtime.IProgressMonitor;
45
import org.eclipse.core.runtime.IStatus;
47
import org.eclipse.core.runtime.IStatus;
46
import org.eclipse.core.runtime.MultiStatus;
48
import org.eclipse.core.runtime.MultiStatus;
Lines 117-130 Link Here
117
119
118
			List<String> commands = new ArrayList<String>();
120
			List<String> commands = new ArrayList<String>();
119
121
120
			// hook up to remote target
121
			if (submonitor.isCanceled()) {
122
			if (submonitor.isCanceled()) {
122
				throw new OperationCanceledException();
123
				throw new OperationCanceledException();
123
			}
124
			}
125
			// execute symbol load
126
			boolean doLoadSymbols = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS);
127
			if (doLoadSymbols) {
128
				String symbolsFileName = null;
129
				// New setting in Helios. Default is true. Check for existence
130
				// in order to support older launch configs
131
				if (config.hasAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS) &&
132
						config.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_SYMBOLS)) {
133
					IPath programFile = CDebugUtils.verifyProgramPath(config);
134
					if (programFile != null) {
135
						symbolsFileName = programFile.toOSString();
136
					}
137
				}
138
				else {
139
					symbolsFileName = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, IGDBJtagConstants.DEFAULT_SYMBOLS_FILE_NAME);
140
					if (symbolsFileName.length() > 0) {
141
						symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName);
142
					}
143
				}
144
				if (symbolsFileName == null) {
145
					// The launch config GUI should prevent this from happening, but just in case					
146
					throw new CoreException(new Status( IStatus.ERROR,
147
							Activator.getUniqueIdentifier(),
148
							-1, Messages.getString("GDBJtagDebugger.err_no_sym_file"), null));
149
				}
150
151
					// Escape windows path separator characters TWICE, once for Java and once for GDB.
152
				symbolsFileName = symbolsFileName.replace("\\", "\\\\");
153
154
					String symbolsOffset = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, IGDBJtagConstants.DEFAULT_SYMBOLS_OFFSET);
155
				if (symbolsOffset.length() > 0) {
156
					symbolsOffset = "0x" + symbolsOffset;					
157
				}
158
				commands.clear();
159
				gdbJtagDevice.doLoadSymbol(symbolsFileName, symbolsOffset, commands);
160
				monitor.beginTask(Messages.getString("GDBJtagDebugger.loading_symbols"), 1); //$NON-NLS-1$				
161
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15));
162
			}
163
164
			if (submonitor.isCanceled()) {
165
				throw new OperationCanceledException();
166
			}
167
			
168
			// hook up to remote target
124
			boolean useRemote = config.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET);
169
			boolean useRemote = config.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET);
125
			if (useRemote) {
170
			if (useRemote) {
126
				submonitor.subTask(Messages.getString("GDBJtagDebugger.2")); //$NON-NLS-1$
171
				submonitor.subTask(Messages.getString("GDBJtagDebugger.2")); //$NON-NLS-1$
127
				try {
172
				try {
173
					commands.clear();				
128
					if (gdbJtagDevice instanceof IGDBJtagConnection) { 
174
					if (gdbJtagDevice instanceof IGDBJtagConnection) { 
129
						URI	connection = new URI(config.getAttribute(IGDBJtagConstants.ATTR_CONNECTION, IGDBJtagConstants.DEFAULT_CONNECTION));
175
						URI	connection = new URI(config.getAttribute(IGDBJtagConstants.ATTR_CONNECTION, IGDBJtagConstants.DEFAULT_CONNECTION));
130
						IGDBJtagConnection device = (IGDBJtagConnection)gdbJtagDevice;
176
						IGDBJtagConnection device = (IGDBJtagConnection)gdbJtagDevice;
Lines 149-155 Link Here
149
			submonitor.setWorkRemaining(80); // compensate for optional work above
195
			submonitor.setWorkRemaining(80); // compensate for optional work above
150
196
151
			// Run device-specific code to reset the board
197
			// Run device-specific code to reset the board
152
			if (config.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, true)) {
198
			if (config.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET)) {
153
				commands.clear();
199
				commands.clear();
154
				gdbJtagDevice.doReset(commands);
200
				gdbJtagDevice.doReset(commands);
155
				int defaultDelay = gdbJtagDevice.getDefaultDelay();
201
				int defaultDelay = gdbJtagDevice.getDefaultDelay();
Lines 159-165 Link Here
159
			submonitor.setWorkRemaining(65); // compensate for optional work above
205
			submonitor.setWorkRemaining(65); // compensate for optional work above
160
206
161
			// Run device-specific code to halt the board
207
			// Run device-specific code to halt the board
162
			if (config.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, true)) {
208
			if (config.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, IGDBJtagConstants.DEFAULT_DO_HALT)) {
163
				commands.clear();
209
				commands.clear();
164
				gdbJtagDevice.doHalt(commands);
210
				gdbJtagDevice.doHalt(commands);
165
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15));
211
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15));
Lines 172-202 Link Here
172
			// execute load
218
			// execute load
173
			boolean doLoad = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE);
219
			boolean doLoad = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE);
174
			if (doLoad) {
220
			if (doLoad) {
175
				// Escape windows path separator characters TWICE, once for Java and once for GDB.
221
				String imageFileName = null;
176
				String imageFileName = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, ""); //$NON-NLS-1$
222
177
				if (imageFileName.length() > 0) {
223
				// New setting in Helios. Default is true. Check for existence
178
					monitor.beginTask(Messages.getString("GDBJtagDebugger.5"), 1); //$NON-NLS-1$
224
				// in order to support older launch configs
179
					imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName).replace("\\", "\\\\");
225
				if (config.hasAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE) &&
180
					String imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, ""); //$NON-NLS-2$ //$NON-NLS-4$
226
						config.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_IMAGE)) {
181
					commands.clear();
227
					IPath programFile = CDebugUtils.verifyProgramPath(config);
182
					gdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
228
					if (programFile != null) {
183
					executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
229
						imageFileName = programFile.toOSString();
230
					}
184
				}
231
				}
185
			}
232
				else {
186
			submonitor.setWorkRemaining(15); // compensate for optional work above
233
					imageFileName = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, IGDBJtagConstants.DEFAULT_IMAGE_FILE_NAME);
234
					if (imageFileName.length() > 0) {
235
						imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName);
236
					}
237
				}
238
				if (imageFileName == null) {
239
					// The launch config GUI should prevent this from happening, but just in case
240
					throw new CoreException(new Status( IStatus.ERROR,
241
							Activator.getUniqueIdentifier(),
242
							-1, Messages.getString("GDBJtagDebugger.err_no_img_file"), null));
243
				}
244
				imageFileName = imageFileName.replace("\\", "\\\\");
187
245
188
			// execute symbol load
246
				String imageOffset = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET);
189
			boolean doLoadSymbols = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS);
247
				if (imageOffset.length() > 0) {
190
			if (doLoadSymbols) {
248
					imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET);					
191
				String symbolsFileName = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, ""); //$NON-NLS-1$
192
				if (symbolsFileName.length() > 0) {
193
					symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName).replace("\\", "\\\\");
194
					String symbolsOffset = "0x" + config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, ""); //$NON-NLS-2$
195
					commands.clear();
196
					gdbJtagDevice.doLoadSymbol(symbolsFileName, symbolsOffset, commands);
197
					executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15));
198
				}
249
				}
250
	
251
				commands.clear();
252
				gdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
253
				monitor.beginTask(Messages.getString("GDBJtagDebugger.loading_image"), 1); //$NON-NLS-1$
254
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
255
256
199
			}
257
			}
258
			submonitor.setWorkRemaining(15); // compensate for optional work above
200
		} catch (OperationCanceledException e) {
259
		} catch (OperationCanceledException e) {
201
			if (launch != null && launch.canTerminate()) {
260
			if (launch != null && launch.canTerminate()) {
202
				launch.terminate();
261
				launch.terminate();
Lines 229-235 Link Here
229
			// Set program counter
288
			// Set program counter
230
			boolean setPc = config.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER);
289
			boolean setPc = config.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER);
231
			if (setPc) {
290
			if (setPc) {
232
				String pcRegister = config.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, "")); //$NON-NLS-1$
291
				String pcRegister = config.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_PC_REGISTER)); //$NON-NLS-1$
233
				gdbJtagDevice.doSetPC(pcRegister, commands);
292
				gdbJtagDevice.doSetPC(pcRegister, commands);
234
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
293
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
235
			}
294
			}
Lines 239-245 Link Here
239
			monitor.beginTask(Messages.getString("GDBJtagDebugger.18"), 1); //$NON-NLS-1$
298
			monitor.beginTask(Messages.getString("GDBJtagDebugger.18"), 1); //$NON-NLS-1$
240
			boolean setStopAt = config.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT);
299
			boolean setStopAt = config.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT);
241
			if (setStopAt) {
300
			if (setStopAt) {
242
				String stopAt = config.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, ""); //$NON-NLS-1$
301
				String stopAt = config.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, IGDBJtagConstants.DEFAULT_STOP_AT); //$NON-NLS-1$
243
				commands.clear();
302
				commands.clear();
244
				gdbJtagDevice.doStopAt(stopAt, commands);
303
				gdbJtagDevice.doStopAt(stopAt, commands);
245
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
304
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
Lines 266-272 Link Here
266
	private void executeGDBScript(String script, MISession miSession, 
325
	private void executeGDBScript(String script, MISession miSession, 
267
			IProgressMonitor monitor) throws CoreException {
326
			IProgressMonitor monitor) throws CoreException {
268
		// Try to execute any extra command
327
		// Try to execute any extra command
269
		if (script == null)
328
		if (script == null || script.length() == 0)
270
			return;
329
			return;
271
		script = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(script);
330
		script = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(script);
272
		String[] commands = script.split("\\r?\\n");
331
		String[] commands = script.split("\\r?\\n");
Lines 309-315 Link Here
309
	private IGDBJtagDevice getGDBJtagDevice (ILaunchConfiguration config) 
368
	private IGDBJtagDevice getGDBJtagDevice (ILaunchConfiguration config) 
310
		throws CoreException, NullPointerException {
369
		throws CoreException, NullPointerException {
311
		IGDBJtagDevice gdbJtagDevice = null;
370
		IGDBJtagDevice gdbJtagDevice = null;
312
		String jtagDeviceName = config.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, ""); //$NON-NLS-1$
371
		String jtagDeviceName = config.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, IGDBJtagConstants.DEFAULT_JTAG_DEVICE); //$NON-NLS-1$
313
		GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.
372
		GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.
314
			getInstance().getGDBJtagDeviceContribution();
373
			getInstance().getGDBJtagDeviceContribution();
315
		for (int i = 0; i < availableDevices.length; i++) {
374
		for (int i = 0; i < availableDevices.length; i++) {
(-)src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagLaunchConfigurationDelegate.java (-7 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007 QNX Software Systems and others.
2
 * Copyright (c) 2007 - 2010 QNX Software Systems and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 10-20 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.debug.gdbjtag.core;
11
package org.eclipse.cdt.debug.gdbjtag.core;
12
12
13
import java.io.File;
14
15
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
13
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
16
import org.eclipse.cdt.core.model.ICProject;
14
import org.eclipse.cdt.core.model.ICProject;
17
import org.eclipse.cdt.debug.core.CDIDebugModel;
15
import org.eclipse.cdt.debug.core.CDIDebugModel;
16
import org.eclipse.cdt.debug.core.CDebugUtils;
18
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
17
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
19
import org.eclipse.cdt.debug.core.cdi.CDIException;
18
import org.eclipse.cdt.debug.core.cdi.CDIException;
20
import org.eclipse.cdt.debug.core.cdi.ICDISession;
19
import org.eclipse.cdt.debug.core.cdi.ICDISession;
Lines 48-57 Link Here
48
47
49
		if (mode.equals(ILaunchManager.DEBUG_MODE)) {
48
		if (mode.equals(ILaunchManager.DEBUG_MODE)) {
50
			GDBJtagDebugger debugger = new GDBJtagDebugger();
49
			GDBJtagDebugger debugger = new GDBJtagDebugger();
51
			ICProject project = verifyCProject(configuration);
50
			ICProject project = CDebugUtils.verifyCProject(configuration);
52
			IPath exePath = verifyProgramPath(configuration);
51
			IPath exePath = CDebugUtils.verifyProgramPath(configuration);
53
			File exeFile = exePath != null ? exePath.toFile() : null;
52
			ICDISession session = debugger.createSession(launch, null, submonitor.newChild(1));
54
			ICDISession session = debugger.createSession(launch, exeFile, submonitor.newChild(1));
55
			IBinaryObject exeBinary = null;
53
			IBinaryObject exeBinary = null;
56
			if ( exePath != null ) {
54
			if ( exePath != null ) {
57
				exeBinary = verifyBinary(project, exePath);
55
				exeBinary = verifyBinary(project, exePath);
(-)src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java (-5 / +23 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007 - 2008 QNX Software Systems and others.
2
 * Copyright (c) 2007 - 2010 QNX Software Systems and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 52-66 Link Here
52
	public static final String ATTR_STOP_AT = Activator.PLUGIN_ID + ".stopAt"; //$NON-NLS-1$
52
	public static final String ATTR_STOP_AT = Activator.PLUGIN_ID + ".stopAt"; //$NON-NLS-1$
53
	public static final String ATTR_SET_RESUME = Activator.PLUGIN_ID + ".setResume"; //$NON-NLS-1$
53
	public static final String ATTR_SET_RESUME = Activator.PLUGIN_ID + ".setResume"; //$NON-NLS-1$
54
	public static final String ATTR_RUN_COMMANDS = Activator.PLUGIN_ID + ".runCommands"; //$NON-NLS-1$
54
	public static final String ATTR_RUN_COMMANDS = Activator.PLUGIN_ID + ".runCommands"; //$NON-NLS-1$
55
	
55
	/** @since 7.0 */ public static final String ATTR_USE_PROJ_BINARY_FOR_IMAGE = Activator.PLUGIN_ID + ".useProjBinaryForImage"; //$NON-NLS-1$
56
	/** @since 7.0 */ public static final String ATTR_USE_FILE_FOR_IMAGE = Activator.PLUGIN_ID + ".useFileForImage"; //$NON-NLS-1$
57
	/** @since 7.0 */ public static final String ATTR_USE_PROJ_BINARY_FOR_SYMBOLS = Activator.PLUGIN_ID + ".useProjBinaryForSymbols"; //$NON-NLS-1$
58
	/** @since 7.0 */ public static final String ATTR_USE_FILE_FOR_SYMBOLS = Activator.PLUGIN_ID + ".useFileForSymbols"; //$NON-NLS-1$
59
56
	public static final boolean DEFAULT_DO_RESET = true;
60
	public static final boolean DEFAULT_DO_RESET = true;
57
	public static final boolean DEFAULT_DO_HALT = true;
61
	public static final boolean DEFAULT_DO_HALT = true;
58
	public static final int DEFAULT_DELAY = 3;
62
	public static final int DEFAULT_DELAY = 3;
59
	public static final boolean DEFAULT_LOAD_IMAGE = false;
63
	public static final boolean DEFAULT_LOAD_IMAGE = true;
60
	public static final boolean DEFAULT_LOAD_SYMBOLS = false;
64
	public static final boolean DEFAULT_LOAD_SYMBOLS = true;
61
	public static final boolean DEFAULT_SET_PC_REGISTER = false;
65
	public static final boolean DEFAULT_SET_PC_REGISTER = false;
62
	public static final boolean DEFAULT_SET_STOP_AT = false;
66
	public static final boolean DEFAULT_SET_STOP_AT = false;
63
	public static final boolean DEFAULT_SET_RESUME = false;
67
	public static final boolean DEFAULT_SET_RESUME = false;
64
	public static final boolean DEFAULT_USE_DEFAULT_RUN = true;
68
	public static final boolean DEFAULT_USE_DEFAULT_RUN = true;
65
		
69
70
	/** @since 7.0 */ public static final String DEFAULT_INIT_COMMANDS = ""; //$NON-NLS-1$
71
	/** @since 7.0 */ public static final String DEFAULT_IMAGE_FILE_NAME = ""; //$NON-NLS-1$
72
	/** @since 7.0 */ public static final String DEFAULT_SYMBOLS_FILE_NAME = ""; //$NON-NLS-1$
73
	/** @since 7.0 */ public static final String DEFAULT_RUN_COMMANDS = ""; //$NON-NLS-1$
74
	/** @since 7.0 */ public static final boolean DEFAULT_USE_PROJ_BINARY_FOR_IMAGE = true;
75
	/** @since 7.0 */ public static final boolean DEFAULT_USE_FILE_FOR_IMAGE = false;
76
	/** @since 7.0 */ public static final boolean DEFAULT_USE_PROJ_BINARY_FOR_SYMBOLS = true;
77
	/** @since 7.0 */ public static final boolean DEFAULT_USE_FILE_FOR_SYMBOLS = false;
78
	/** @since 7.0 */ public static final String DEFAULT_IMAGE_OFFSET = ""; //$NON-NLS-1$
79
	/** @since 7.0 */ public static final String DEFAULT_SYMBOLS_OFFSET = ""; //$NON-NLS-1$
80
	/** @since 7.0 */ public static final String DEFAULT_PC_REGISTER = ""; //$NON-NLS-1$
81
	/** @since 7.0 */ public static final String DEFAULT_STOP_AT = ""; //$NON-NLS-1$
82
	/** @since 7.0 */ public static final String DEFAULT_JTAG_DEVICE = ""; //$NON-NLS-1$
83
	
66
}
84
}
(-)src/org/eclipse/cdt/debug/gdbjtag/core/Message.properties (-2 / +6 lines)
Lines 1-5 Link Here
1
###############################################################################
1
###############################################################################
2
#  Copyright (c) 2008 QNX Software Systems and others.
2
#  Copyright (c) 2008 - 2010 QNX Software Systems and others.
3
#  All rights reserved. This program and the accompanying materials
3
#  All rights reserved. This program and the accompanying materials
4
#  are made available under the terms of the Eclipse Public License v1.0
4
#  are made available under the terms of the Eclipse Public License v1.0
5
#  which accompanies this distribution, and is available at
5
#  which accompanies this distribution, and is available at
Lines 15-19 Link Here
15
GDBJtagDebugger.21=GDB command: 
15
GDBJtagDebugger.21=GDB command: 
16
GDBJtagDebugger.22=Failed command
16
GDBJtagDebugger.22=Failed command
17
GDBJtagDebugger.3=Executing init commands
17
GDBJtagDebugger.3=Executing init commands
18
GDBJtagDebugger.5=Loading image
18
GDBJtagDebugger.loading_image=Loading image
19
GDBJtagDebugger.loading_symbols=Loading symbolics
19
src.common.No_answer=No answer
20
src.common.No_answer=No answer
21
22
GDBJtagDebugger.err_no_sym_file=Symbolics loading was requested but file was not specified or not found.
23
GDBJtagDebugger.err_no_img_file=Image loading was requested but file was not specified or not found. 
(-)src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagDeviceImpl.java (-4 / +19 lines)
Lines 77-84 Link Here
77
	 */
77
	 */
78
	public void doLoadImage(String imageFileName, String imageOffset, Collection<String> commands) {
78
	public void doLoadImage(String imageFileName, String imageOffset, Collection<String> commands) {
79
		String file = escapeScpaces(imageFileName);
79
		String file = escapeScpaces(imageFileName);
80
		String cmd = "restore " + file + " " + imageOffset; //$NON-NLS-1$ //$NON-NLS-2$
80
		if (imageOffset.length() > 0) {
81
		addCmd(commands, cmd);
81
			// 'restore' simply puts the program into memory. 
82
			addCmd(commands, "restore " + file + " " + imageOffset);
83
		}
84
		else {
85
			// 'load' puts the program into memory and sets the PC. To see why
86
			// we do this when no offset is specified, see
87
			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=310304#c20
88
			addCmd(commands, "load " + file);			
89
		}
90
		// 'exec-file' specifies the program as the context for getting memory.
91
		// Basically, it tells gdb "this is the program we'll be debugging"
92
		addCmd(commands, "exec-file " + file);
82
	}
93
	}
83
94
84
	/* (non-Javadoc)
95
	/* (non-Javadoc)
Lines 86-93 Link Here
86
	 */
97
	 */
87
	public void doLoadSymbol(String symbolFileName, String symbolOffset, Collection<String> commands) {
98
	public void doLoadSymbol(String symbolFileName, String symbolOffset, Collection<String> commands) {
88
		String file = escapeScpaces(symbolFileName);
99
		String file = escapeScpaces(symbolFileName);
89
		String cmd = "add-sym " + file + " " + symbolOffset; //$NON-NLS-1$ //$NON-NLS-2$
100
		if (symbolOffset == null || (symbolOffset.length() == 0)) {
90
		addCmd(commands, cmd);
101
			addCmd(commands, "symbol-file " + file);
102
		}
103
		else {
104
			addCmd(commands, "add-sym " + file + " " + symbolOffset);			
105
		}
91
	}
106
	}
92
	
107
	
93
	protected String escapeScpaces(String file) {
108
	protected String escapeScpaces(String file) {
(-)src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java (-5 / +5 lines)
Lines 159-165 Link Here
159
		gdbCommand.setLayoutData(gd);
159
		gdbCommand.setLayoutData(gd);
160
		gdbCommand.addModifyListener(new ModifyListener() {
160
		gdbCommand.addModifyListener(new ModifyListener() {
161
			public void modifyText(ModifyEvent e) {
161
			public void modifyText(ModifyEvent e) {
162
				updateLaunchConfigurationDialog();
162
				scheduleUpdateJob(); // provides much better performance for Text listeners
163
			}
163
			}
164
		});
164
		});
165
165
Lines 216-222 Link Here
216
		jtagDevice.addModifyListener(new ModifyListener() {
216
		jtagDevice.addModifyListener(new ModifyListener() {
217
			public void modifyText(ModifyEvent e) {
217
			public void modifyText(ModifyEvent e) {
218
				updateDeviceIpPort(jtagDevice.getText());
218
				updateDeviceIpPort(jtagDevice.getText());
219
				updateLaunchConfigurationDialog();
219
				scheduleUpdateJob(); // provides much better performance for Text listeners
220
			}
220
			}
221
		});
221
		});
222
		
222
		
Lines 275-281 Link Here
275
275
276
		ipAddress.addModifyListener(new ModifyListener() {
276
		ipAddress.addModifyListener(new ModifyListener() {
277
			public void modifyText(ModifyEvent e) {
277
			public void modifyText(ModifyEvent e) {
278
				updateLaunchConfigurationDialog();
278
				scheduleUpdateJob(); // provides much better performance for Text listeners
279
			}
279
			}
280
		});
280
		});
281
		portNumber.addVerifyListener(new VerifyListener() {
281
		portNumber.addVerifyListener(new VerifyListener() {
Lines 285-297 Link Here
285
		});
285
		});
286
		portNumber.addModifyListener(new ModifyListener() {
286
		portNumber.addModifyListener(new ModifyListener() {
287
			public void modifyText(ModifyEvent e) {
287
			public void modifyText(ModifyEvent e) {
288
				updateLaunchConfigurationDialog();
288
				scheduleUpdateJob(); // provides much better performance for Text listeners
289
			}
289
			}
290
		});
290
		});
291
291
292
		connection.addModifyListener(new ModifyListener() {
292
		connection.addModifyListener(new ModifyListener() {
293
			public void modifyText(ModifyEvent e) {
293
			public void modifyText(ModifyEvent e) {
294
				updateLaunchConfigurationDialog();
294
				scheduleUpdateJob(); // provides much better performance for Text listeners
295
			}
295
			}
296
		});	
296
		});	
297
	}
297
	}
(-)src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDebuggerTab.java (-7 / +7 lines)
Lines 160-166 Link Here
160
		gdbCommand.setLayoutData(gd);
160
		gdbCommand.setLayoutData(gd);
161
		gdbCommand.addModifyListener(new ModifyListener() {
161
		gdbCommand.addModifyListener(new ModifyListener() {
162
			public void modifyText(ModifyEvent e) {
162
			public void modifyText(ModifyEvent e) {
163
				updateLaunchConfigurationDialog();
163
				scheduleUpdateJob();	// provides much better performance for Text listeners 
164
			}
164
			}
165
		});
165
		});
166
166
Lines 200-206 Link Here
200
		commandFactory.addModifyListener(new ModifyListener() {
200
		commandFactory.addModifyListener(new ModifyListener() {
201
			public void modifyText(ModifyEvent e) {
201
			public void modifyText(ModifyEvent e) {
202
				commandFactoryChanged();
202
				commandFactoryChanged();
203
				updateLaunchConfigurationDialog();
203
				scheduleUpdateJob(); // provides much better performance for Text listeners
204
			}
204
			}
205
		});
205
		});
206
	}
206
	}
Lines 215-221 Link Here
215
		miProtocol = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN);
215
		miProtocol = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN);
216
		miProtocol.addModifyListener(new ModifyListener() {
216
		miProtocol.addModifyListener(new ModifyListener() {
217
			public void modifyText(ModifyEvent e) {
217
			public void modifyText(ModifyEvent e) {
218
				updateLaunchConfigurationDialog();
218
				scheduleUpdateJob(); // provides much better performance for Text listeners
219
			}
219
			}
220
		});
220
		});
221
	}
221
	}
Lines 285-291 Link Here
285
		jtagDevice.addModifyListener(new ModifyListener() {
285
		jtagDevice.addModifyListener(new ModifyListener() {
286
			public void modifyText(ModifyEvent e) {
286
			public void modifyText(ModifyEvent e) {
287
				updateDeviceIpPort(jtagDevice.getText());
287
				updateDeviceIpPort(jtagDevice.getText());
288
				updateLaunchConfigurationDialog();
288
				scheduleUpdateJob(); // provides much better performance for Text listeners
289
			}
289
			}
290
		});
290
		});
291
		
291
		
Lines 344-350 Link Here
344
344
345
		ipAddress.addModifyListener(new ModifyListener() {
345
		ipAddress.addModifyListener(new ModifyListener() {
346
			public void modifyText(ModifyEvent e) {
346
			public void modifyText(ModifyEvent e) {
347
				updateLaunchConfigurationDialog();
347
				scheduleUpdateJob(); // provides much better performance for Text listeners
348
			}
348
			}
349
		});
349
		});
350
		portNumber.addVerifyListener(new VerifyListener() {
350
		portNumber.addVerifyListener(new VerifyListener() {
Lines 354-366 Link Here
354
		});
354
		});
355
		portNumber.addModifyListener(new ModifyListener() {
355
		portNumber.addModifyListener(new ModifyListener() {
356
			public void modifyText(ModifyEvent e) {
356
			public void modifyText(ModifyEvent e) {
357
				updateLaunchConfigurationDialog();
357
				scheduleUpdateJob(); // provides much better performance for Text listeners
358
			}
358
			}
359
		});
359
		});
360
360
361
		connection.addModifyListener(new ModifyListener() {
361
		connection.addModifyListener(new ModifyListener() {
362
			public void modifyText(ModifyEvent e) {
362
			public void modifyText(ModifyEvent e) {
363
				updateLaunchConfigurationDialog();
363
				scheduleUpdateJob(); // provides much better performance for Text listeners
364
			}
364
			}
365
		});		
365
		});		
366
	}
366
	}
(-)src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagStartupTab.java (-78 / +217 lines)
Lines 15-21 Link Here
15
15
16
import java.io.File;
16
import java.io.File;
17
17
18
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
18
import org.eclipse.cdt.debug.core.CDebugUtils;
19
import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConstants;
19
import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConstants;
20
import org.eclipse.core.resources.IResource;
20
import org.eclipse.core.resources.IResource;
21
import org.eclipse.core.resources.ResourcesPlugin;
21
import org.eclipse.core.resources.ResourcesPlugin;
Lines 33-38 Link Here
33
import org.eclipse.swt.events.ModifyListener;
33
import org.eclipse.swt.events.ModifyListener;
34
import org.eclipse.swt.events.SelectionAdapter;
34
import org.eclipse.swt.events.SelectionAdapter;
35
import org.eclipse.swt.events.SelectionEvent;
35
import org.eclipse.swt.events.SelectionEvent;
36
import org.eclipse.swt.events.SelectionListener;
36
import org.eclipse.swt.events.VerifyEvent;
37
import org.eclipse.swt.events.VerifyEvent;
37
import org.eclipse.swt.events.VerifyListener;
38
import org.eclipse.swt.events.VerifyListener;
38
import org.eclipse.swt.graphics.Image;
39
import org.eclipse.swt.graphics.Image;
Lines 82-87 Link Here
82
	boolean resume = false;
83
	boolean resume = false;
83
	
84
	
84
	Text runCommands;
85
	Text runCommands;
86
	
87
	// New GUI added to address bug 310304
88
	private Button useProjectBinaryForImage;
89
	private Button useFileForImage;
90
	private Button useProjectBinaryForSymbols;
91
	private Button useFileForSymbols;
92
	private Label imageOffsetLabel;
93
	private Label symbolsOffsetLabel;
94
	private Label projBinaryLabel1;
95
	private Label projBinaryLabel2;
85
96
86
	public String getName() {
97
	public String getName() {
87
		return TAB_NAME;
98
		return TAB_NAME;
Lines 170-176 Link Here
170
		});
181
		});
171
		delay.addModifyListener(new ModifyListener() {
182
		delay.addModifyListener(new ModifyListener() {
172
			public void modifyText(ModifyEvent e) {
183
			public void modifyText(ModifyEvent e) {
173
				updateLaunchConfigurationDialog();
184
				scheduleUpdateJob();
174
			}
185
			}
175
		});
186
		});
176
		
187
		
Lines 197-203 Link Here
197
		initCommands.setLayoutData(gd);
208
		initCommands.setLayoutData(gd);
198
		initCommands.addModifyListener(new ModifyListener() {
209
		initCommands.addModifyListener(new ModifyListener() {
199
			public void modifyText(ModifyEvent evt) {
210
			public void modifyText(ModifyEvent evt) {
200
				updateLaunchConfigurationDialog();
211
				scheduleUpdateJob();
201
			}
212
			}
202
		});
213
		});
203
		
214
		
Lines 231-245 Link Here
231
		comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
242
		comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
232
		comp.setLayout(layout);
243
		comp.setLayout(layout);
233
		
244
		
234
		Label imageLabel = new Label(comp, SWT.NONE);
245
		SelectionListener radioButtonListener = new SelectionListener() {
235
		imageLabel.setText(Messages.getString("GDBJtagStartupTab.imageLabel_Text"));	
246
			public void widgetSelected(SelectionEvent e) {
247
				updateLaunchConfigurationDialog();
248
				updateUseFileEnablement();
249
			}
250
			public void widgetDefaultSelected(SelectionEvent e) {
251
			}
252
		};
253
		
254
		useProjectBinaryForImage = new Button(comp, SWT.RADIO);
255
		useProjectBinaryForImage.setText(Messages.getString("GDBJtagStartupTab.useProjectBinary_Label"));
256
		useProjectBinaryForImage.setToolTipText(Messages.getString("GDBJtagStartupTab.useProjectBinary_ToolTip"));
257
		gd = new GridData();
258
		gd.horizontalSpan = 1;
259
		useProjectBinaryForImage.setLayoutData(gd);
260
		useProjectBinaryForImage.addSelectionListener(radioButtonListener);
261
		
262
		projBinaryLabel1 = new Label(comp, SWT.NONE);
263
		gd = new GridData(GridData.FILL_HORIZONTAL);
264
		gd.horizontalSpan = 3;
265
		projBinaryLabel1.setLayoutData(gd);
266
		
267
		useFileForImage = new Button(comp, SWT.RADIO);
268
		useFileForImage.setText(Messages.getString("GDBJtagStartupTab.useFile_Label"));
269
		gd = new GridData();
270
		gd.horizontalSpan = 1;
271
		useFileForImage.setLayoutData(gd);
272
		useFileForImage.addSelectionListener(radioButtonListener);		
273
236
		imageFileName = new Text(comp, SWT.BORDER);
274
		imageFileName = new Text(comp, SWT.BORDER);
237
		gd = new GridData(GridData.FILL_HORIZONTAL);
275
		gd = new GridData(GridData.FILL_HORIZONTAL);
238
		gd.horizontalSpan = 1;
276
		gd.horizontalSpan = 1;
239
		imageFileName.setLayoutData(gd);
277
		imageFileName.setLayoutData(gd);
240
		imageFileName.addModifyListener(new ModifyListener() {
278
		imageFileName.addModifyListener(new ModifyListener() {
241
			public void modifyText(ModifyEvent e) {
279
			public void modifyText(ModifyEvent e) {
242
				updateLaunchConfigurationDialog();
280
				scheduleUpdateJob();
243
			}
281
			}
244
		});
282
		});
245
		
283
		
Lines 257-263 Link Here
257
			}
295
			}
258
		});	
296
		});	
259
		
297
		
260
		Label imageOffsetLabel = new Label(comp, SWT.NONE);
298
		imageOffsetLabel = new Label(comp, SWT.NONE);
261
		imageOffsetLabel.setText(Messages.getString("GDBJtagStartupTab.imageOffsetLabel_Text"));
299
		imageOffsetLabel.setText(Messages.getString("GDBJtagStartupTab.imageOffsetLabel_Text"));
262
		imageOffset = new Text(comp, SWT.BORDER);
300
		imageOffset = new Text(comp, SWT.BORDER);
263
		gd = new GridData();
301
		gd = new GridData();
Lines 271-280 Link Here
271
		});
309
		});
272
		imageOffset.addModifyListener(new ModifyListener() {
310
		imageOffset.addModifyListener(new ModifyListener() {
273
			public void modifyText(ModifyEvent e) {
311
			public void modifyText(ModifyEvent e) {
274
				updateLaunchConfigurationDialog();
312
				scheduleUpdateJob();
275
			}
313
			}
276
		});
314
		});
277
		
315
		
316
		
278
		loadSymbols = new Button(group, SWT.CHECK);
317
		loadSymbols = new Button(group, SWT.CHECK);
279
		loadSymbols.setText(Messages.getString("GDBJtagStartupTab.loadSymbols_Text"));
318
		loadSymbols.setText(Messages.getString("GDBJtagStartupTab.loadSymbols_Text"));
280
		gd = new GridData();
319
		gd = new GridData();
Lines 292-307 Link Here
292
		layout.numColumns = 4;
331
		layout.numColumns = 4;
293
		comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
332
		comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
294
		comp.setLayout(layout);
333
		comp.setLayout(layout);
334
335
		useProjectBinaryForSymbols = new Button(comp, SWT.RADIO);
336
		useProjectBinaryForSymbols.setText(Messages.getString("GDBJtagStartupTab.useProjectBinary_Label"));
337
		useProjectBinaryForSymbols.setToolTipText(Messages.getString("GDBJtagStartupTab.useProjectBinary_ToolTip"));
338
		gd = new GridData();
339
		gd.horizontalSpan = 1;
340
		useProjectBinaryForSymbols.setLayoutData(gd);
341
		useProjectBinaryForSymbols.addSelectionListener(radioButtonListener);
342
		
343
		projBinaryLabel2 = new Label(comp, SWT.NONE);
344
		gd = new GridData(GridData.FILL_HORIZONTAL);
345
		gd.horizontalSpan = 3;
346
		projBinaryLabel2.setLayoutData(gd);
347
		
348
		useFileForSymbols = new Button(comp, SWT.RADIO);
349
		useFileForSymbols.setText(Messages.getString("GDBJtagStartupTab.useFile_Label"));
350
		gd = new GridData();
351
		gd.horizontalSpan = 1;
352
		useFileForSymbols.setLayoutData(gd);
353
		useFileForSymbols.addSelectionListener(radioButtonListener);
295
		
354
		
296
		Label symbolLabel = new Label(comp, SWT.NONE);
297
		symbolLabel.setText(Messages.getString("GDBJtagStartupTab.symbolsLabel_Text"));	
298
		symbolsFileName = new Text(comp, SWT.BORDER);
355
		symbolsFileName = new Text(comp, SWT.BORDER);
299
		gd = new GridData(GridData.FILL_HORIZONTAL);
356
		gd = new GridData(GridData.FILL_HORIZONTAL);
300
		gd.horizontalSpan = 1;
357
		gd.horizontalSpan = 1;
301
		symbolsFileName.setLayoutData(gd);
358
		symbolsFileName.setLayoutData(gd);
302
		symbolsFileName.addModifyListener(new ModifyListener() {
359
		symbolsFileName.addModifyListener(new ModifyListener() {
303
			public void modifyText(ModifyEvent e) {
360
			public void modifyText(ModifyEvent e) {
304
				updateLaunchConfigurationDialog();
361
				scheduleUpdateJob();
305
			}
362
			}
306
		});	
363
		});	
307
		
364
		
Lines 319-325 Link Here
319
			}
376
			}
320
		});
377
		});
321
		
378
		
322
		Label symbolsOffsetLabel = new Label(comp, SWT.NONE);
379
		symbolsOffsetLabel = new Label(comp, SWT.NONE);
323
		symbolsOffsetLabel.setText(Messages.getString("GDBJtagStartupTab.symbolsOffsetLabel_Text"));
380
		symbolsOffsetLabel.setText(Messages.getString("GDBJtagStartupTab.symbolsOffsetLabel_Text"));
324
		symbolsOffset = new Text(comp, SWT.BORDER);
381
		symbolsOffset = new Text(comp, SWT.BORDER);
325
		gd = new GridData();
382
		gd = new GridData();
Lines 333-344 Link Here
333
		});
390
		});
334
		symbolsOffset.addModifyListener(new ModifyListener() {
391
		symbolsOffset.addModifyListener(new ModifyListener() {
335
			public void modifyText(ModifyEvent e) {
392
			public void modifyText(ModifyEvent e) {
336
				updateLaunchConfigurationDialog();
393
				scheduleUpdateJob();
337
			}
394
			}
338
		});
395
		});
339
		
396
		
340
	}
397
	}
341
	
398
	
399
	private void updateUseFileEnablement() {
400
		boolean enabled = loadImage.getSelection() && useFileForImage.getSelection();
401
		imageFileName.setEnabled(enabled);
402
		imageFileBrowseWs.setEnabled(enabled);
403
		imageFileBrowse.setEnabled(enabled);
404
		
405
		enabled = loadSymbols.getSelection() && useFileForSymbols.getSelection();
406
		symbolsFileName.setEnabled(enabled);
407
		symbolsFileBrowseWs.setEnabled(enabled);
408
		symbolsFileBrowse.setEnabled(enabled);
409
	}
410
342
	public void createRunOptionGroup(Composite parent) {
411
	public void createRunOptionGroup(Composite parent) {
343
		Group group = new Group(parent, SWT.NONE);
412
		Group group = new Group(parent, SWT.NONE);
344
		GridLayout layout = new GridLayout();
413
		GridLayout layout = new GridLayout();
Lines 373-379 Link Here
373
		});
442
		});
374
		pcRegister.addModifyListener(new ModifyListener() {
443
		pcRegister.addModifyListener(new ModifyListener() {
375
			public void modifyText(ModifyEvent e) {
444
			public void modifyText(ModifyEvent e) {
376
				updateLaunchConfigurationDialog();
445
				scheduleUpdateJob();
377
			}
446
			}
378
		});
447
		});
379
		
448
		
Lines 396-402 Link Here
396
		stopAt.setLayoutData(gd);
465
		stopAt.setLayoutData(gd);
397
		stopAt.addModifyListener(new ModifyListener() {
466
		stopAt.addModifyListener(new ModifyListener() {
398
			public void modifyText(ModifyEvent e) {
467
			public void modifyText(ModifyEvent e) {
399
				updateLaunchConfigurationDialog();
468
				scheduleUpdateJob();
400
			}
469
			}
401
		});
470
		});
402
471
Lines 419-436 Link Here
419
488
420
	private void loadImageChanged() {
489
	private void loadImageChanged() {
421
		boolean enabled = loadImage.getSelection();
490
		boolean enabled = loadImage.getSelection();
422
		imageFileName.setEnabled(enabled);
491
		useProjectBinaryForImage.setEnabled(enabled);
423
		imageFileBrowseWs.setEnabled(enabled);
492
		useFileForImage.setEnabled(enabled);
424
		imageFileBrowse.setEnabled(enabled);
425
		imageOffset.setEnabled(enabled);
493
		imageOffset.setEnabled(enabled);
494
		imageOffsetLabel.setEnabled(enabled);
495
		updateUseFileEnablement();
426
	}
496
	}
427
	
497
	
428
	private void loadSymbolsChanged() {
498
	private void loadSymbolsChanged() {
429
		boolean enabled = loadSymbols.getSelection();
499
		boolean enabled = loadSymbols.getSelection();
430
		symbolsFileName.setEnabled(enabled);
500
		useProjectBinaryForSymbols.setEnabled(enabled);
431
		symbolsFileBrowseWs.setEnabled(enabled);
501
		useFileForSymbols.setEnabled(enabled);
432
		symbolsFileBrowse.setEnabled(enabled);
433
		symbolsOffset.setEnabled(enabled);
502
		symbolsOffset.setEnabled(enabled);
503
		symbolsOffsetLabel.setEnabled(enabled);
504
		updateUseFileEnablement();		
434
	}
505
	}
435
	
506
	
436
	private void pcRegisterChanged() {
507
	private void pcRegisterChanged() {
Lines 459-465 Link Here
459
		runCommands.setLayoutData(gd);
530
		runCommands.setLayoutData(gd);
460
		runCommands.addModifyListener(new ModifyListener() {
531
		runCommands.addModifyListener(new ModifyListener() {
461
			public void modifyText(ModifyEvent evt) {
532
			public void modifyText(ModifyEvent evt) {
462
				updateLaunchConfigurationDialog();
533
				scheduleUpdateJob();
463
			}
534
			}
464
		});
535
		});
465
	}
536
	}
Lines 474-513 Link Here
474
		setMessage(null);
545
		setMessage(null);
475
546
476
		if (loadImage.getSelection()) {
547
		if (loadImage.getSelection()) {
477
			if (imageFileName.getText().trim().length() == 0) {
548
			if (!useProjectBinaryForImage.getSelection()) {
478
				setErrorMessage(Messages.getString("GDBJtagStartupTab.imageFileName_not_specified"));
549
				if (imageFileName.getText().trim().length() == 0) {
479
				return false;
550
					setErrorMessage(Messages.getString("GDBJtagStartupTab.imageFileName_not_specified"));
480
			}
551
					return false;
481
552
				}
482
			String path;
553
	
483
			try {
554
				try {
484
				path = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName.getText().trim());
555
					String path = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName.getText().trim());
485
				IPath filePath = new Path(path);
556
					IPath filePath = new Path(path);
486
				if (!filePath.toFile().exists()) {
557
					if (!filePath.toFile().exists()) {
558
						setErrorMessage(Messages.getString("GDBJtagStartupTab.imageFileName_does_not_exist"));
559
						return false;
560
					}
561
				} catch (CoreException e) { // string substitution throws this if expression doesn't resolve 
487
					setErrorMessage(Messages.getString("GDBJtagStartupTab.imageFileName_does_not_exist"));
562
					setErrorMessage(Messages.getString("GDBJtagStartupTab.imageFileName_does_not_exist"));
488
					return false;
563
					return false;
489
				}
564
				}
490
			} catch (CoreException e) {
491
				Activator.getDefault().getLog().log(e.getStatus());
492
			}
565
			}
493
		} else {
566
		} else {
494
			setErrorMessage(null);
567
			setErrorMessage(null);
495
		}
568
		}
496
		if (loadSymbols.getSelection()) {
569
		if (loadSymbols.getSelection()) {
497
			if (symbolsFileName.getText().trim().length() == 0) {
570
			if (!useProjectBinaryForSymbols.getSelection()) {
498
				setErrorMessage(Messages.getString("GDBJtagStartupTab.symbolsFileName_not_specified"));
571
				if (symbolsFileName.getText().trim().length() == 0) {
499
				return false;
572
					setErrorMessage(Messages.getString("GDBJtagStartupTab.symbolsFileName_not_specified"));
500
			}
573
					return false;
501
			String path;
574
				}
502
			try {
575
			
503
				path = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName.getText().trim());
576
				try {
504
				IPath filePath = new Path(path);
577
					String path = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName.getText().trim());
505
				if (!filePath.toFile().exists()) {
578
					IPath filePath = new Path(path);
579
					if (!filePath.toFile().exists()) {
580
						setErrorMessage(Messages.getString("GDBJtagStartupTab.symbolsFileName_does_not_exist"));
581
						return false;
582
					}
583
				} catch (CoreException e) { // string substitution throws this if expression doesn't resolve 
506
					setErrorMessage(Messages.getString("GDBJtagStartupTab.symbolsFileName_does_not_exist"));
584
					setErrorMessage(Messages.getString("GDBJtagStartupTab.symbolsFileName_does_not_exist"));
507
					return false;
585
					return false;
508
				}
586
				}
509
			} catch (CoreException e) {
510
				Activator.getDefault().getLog().log(e.getStatus());
511
			}
587
			}
512
		} else {
588
		} else {
513
			setErrorMessage(null);
589
			setErrorMessage(null);
Lines 540-611 Link Here
540
	}
616
	}
541
	
617
	
542
	/* (non-Javadoc)
618
	/* (non-Javadoc)
543
	 * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
619
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
544
	 */
620
	 */
545
//	protected void updateLaunchConfigurationDialog() {
546
//		super.updateLaunchConfigurationDialog();
547
//		isValid(getLaunchConfigurationDialog());
548
//	}
549
	
550
	public void initializeFrom(ILaunchConfiguration configuration) {
621
	public void initializeFrom(ILaunchConfiguration configuration) {
551
		try {
622
		try {
552
			initCommands.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, "")); //$NON-NLS-1$
623
			// Initialization Commands
553
			doReset.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET));
624
			doReset.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET));
554
			doResetChanged();
555
			doHalt.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, IGDBJtagConstants.DEFAULT_DO_HALT));
556
			delay.setText(String.valueOf(configuration.getAttribute(IGDBJtagConstants.ATTR_DELAY, IGDBJtagConstants.DEFAULT_DELAY)));
625
			delay.setText(String.valueOf(configuration.getAttribute(IGDBJtagConstants.ATTR_DELAY, IGDBJtagConstants.DEFAULT_DELAY)));
626
			doHalt.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, IGDBJtagConstants.DEFAULT_DO_HALT));
627
			initCommands.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, IGDBJtagConstants.DEFAULT_INIT_COMMANDS));
628
			
629
			// Load Image...
557
			loadImage.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE));
630
			loadImage.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE));
558
			loadImageChanged();
631
			useProjectBinaryForImage.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_IMAGE));
559
			String defaultImageFileName = configuration.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, ""); //$NON-NLS-1$
632
			useFileForImage.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_USE_FILE_FOR_IMAGE, IGDBJtagConstants.DEFAULT_USE_FILE_FOR_IMAGE));
560
			if (defaultImageFileName.equals("")) {
633
			imageFileName.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, IGDBJtagConstants.DEFAULT_IMAGE_FILE_NAME));
561
				defaultImageFileName = configuration.getWorkingCopy().getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, ""); //$NON-NLS-1$
634
			imageOffset.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET));
562
			}
635
			
563
			imageFileName.setText(defaultImageFileName);
636
			//.. and Symbols
564
			imageOffset.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, "")); //$NON-NLS-1$
565
			loadSymbols.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS));
637
			loadSymbols.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS));
566
			loadSymbolsChanged();
638
			useProjectBinaryForSymbols.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_SYMBOLS));
567
			symbolsFileName.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, "")); //$NON-NLS-1$
639
			useFileForSymbols.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_USE_FILE_FOR_SYMBOLS, IGDBJtagConstants.DEFAULT_USE_FILE_FOR_SYMBOLS));
568
			symbolsOffset.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, "")); //$NON-NLS-1$
640
			symbolsFileName.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, IGDBJtagConstants.DEFAULT_SYMBOLS_FILE_NAME));
641
			symbolsOffset.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, IGDBJtagConstants.DEFAULT_SYMBOLS_OFFSET));
642
			
643
			// Runtime Options
569
			setPcRegister.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER));
644
			setPcRegister.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER));
570
			pcRegisterChanged();
645
			pcRegister.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, IGDBJtagConstants.DEFAULT_PC_REGISTER));
571
			pcRegister.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, "")); //$NON-NLS-1$
572
			setStopAt.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT));
646
			setStopAt.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT));
573
			stopAtChanged();
647
			stopAt.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, IGDBJtagConstants.DEFAULT_STOP_AT));
574
			stopAt.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, "")); //$NON-NLS-1$
575
			setResume.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_SET_RESUME, IGDBJtagConstants.DEFAULT_SET_RESUME));
648
			setResume.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_SET_RESUME, IGDBJtagConstants.DEFAULT_SET_RESUME));
649
			
650
			// Run Commands
651
			runCommands.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, IGDBJtagConstants.DEFAULT_RUN_COMMANDS));
652
653
			String programName = CDebugUtils.getProgramName(configuration);
654
			if (programName != null) {
655
				int lastSlash = programName.indexOf('\\');
656
				if (lastSlash >= 0) {
657
					programName = programName.substring(lastSlash + 1);
658
				}
659
				lastSlash = programName.indexOf('/');
660
				if (lastSlash >= 0) {
661
					programName = programName.substring(lastSlash + 1);
662
				}
663
				projBinaryLabel1.setText(programName);
664
				projBinaryLabel2.setText(programName);
665
			}
666
		
667
			doResetChanged();
668
			loadImageChanged();
669
			loadSymbolsChanged();
670
			pcRegisterChanged();
671
			stopAtChanged();
576
			resumeChanged();
672
			resumeChanged();
577
			runCommands.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, "")); //$NON-NLS-1$)
673
			updateUseFileEnablement();
674
			
578
		} catch (CoreException e) {
675
		} catch (CoreException e) {
579
			Activator.getDefault().getLog().log(e.getStatus());
676
			Activator.getDefault().getLog().log(e.getStatus());
580
		}
677
		}
581
	}
678
	}
582
679
680
	/* (non-Javadoc)
681
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
682
	 */
583
	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
683
	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
584
		configuration.setAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, initCommands.getText());
684
		
585
		configuration.setAttribute(IGDBJtagConstants.ATTR_DELAY, Integer.parseInt(delay.getText()));
685
		// Initialization Commands
586
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_RESET, doReset.getSelection());
686
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_RESET, doReset.getSelection());
687
		configuration.setAttribute(IGDBJtagConstants.ATTR_DELAY, Integer.parseInt(delay.getText()));
587
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_HALT, doHalt.getSelection());
688
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_HALT, doHalt.getSelection());
689
		configuration.setAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, initCommands.getText());
690
		
691
		// Load Image...
588
		configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, loadImage.getSelection());
692
		configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, loadImage.getSelection());
693
		configuration.setAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE, useProjectBinaryForImage.getSelection());
694
		configuration.setAttribute(IGDBJtagConstants.ATTR_USE_FILE_FOR_IMAGE, useFileForImage.getSelection());
589
		configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, imageFileName.getText().trim());
695
		configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, imageFileName.getText().trim());
590
		configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, imageOffset.getText());
696
		configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, imageOffset.getText());
697
		
698
		//.. and Symbols
591
		configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, loadSymbols.getSelection());
699
		configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, loadSymbols.getSelection());
592
		configuration.setAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, symbolsOffset.getText());
700
		configuration.setAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS, useProjectBinaryForSymbols.getSelection());
701
		configuration.setAttribute(IGDBJtagConstants.ATTR_USE_FILE_FOR_SYMBOLS, useFileForSymbols.getSelection());
593
		configuration.setAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, symbolsFileName.getText().trim());
702
		configuration.setAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, symbolsFileName.getText().trim());
703
		configuration.setAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, symbolsOffset.getText());
704
		
705
		// Runtime Options
594
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, setPcRegister.getSelection());
706
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, setPcRegister.getSelection());
595
		configuration.setAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, pcRegister.getText());
707
		configuration.setAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, pcRegister.getText());
596
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, setStopAt.getSelection());
708
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, setStopAt.getSelection());
597
		configuration.setAttribute(IGDBJtagConstants.ATTR_STOP_AT, stopAt.getText());
709
		configuration.setAttribute(IGDBJtagConstants.ATTR_STOP_AT, stopAt.getText());
598
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_RESUME, setResume.getSelection());
710
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_RESUME, setResume.getSelection());
711
		
712
		// Run Commands
599
		configuration.setAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, runCommands.getText());
713
		configuration.setAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, runCommands.getText());
600
	}
714
	}
601
715
716
	/* (non-Javadoc)
717
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
718
	 */
602
	public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
719
	public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
603
		configuration.setAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, ""); //$NON-NLS-1$
720
		// Initialization Commands
721
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET);
722
		configuration.setAttribute(IGDBJtagConstants.ATTR_DELAY, IGDBJtagConstants.DEFAULT_DELAY);
723
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_HALT, IGDBJtagConstants.DEFAULT_DO_HALT);
724
		configuration.setAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, IGDBJtagConstants.DEFAULT_INIT_COMMANDS);
725
726
		// Load Image...
604
		configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE);
727
		configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE);
605
		configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, ""); //$NON-NLS-1$
728
		configuration.setAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_IMAGE);
606
		configuration.setAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, ""); //$NON-NLS-1$
729
		configuration.setAttribute(IGDBJtagConstants.ATTR_USE_FILE_FOR_IMAGE, IGDBJtagConstants.DEFAULT_USE_FILE_FOR_IMAGE);
607
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_RESET, true);
730
		configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, IGDBJtagConstants.DEFAULT_IMAGE_FILE_NAME);
608
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_HALT, true);
731
		configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET);
609
	}
732
733
		//.. and Symbols
734
		configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS);
735
		configuration.setAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_SYMBOLS);
736
		configuration.setAttribute(IGDBJtagConstants.ATTR_USE_FILE_FOR_SYMBOLS, IGDBJtagConstants.DEFAULT_USE_FILE_FOR_SYMBOLS);
737
		configuration.setAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, IGDBJtagConstants.DEFAULT_SYMBOLS_FILE_NAME);
738
		configuration.setAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, IGDBJtagConstants.DEFAULT_SYMBOLS_OFFSET);
739
		
740
		// Runtime Options
741
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER);
742
		configuration.setAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, IGDBJtagConstants.DEFAULT_PC_REGISTER);
743
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT);
744
		configuration.setAttribute(IGDBJtagConstants.ATTR_STOP_AT, IGDBJtagConstants.DEFAULT_STOP_AT);
745
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_RESUME, IGDBJtagConstants.DEFAULT_SET_RESUME);
610
746
747
		// Run Commands
748
		configuration.setAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, IGDBJtagConstants.DEFAULT_RUN_COMMANDS); 
749
	}
611
}
750
}
(-)src/org/eclipse/cdt/debug/gdbjtag/ui/JtagUi.properties (+3 lines)
Lines 31-36 Link Here
31
GDBJtagStartupTab.symbolsFileBrowseWs_Title=Select symbols file
31
GDBJtagStartupTab.symbolsFileBrowseWs_Title=Select symbols file
32
GDBJtagStartupTab.symbolsFileBrowse_Title=Select symbols file
32
GDBJtagStartupTab.symbolsFileBrowse_Title=Select symbols file
33
GDBJtagStartupTab.symbolsOffsetLabel_Text=Symbols offset (hex):
33
GDBJtagStartupTab.symbolsOffsetLabel_Text=Symbols offset (hex):
34
GDBJtagStartupTab.useProjectBinary_Label=Use project binary:
35
GDBJtagStartupTab.useFile_Label=Use file:
36
GDBJtagStartupTab.useProjectBinary_ToolTip=Use C/C++ application specified in the Main tab.
34
37
35
GDBJtagStartupTab.runOptionGroup_Text=Runtime Options
38
GDBJtagStartupTab.runOptionGroup_Text=Runtime Options
36
GDBJtagStartupTab.setPcRegister_Text=Set program counter at (hex):
39
GDBJtagStartupTab.setPcRegister_Text=Set program counter at (hex):
(-)src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java (-53 / +9 lines)
Lines 398-404 Link Here
398
	 */
398
	 */
399
	@Deprecated
399
	@Deprecated
400
	protected IFile getProgramFile(ILaunchConfiguration config) throws CoreException {
400
	protected IFile getProgramFile(ILaunchConfiguration config) throws CoreException {
401
		ICProject cproject = verifyCProject(config);
401
		ICProject cproject = CDebugUtils.verifyCProject(config);
402
		String fileName = CDebugUtils.getProgramName(config);
402
		String fileName = CDebugUtils.getProgramName(config);
403
		if (fileName == null) {
403
		if (fileName == null) {
404
			abort(LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_not_specified"), null, //$NON-NLS-1$
404
			abort(LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_not_specified"), null, //$NON-NLS-1$
Lines 417-478 Link Here
417
		return programPath;
417
		return programPath;
418
	}
418
	}
419
419
420
	/**
421
	 * @deprecated use {@link CDebugUtils#verifyCProject(ILaunchConfiguration)}
422
	 */
420
	protected ICProject verifyCProject(ILaunchConfiguration config) throws CoreException {
423
	protected ICProject verifyCProject(ILaunchConfiguration config) throws CoreException {
421
		String name = CDebugUtils.getProjectName(config);
424
		return CDebugUtils.verifyCProject(config);
422
		if (name == null) {
423
			abort(LaunchMessages.getString("AbstractCLaunchDelegate.C_Project_not_specified"), null, //$NON-NLS-1$
424
					ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROJECT);
425
		}
426
		ICProject cproject = CDebugUtils.getCProject(config);
427
		if (cproject == null) {
428
			IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
429
			if (!proj.exists()) {
430
				abort(
431
						LaunchMessages.getFormattedString("AbstractCLaunchDelegate.Project_NAME_does_not_exist", name), null, //$NON-NLS-1$
432
						ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
433
			} else if (!proj.isOpen()) {
434
				abort(LaunchMessages.getFormattedString("AbstractCLaunchDelegate.Project_NAME_is_closed", name), null, //$NON-NLS-1$
435
						ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
436
			}
437
			abort(LaunchMessages.getString("AbstractCLaunchDelegate.Not_a_C_CPP_project"), null, //$NON-NLS-1$
438
					ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
439
		}
440
		return cproject;
441
	}
425
	}
442
426
427
	/**
428
	 * @deprecated use {@link CDebugUtils#verifyProgramPath(ILaunchConfiguration)
429
	 */
443
	protected IPath verifyProgramPath(ILaunchConfiguration config) throws CoreException {
430
	protected IPath verifyProgramPath(ILaunchConfiguration config) throws CoreException {
444
		ICProject cproject = verifyCProject(config);
431
		return CDebugUtils.verifyProgramPath(config);
445
		IPath programPath = CDebugUtils.getProgramPath(config);
446
		if (programPath == null || programPath.isEmpty()) {
447
			abort(LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_not_specified"), null, //$NON-NLS-1$
448
					ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROGRAM);
449
		}
450
		if (!programPath.isAbsolute()) {
451
			IPath location = cproject.getProject().getLocation();
452
			if (location != null) {
453
				programPath = location.append(programPath);
454
				if (!programPath.toFile().exists()) {
455
					// Try the old way, which is required to support linked resources.
456
					IFile projFile = null;
457
					try {
458
						projFile = project.getFile(CDebugUtils.getProgramPath(config));
459
					}
460
					catch (IllegalArgumentException exc) {}	// thrown if relative path that resolves to a root file (e.g., "..\somefile")
461
					if (projFile != null && projFile.exists()) {
462
						programPath = projFile.getLocation();
463
					}
464
				}
465
			}
466
		}
467
		if (!programPath.toFile().exists()) {
468
			abort(
469
					LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_does_not_exist"), //$NON-NLS-1$
470
					new FileNotFoundException(
471
							LaunchMessages.getFormattedString(
472
																"AbstractCLaunchDelegate.PROGRAM_PATH_not_found", programPath.toOSString())), //$NON-NLS-1$
473
					ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
474
		}
475
		return programPath;
476
	}
432
	}
477
433
478
	protected IPath verifyProgramFile(ILaunchConfiguration config) throws CoreException {
434
	protected IPath verifyProgramFile(ILaunchConfiguration config) throws CoreException {
(-)src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java (-2 / +2 lines)
Lines 53-60 Link Here
53
		}
53
		}
54
		try {
54
		try {
55
			monitor.worked(1);
55
			monitor.worked(1);
56
			IPath exePath = verifyProgramPath(config);
56
			IPath exePath = CDebugUtils.verifyProgramPath(config);
57
			ICProject project = verifyCProject(config);
57
			ICProject project = CDebugUtils.verifyCProject(config);
58
			IBinaryObject exeFile = verifyBinary(project, exePath);
58
			IBinaryObject exeFile = verifyBinary(project, exePath);
59
59
60
			ICDebugConfiguration debugConfig = getDebugConfig(config);
60
			ICDebugConfiguration debugConfig = getDebugConfig(config);
(-)src/org/eclipse/cdt/launch/internal/LocalAttachLaunchDelegate.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2006 QNX Software Systems and others.
2
 * Copyright (c) 2004, 2010 QNX Software Systems and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 62-68 Link Here
62
		}
62
		}
63
		try {
63
		try {
64
			monitor.worked(1);
64
			monitor.worked(1);
65
			ICProject cproject = verifyCProject(config);
65
			ICProject cproject = CDebugUtils.verifyCProject(config);
66
			IPath exePath = CDebugUtils.getProgramPath(config);
66
			IPath exePath = CDebugUtils.getProgramPath(config);
67
			if (exePath != null && !exePath.isEmpty()) {
67
			if (exePath != null && !exePath.isEmpty()) {
68
				if (!exePath.isAbsolute()) {
68
				if (!exePath.isAbsolute()) {
(-)src/org/eclipse/cdt/launch/internal/LocalCDILaunchDelegate.java (-12 / +13 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2009 QNX Software Systems and others.
2
 * Copyright (c) 2004, 2010 QNX Software Systems and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 23-28 Link Here
23
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
23
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
24
import org.eclipse.cdt.core.model.ICProject;
24
import org.eclipse.cdt.core.model.ICProject;
25
import org.eclipse.cdt.debug.core.CDIDebugModel;
25
import org.eclipse.cdt.debug.core.CDIDebugModel;
26
import org.eclipse.cdt.debug.core.CDebugUtils;
26
import org.eclipse.cdt.debug.core.ICDIDebugger;
27
import org.eclipse.cdt.debug.core.ICDIDebugger;
27
import org.eclipse.cdt.debug.core.ICDIDebugger2;
28
import org.eclipse.cdt.debug.core.ICDIDebugger2;
28
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
29
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
Lines 80-86 Link Here
80
		}
81
		}
81
		monitor.worked( 1 );
82
		monitor.worked( 1 );
82
		try {
83
		try {
83
			IPath exePath = verifyProgramPath( config );
84
			IPath exePath = CDebugUtils.verifyProgramPath( config );
84
			File wd = getWorkingDirectory( config );
85
			File wd = getWorkingDirectory( config );
85
			if ( wd == null ) {
86
			if ( wd == null ) {
86
				wd = new File( System.getProperty( "user.home", "." ) ); //$NON-NLS-1$ //$NON-NLS-2$
87
				wd = new File( System.getProperty( "user.home", "." ) ); //$NON-NLS-1$ //$NON-NLS-2$
Lines 130-137 Link Here
130
		monitor.subTask( LaunchMessages.getString( "LocalCDILaunchDelegate.2" ) ); //$NON-NLS-1$
131
		monitor.subTask( LaunchMessages.getString( "LocalCDILaunchDelegate.2" ) ); //$NON-NLS-1$
131
		ICDISession dsession = null;
132
		ICDISession dsession = null;
132
		try {
133
		try {
133
			IPath exePath = verifyProgramPath( config );
134
			IPath exePath = CDebugUtils.verifyProgramPath( config );
134
			ICProject project = verifyCProject( config );
135
			ICProject project = CDebugUtils.verifyCProject( config );
135
			IBinaryObject exeFile = null;
136
			IBinaryObject exeFile = null;
136
			if ( exePath != null ) {
137
			if ( exePath != null ) {
137
				exeFile = verifyBinary( project, exePath );
138
				exeFile = verifyBinary( project, exePath );
Lines 201-211 Link Here
201
			}
202
			}
202
			cancel( "", -1 ); //$NON-NLS-1$
203
			cancel( "", -1 ); //$NON-NLS-1$
203
		}
204
		}
204
		IPath exePath = verifyProgramPath( config );
205
		IPath exePath = CDebugUtils.verifyProgramPath( config );
205
		if (exePath == null) {
206
		if (exePath == null) {
206
			exePath= getProgramPathForPid(pid);
207
			exePath= getProgramPathForPid(pid);
207
		}
208
		}
208
		ICProject project = verifyCProject( config );
209
		ICProject project = CDebugUtils.verifyCProject( config );
209
		IBinaryObject exeFile = null;
210
		IBinaryObject exeFile = null;
210
		if ( exePath != null ) {
211
		if ( exePath != null ) {
211
			exeFile = verifyBinary( project, exePath );
212
			exeFile = verifyBinary( project, exePath );
Lines 273-279 Link Here
273
		ICDebugConfiguration debugConfig = getDebugConfig( config );
274
		ICDebugConfiguration debugConfig = getDebugConfig( config );
274
		String path = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, (String)null );
275
		String path = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, (String)null );
275
		if ( path == null || path.length() == 0) {
276
		if ( path == null || path.length() == 0) {
276
			ICProject project = verifyCProject( config );
277
			ICProject project = CDebugUtils.verifyCProject( config );
277
			IPath corefile = promptForCoreFilePath( (IProject)project.getResource(), debugConfig );
278
			IPath corefile = promptForCoreFilePath( (IProject)project.getResource(), debugConfig );
278
			if ( corefile == null ) {
279
			if ( corefile == null ) {
279
				cancel( LaunchMessages.getString( "LocalCDILaunchDelegate.6" ), ICDTLaunchConfigurationConstants.ERR_NO_COREFILE ); //$NON-NLS-1$
280
				cancel( LaunchMessages.getString( "LocalCDILaunchDelegate.6" ), ICDTLaunchConfigurationConstants.ERR_NO_COREFILE ); //$NON-NLS-1$
Lines 289-296 Link Here
289
			cancel( "", -1 ); //$NON-NLS-1$
290
			cancel( "", -1 ); //$NON-NLS-1$
290
		}
291
		}
291
292
292
		IPath exePath = verifyProgramPath( config );
293
		IPath exePath = CDebugUtils.verifyProgramPath( config );
293
		ICProject project = verifyCProject( config );
294
		ICProject project = CDebugUtils.verifyCProject( config );
294
		IBinaryObject exeFile = null;
295
		IBinaryObject exeFile = null;
295
		if ( exePath != null ) {
296
		if ( exePath != null ) {
296
			exeFile = verifyBinary( project, exePath );
297
			exeFile = verifyBinary( project, exePath );
Lines 329-336 Link Here
329
330
330
	private ICDISession launchOldDebugSession( ILaunchConfiguration config, ILaunch launch, ICDIDebugger debugger, IProgressMonitor monitor ) throws CoreException {
331
	private ICDISession launchOldDebugSession( ILaunchConfiguration config, ILaunch launch, ICDIDebugger debugger, IProgressMonitor monitor ) throws CoreException {
331
		IBinaryObject exeFile = null;
332
		IBinaryObject exeFile = null;
332
		IPath exePath = verifyProgramPath( config );
333
		IPath exePath = CDebugUtils.verifyProgramPath( config );
333
		ICProject project = verifyCProject( config );
334
		ICProject project = CDebugUtils.verifyCProject( config );
334
		if ( exePath != null ) {
335
		if ( exePath != null ) {
335
			exeFile = verifyBinary( project, exePath );
336
			exeFile = verifyBinary( project, exePath );
336
		}
337
		}
Lines 338-344 Link Here
338
	}
339
	}
339
340
340
	private ICDISession launchDebugSession( ILaunchConfiguration config, ILaunch launch, ICDIDebugger2 debugger, IProgressMonitor monitor ) throws CoreException {
341
	private ICDISession launchDebugSession( ILaunchConfiguration config, ILaunch launch, ICDIDebugger2 debugger, IProgressMonitor monitor ) throws CoreException {
341
		IPath path = verifyProgramPath( config );
342
		IPath path = CDebugUtils.verifyProgramPath( config );
342
		File exeFile = path != null ? path.toFile() : null;
343
		File exeFile = path != null ? path.toFile() : null;
343
		return debugger.createSession( launch, exeFile, monitor );
344
		return debugger.createSession( launch, exeFile, monitor );
344
	}
345
	}
(-)src/org/eclipse/cdt/launch/internal/LocalRunLaunchDelegate.java (-3 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2006 QNX Software Systems and others.
2
 * Copyright (c) 2005, 2010 QNX Software Systems and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 18-23 Link Here
18
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
18
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
19
import org.eclipse.cdt.core.model.ICProject;
19
import org.eclipse.cdt.core.model.ICProject;
20
import org.eclipse.cdt.debug.core.CDIDebugModel;
20
import org.eclipse.cdt.debug.core.CDIDebugModel;
21
import org.eclipse.cdt.debug.core.CDebugUtils;
21
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
22
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
22
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
23
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
23
import org.eclipse.cdt.debug.core.cdi.CDIException;
24
import org.eclipse.cdt.debug.core.cdi.CDIException;
Lines 57-64 Link Here
57
		}
58
		}
58
		try {
59
		try {
59
			monitor.worked(1);
60
			monitor.worked(1);
60
			IPath exePath = verifyProgramPath(config);
61
			IPath exePath = CDebugUtils.verifyProgramPath(config);
61
			ICProject project = verifyCProject(config);
62
			ICProject project = CDebugUtils.verifyCProject(config);
62
			if (exePath != null) {
63
			if (exePath != null) {
63
				exeFile = verifyBinary(project, exePath);
64
				exeFile = verifyBinary(project, exePath);
64
			}
65
			}

Return to bug 310304