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 22-27 Link Here
22
import java.util.List;
22
import java.util.List;
23
import java.util.Properties;
23
import java.util.Properties;
24
24
25
import org.eclipse.cdt.debug.core.CDebugUtils;
25
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContribution;
26
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContribution;
26
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContributionFactory;
27
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContributionFactory;
27
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice;
28
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice;
Lines 345-351 Link Here
345
            // Below steps are specific to JTag hardware debugging
346
            // Below steps are specific to JTag hardware debugging
346
            
347
            
347
        /*
348
        /*
348
         * Retrieve the JTag device
349
         * Retrieve the IGDBJtagDevice instance
349
         */
350
         */
350
        new Step() {
351
        new Step() {
351
			@Override
352
			@Override
Lines 365-370 Link Here
365
				rm.done();
366
				rm.done();
366
            }},
367
            }},
367
        /*
368
        /*
369
         * Execute symbol loading
370
         */
371
        new Step() {
372
			@Override
373
			public void execute(RequestMonitor rm) {
374
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
375
				try {
376
					if (config.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS)) {
377
						String symbolsFileName = null;
378
379
						// New setting in Helios. Default is true. Check for existence
380
						// in order to support older launch configs
381
						if (config.hasAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS) &&
382
								config.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_SYMBOLS)) {
383
							IPath programFile = CDebugUtils.verifyProgramPath(config);
384
							if (programFile != null) {
385
								symbolsFileName = programFile.toOSString();
386
							}
387
						}
388
						else {
389
							symbolsFileName = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, IGDBJtagConstants.DEFAULT_SYMBOLS_FILE_NAME);
390
							if (symbolsFileName.length() > 0) {
391
								symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName);
392
							} else {
393
								symbolsFileName = null;
394
							}
395
						}
396
						
397
						if (symbolsFileName == null) {
398
		        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, Messages.getString("GDBJtagDebugger.err_no_img_file"), null)); //$NON-NLS-1$
399
		        			rm.done();
400
		        			return;
401
						}
402
403
						// Escape windows path separator characters TWICE, once for Java and once for GDB.						
404
						symbolsFileName = symbolsFileName.replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
405
406
						String symbolsOffset = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, IGDBJtagConstants.DEFAULT_SYMBOLS_OFFSET);
407
						if (symbolsOffset.length() > 0) {
408
							symbolsOffset = "0x" + symbolsOffset;					
409
						}
410
						List<String> commands = new ArrayList<String>();
411
						fGdbJtagDevice.doLoadSymbol(symbolsFileName, symbolsOffset, commands);
412
						queueCommands(commands, rm);									
413
						
414
					} else {
415
						rm.done();
416
					}
417
				} catch (CoreException e) {
418
        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot load symbol", e)); //$NON-NLS-1$
419
        			rm.done();
420
				}
421
			}},
422
423
        /*
368
         * Hook up to remote target
424
         * Hook up to remote target
369
         */
425
         */
370
        new Step() {
426
        new Step() {
Lines 394-400 Link Here
394
			public void execute(RequestMonitor rm) {
450
			public void execute(RequestMonitor rm) {
395
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
451
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
396
				try {
452
				try {
397
					if (config.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, true)) {
453
					if (config.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET)) {
398
						List<String> commands = new ArrayList<String>();
454
						List<String> commands = new ArrayList<String>();
399
						fGdbJtagDevice.doReset(commands);
455
						fGdbJtagDevice.doReset(commands);
400
						queueCommands(commands, rm);
456
						queueCommands(commands, rm);
Lines 431-437 Link Here
431
			public void execute(RequestMonitor rm) {
487
			public void execute(RequestMonitor rm) {
432
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
488
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
433
				try {
489
				try {
434
					if (config.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, true)) {
490
					if (config.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, IGDBJtagConstants.DEFAULT_DO_HALT)) {
435
						List<String> commands = new ArrayList<String>();
491
						List<String> commands = new ArrayList<String>();
436
						fGdbJtagDevice.doHalt(commands);
492
						fGdbJtagDevice.doHalt(commands);
437
						queueCommands(commands, rm);								
493
						queueCommands(commands, rm);								
Lines 451-466 Link Here
451
			public void execute(RequestMonitor rm) {
507
			public void execute(RequestMonitor rm) {
452
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
508
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
453
				try {
509
				try {
454
					String userCmd = config.getAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, ""); //$NON-NLS-1$
510
					String userCmd = config.getAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, IGDBJtagConstants.DEFAULT_INIT_COMMANDS);
455
					userCmd = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(userCmd);
511
					userCmd = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(userCmd);
456
					String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
512
					if (userCmd.length() > 0) {
457
					
513
						String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
458
					CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
514
						
459
					crm.setDoneCount(commands.length);
515
						CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
460
					for (int i = 0; i < commands.length; ++i) {
516
						crm.setDoneCount(commands.length);
461
						fCommandControl.queueCommand(
517
						for (int i = 0; i < commands.length; ++i) {
462
						    new CLICommand<MIInfo>(fCommandControl.getContext(), commands[i]),
518
							fCommandControl.queueCommand(
463
						    new DataRequestMonitor<MIInfo>(getExecutor(), crm));
519
							    new CLICommand<MIInfo>(fCommandControl.getContext(), commands[i]),
520
							    new DataRequestMonitor<MIInfo>(getExecutor(), crm));
521
						}
522
					}
523
					else {
524
						rm.done();
464
					}
525
					}
465
				} catch (CoreException e) {
526
				} catch (CoreException e) {
466
        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot run user defined init commands", e)); //$NON-NLS-1$
527
        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot run user defined init commands", e)); //$NON-NLS-1$
Lines 475-494 Link Here
475
			public void execute(RequestMonitor rm) {
536
			public void execute(RequestMonitor rm) {
476
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
537
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
477
				try {
538
				try {
539
					String imageFileName = null;
478
					if (config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE)) {
540
					if (config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE)) {
479
						// Escape windows path separator characters TWICE, once for Java and once for GDB.
541
						// New setting in Helios. Default is true. Check for existence
480
						String imageFileName = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, ""); //$NON-NLS-1$
542
						// in order to support older launch configs
481
						if (imageFileName.length() > 0) {
543
						if (config.hasAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE) &&
482
							imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName).replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
544
								config.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_IMAGE)) {
483
							String imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
545
							IPath programFile = CDebugUtils.verifyProgramPath(config);
484
							List<String> commands = new ArrayList<String>();
546
							if (programFile != null) {
485
							fGdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
547
								imageFileName = programFile.toOSString();
486
							queueCommands(commands, rm);									
548
							}
487
						} else {
488
							rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Image name cannot be empty", null)); //$NON-NLS-1$
489
							rm.done();
490
						}
549
						}
491
					} else {
550
						else {
551
							imageFileName = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, IGDBJtagConstants.DEFAULT_IMAGE_FILE_NAME); //$NON-NLS-1$
552
							if (imageFileName.length() > 0) {
553
								imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName);
554
							} else {
555
								imageFileName = null;
556
							}
557
						}
558
						
559
						if (imageFileName == null) {
560
		        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, Messages.getString("GDBJtagDebugger.err_no_img_file"), null)); //$NON-NLS-1$
561
		        			rm.done();
562
		        			return;
563
						}
564
565
						// Escape windows path separator characters TWICE, once for Java and once for GDB.						
566
						imageFileName = imageFileName.replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
567
568
						String imageOffset = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET);
569
						if (imageOffset.length() > 0) {
570
							imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET); //$NON-NLS-2$ //$NON-NLS-4$					
571
						}
572
						List<String> commands = new ArrayList<String>();
573
						fGdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
574
						queueCommands(commands, rm);									
575
					} 
576
					else {
492
						rm.done();
577
						rm.done();
493
					}
578
					}
494
				} catch (CoreException e) {
579
				} catch (CoreException e) {
Lines 496-531 Link Here
496
        			rm.done();
581
        			rm.done();
497
				}
582
				}
498
			}},
583
			}},
499
        /*
500
         * Execute symbol loading
501
         */
502
        new Step() {
503
			@Override
504
			public void execute(RequestMonitor rm) {
505
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
506
				try {
507
					if (config.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS)) {
508
						// Escape windows path separator characters TWICE, once for Java and once for GDB.
509
						String symbolsFileName = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, ""); //$NON-NLS-1$
510
						if (symbolsFileName.length() > 0) {
511
							symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName).replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
512
							String symbolsOffset = "0x" + config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, ""); //$NON-NLS-1$ //$NON-NLS-2$
513
							List<String> commands = new ArrayList<String>();
514
							fGdbJtagDevice.doLoadSymbol(symbolsFileName, symbolsOffset, commands);
515
							queueCommands(commands, rm);									
516
						} else {
517
							rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Symbol name cannot be empty", null)); //$NON-NLS-1$
518
							rm.done();
519
						}
520
					} else {
521
						rm.done();
522
					}
523
				} catch (CoreException e) {
524
        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot load symbol", e)); //$NON-NLS-1$
525
        			rm.done();
526
				}
527
			}
528
        },
529
        /* 
584
        /* 
530
         * Start tracking the breakpoints once we know we are connected to the target (necessary for remote debugging) 
585
         * Start tracking the breakpoints once we know we are connected to the target (necessary for remote debugging) 
531
         */
586
         */
Lines 550-556 Link Here
550
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
605
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
551
				try {
606
				try {
552
					if (config.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER)) {
607
					if (config.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER)) {
553
						String pcRegister = config.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, "")); //$NON-NLS-1$
608
						String pcRegister = config.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_PC_REGISTER)); //$NON-NLS-1$
554
						List<String> commands = new ArrayList<String>();
609
						List<String> commands = new ArrayList<String>();
555
						fGdbJtagDevice.doSetPC(pcRegister, commands);
610
						fGdbJtagDevice.doSetPC(pcRegister, commands);
556
						queueCommands(commands, rm);								
611
						queueCommands(commands, rm);								
Lines 571-577 Link Here
571
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
626
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
572
				try {
627
				try {
573
					if (config.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT)) {
628
					if (config.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT)) {
574
						String stopAt = config.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, ""); //$NON-NLS-1$
629
						String stopAt = config.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, IGDBJtagConstants.DEFAULT_STOP_AT); //$NON-NLS-1$
575
						List<String> commands = new ArrayList<String>();
630
						List<String> commands = new ArrayList<String>();
576
						fGdbJtagDevice.doStopAt(stopAt, commands);
631
						fGdbJtagDevice.doStopAt(stopAt, commands);
577
						queueCommands(commands, rm);								
632
						queueCommands(commands, rm);								
Lines 612-627 Link Here
612
			public void execute(RequestMonitor rm) {
667
			public void execute(RequestMonitor rm) {
613
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
668
				ILaunchConfiguration config = fLaunch.getLaunchConfiguration();
614
				try {
669
				try {
615
					String userCmd = config.getAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, ""); //$NON-NLS-1$
670
					String userCmd = config.getAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, IGDBJtagConstants.DEFAULT_RUN_COMMANDS); //$NON-NLS-1$
616
					userCmd = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(userCmd);
671
					if (userCmd.length() > 0) {
617
					String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
672
						userCmd = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(userCmd);
618
					
673
						String[] commands = userCmd.split("\\r?\\n"); //$NON-NLS-1$
619
					CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
674
						
620
					crm.setDoneCount(commands.length);
675
						CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
621
					for (int i = 0; i < commands.length; ++i) {
676
						crm.setDoneCount(commands.length);
622
						fCommandControl.queueCommand(
677
						for (int i = 0; i < commands.length; ++i) {
623
						    new CLICommand<MIInfo>(fCommandControl.getContext(), commands[i]),
678
							fCommandControl.queueCommand(
624
						    new DataRequestMonitor<MIInfo>(getExecutor(), crm));
679
							    new CLICommand<MIInfo>(fCommandControl.getContext(), commands[i]),
680
							    new DataRequestMonitor<MIInfo>(getExecutor(), crm));
681
						}
682
					}
683
					else {
684
						rm.done();
625
					}
685
					}
626
				} catch (CoreException e) {
686
				} catch (CoreException e) {
627
        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot run user defined run commands", e)); //$NON-NLS-1$
687
        			rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot run user defined run commands", e)); //$NON-NLS-1$
Lines 687-698 Link Here
687
	private IGDBJtagDevice getGDBJtagDevice (ILaunchConfiguration config) 
747
	private IGDBJtagDevice getGDBJtagDevice (ILaunchConfiguration config) 
688
	throws CoreException, NullPointerException {
748
	throws CoreException, NullPointerException {
689
		IGDBJtagDevice gdbJtagDevice = null;
749
		IGDBJtagDevice gdbJtagDevice = null;
690
		String jtagDeviceName = config.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, ""); //$NON-NLS-1$
750
		String jtagDeviceName = config.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, IGDBJtagConstants.DEFAULT_JTAG_DEVICE); //$NON-NLS-1$
691
		GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.
751
		GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance().getGDBJtagDeviceContribution();
692
			getInstance().getGDBJtagDeviceContribution();
752
		for (GDBJtagDeviceContribution availableDevice : availableDevices) {
693
		for (int i = 0; i < availableDevices.length; i++) {
753
			if (jtagDeviceName.equals(availableDevice.getDeviceName())) {
694
			if (jtagDeviceName.equals(availableDevices[i].getDeviceName())) {
754
				gdbJtagDevice = availableDevice.getDevice();
695
				gdbJtagDevice = availableDevices[i].getDevice();
696
				break;
755
				break;
697
			}
756
			}
698
		}
757
		}
(-)src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java (-29 / +90 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 16-24 Link Here
16
import java.io.File;
16
import java.io.File;
17
import java.util.ArrayList;
17
import java.util.ArrayList;
18
import java.util.List;
18
import java.util.List;
19
20
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
19
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
21
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
20
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
21
import org.eclipse.cdt.debug.core.CDebugUtils;
22
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
22
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
23
import org.eclipse.cdt.debug.core.cdi.ICDISession;
23
import org.eclipse.cdt.debug.core.cdi.ICDISession;
24
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
24
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
Lines 36-41 Link Here
36
import org.eclipse.cdt.debug.mi.core.command.MIGDBSetNewConsole;
36
import org.eclipse.cdt.debug.mi.core.command.MIGDBSetNewConsole;
37
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
37
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
38
import org.eclipse.core.runtime.CoreException;
38
import org.eclipse.core.runtime.CoreException;
39
import org.eclipse.core.runtime.IPath;
39
import org.eclipse.core.runtime.IProgressMonitor;
40
import org.eclipse.core.runtime.IProgressMonitor;
40
import org.eclipse.core.runtime.IStatus;
41
import org.eclipse.core.runtime.IStatus;
41
import org.eclipse.core.runtime.MultiStatus;
42
import org.eclipse.core.runtime.MultiStatus;
Lines 111-125 Link Here
111
112
112
			List<String> commands = new ArrayList<String>();
113
			List<String> commands = new ArrayList<String>();
113
114
114
			// hook up to remote target
115
			if (submonitor.isCanceled()) {
115
			if (submonitor.isCanceled()) {
116
				throw new OperationCanceledException();
116
				throw new OperationCanceledException();
117
			}
117
			}
118
			
119
			// execute symbol load
120
			boolean doLoadSymbols = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS);
121
			if (doLoadSymbols) {
122
				String symbolsFileName = null;
123
				// New setting in Helios. Default is true. Check for existence
124
				// in order to support older launch configs
125
				if (config.hasAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS) &&
126
						config.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_SYMBOLS)) {
127
					IPath programFile = CDebugUtils.verifyProgramPath(config);
128
					if (programFile != null) {
129
						symbolsFileName = programFile.toOSString();
130
					}
131
				}
132
				else {
133
					symbolsFileName = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, IGDBJtagConstants.DEFAULT_SYMBOLS_FILE_NAME);
134
					if (symbolsFileName.length() > 0) {
135
						symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName);
136
					}
137
				}
138
				if (symbolsFileName == null) {
139
					// The launch config GUI should prevent this from happening, but just in case					
140
					throw new CoreException(new Status( IStatus.ERROR,
141
							Activator.getUniqueIdentifier(),
142
							-1, Messages.getString("GDBJtagDebugger.err_no_sym_file"), null));
143
				}
144
145
				// Escape windows path separator characters TWICE, once for Java and once for GDB.
146
				symbolsFileName = symbolsFileName.replace("\\", "\\\\");
147
148
				String symbolsOffset = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, IGDBJtagConstants.DEFAULT_SYMBOLS_OFFSET);
149
				if (symbolsOffset.length() > 0) {
150
					symbolsOffset = "0x" + symbolsOffset;					
151
				}
152
				commands.clear();
153
				gdbJtagDevice.doLoadSymbol(symbolsFileName, symbolsOffset, commands);
154
				monitor.beginTask(Messages.getString("GDBJtagDebugger.loading_symbols"), 1); //$NON-NLS-1$				
155
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15));
156
			}
157
158
			if (submonitor.isCanceled()) {
159
				throw new OperationCanceledException();
160
			}
161
162
			// hook up to remote target
118
			boolean useRemote = config.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET);
163
			boolean useRemote = config.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET);
119
			if (useRemote) {
164
			if (useRemote) {
120
				submonitor.subTask(Messages.getString("GDBJtagDebugger.2")); //$NON-NLS-1$
165
				submonitor.subTask(Messages.getString("GDBJtagDebugger.2")); //$NON-NLS-1$
121
				String ipAddress = config.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, IGDBJtagConstants.DEFAULT_IP_ADDRESS);
166
				String ipAddress = config.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, IGDBJtagConstants.DEFAULT_IP_ADDRESS);
122
				int portNumber = config.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER);
167
				int portNumber = config.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER);
168
				commands.clear();
123
				gdbJtagDevice.doRemote(ipAddress, portNumber, commands);
169
				gdbJtagDevice.doRemote(ipAddress, portNumber, commands);
124
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(10));
170
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(10));
125
				if (submonitor.isCanceled()) {
171
				if (submonitor.isCanceled()) {
Lines 132-138 Link Here
132
			submonitor.setWorkRemaining(80); // compensate for optional work above
178
			submonitor.setWorkRemaining(80); // compensate for optional work above
133
179
134
			// Run device-specific code to reset the board
180
			// Run device-specific code to reset the board
135
			if (config.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, true)) {
181
			if (config.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET)) {
136
				commands.clear();
182
				commands.clear();
137
				gdbJtagDevice.doReset(commands);
183
				gdbJtagDevice.doReset(commands);
138
				int defaultDelay = gdbJtagDevice.getDefaultDelay();
184
				int defaultDelay = gdbJtagDevice.getDefaultDelay();
Lines 142-148 Link Here
142
			submonitor.setWorkRemaining(65); // compensate for optional work above
188
			submonitor.setWorkRemaining(65); // compensate for optional work above
143
189
144
			// Run device-specific code to halt the board
190
			// Run device-specific code to halt the board
145
			if (config.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, true)) {
191
			if (config.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, IGDBJtagConstants.DEFAULT_DO_HALT)) {
146
				commands.clear();
192
				commands.clear();
147
				gdbJtagDevice.doHalt(commands);
193
				gdbJtagDevice.doHalt(commands);
148
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15));
194
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15));
Lines 155-185 Link Here
155
			// execute load
201
			// execute load
156
			boolean doLoad = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE);
202
			boolean doLoad = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE);
157
			if (doLoad) {
203
			if (doLoad) {
204
				String imageFileName = null;
205
206
				// New setting in Helios. Default is true. Check for existence
207
				// in order to support older launch configs
208
				if (config.hasAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE) &&
209
						config.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_IMAGE)) {
210
					IPath programFile = CDebugUtils.verifyProgramPath(config);
211
					if (programFile != null) {
212
						imageFileName = programFile.toOSString();
213
					}
214
				}
215
				else {
216
					imageFileName = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, IGDBJtagConstants.DEFAULT_IMAGE_FILE_NAME);
217
					if (imageFileName.length() > 0) {
218
						imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName);
219
					}
220
				}
221
				if (imageFileName == null) {
222
					// The launch config GUI should prevent this from happening, but just in case
223
					throw new CoreException(new Status( IStatus.ERROR,
224
							Activator.getUniqueIdentifier(),
225
							-1, Messages.getString("GDBJtagDebugger.err_no_img_file"), null));
226
				}
227
158
				// Escape windows path separator characters TWICE, once for Java and once for GDB.
228
				// Escape windows path separator characters TWICE, once for Java and once for GDB.
159
				String imageFileName = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, ""); //$NON-NLS-1$
229
				imageFileName = imageFileName.replace("\\", "\\\\");
160
				if (imageFileName.length() > 0) {
230
161
					monitor.beginTask(Messages.getString("GDBJtagDebugger.5"), 1); //$NON-NLS-1$
231
				String imageOffset = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET);
162
					imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName).replace("\\", "\\\\");
232
				if (imageOffset.length() > 0) {
163
					String imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, ""); //$NON-NLS-2$ //$NON-NLS-4$
233
					imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET);					
164
					commands.clear();
165
					gdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
166
					executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
167
				}
234
				}
235
				
236
				commands.clear();
237
				gdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
238
				monitor.beginTask(Messages.getString("GDBJtagDebugger.loading_image"), 1); //$NON-NLS-1$
239
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
168
			}
240
			}
169
			submonitor.setWorkRemaining(15); // compensate for optional work above
241
			submonitor.setWorkRemaining(15); // compensate for optional work above
170
242
171
			// execute symbol load
172
			boolean doLoadSymbols = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS);
173
			if (doLoadSymbols) {
174
				String symbolsFileName = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, ""); //$NON-NLS-1$
175
				if (symbolsFileName.length() > 0) {
176
					symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName).replace("\\", "\\\\");
177
					String symbolsOffset = "0x" + config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, ""); //$NON-NLS-2$
178
					commands.clear();
179
					gdbJtagDevice.doLoadSymbol(symbolsFileName, symbolsOffset, commands);
180
					executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15));
181
				}
182
			}
183
		} catch (OperationCanceledException e) {
243
		} catch (OperationCanceledException e) {
184
			if (launch != null && launch.canTerminate()) {
244
			if (launch != null && launch.canTerminate()) {
185
				launch.terminate();
245
				launch.terminate();
Lines 212-218 Link Here
212
			// Set program counter
272
			// Set program counter
213
			boolean setPc = config.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER);
273
			boolean setPc = config.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER);
214
			if (setPc) {
274
			if (setPc) {
215
				String pcRegister = config.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, "")); //$NON-NLS-1$
275
				String pcRegister = config.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_PC_REGISTER)); //$NON-NLS-1$
216
				gdbJtagDevice.doSetPC(pcRegister, commands);
276
				gdbJtagDevice.doSetPC(pcRegister, commands);
217
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
277
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
218
			}
278
			}
Lines 222-228 Link Here
222
			monitor.beginTask(Messages.getString("GDBJtagDebugger.18"), 1); //$NON-NLS-1$
282
			monitor.beginTask(Messages.getString("GDBJtagDebugger.18"), 1); //$NON-NLS-1$
223
			boolean setStopAt = config.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT);
283
			boolean setStopAt = config.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT);
224
			if (setStopAt) {
284
			if (setStopAt) {
225
				String stopAt = config.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, ""); //$NON-NLS-1$
285
				String stopAt = config.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, IGDBJtagConstants.DEFAULT_STOP_AT); //$NON-NLS-1$
226
				commands.clear();
286
				commands.clear();
227
				gdbJtagDevice.doStopAt(stopAt, commands);
287
				gdbJtagDevice.doStopAt(stopAt, commands);
228
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
288
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
Lines 249-255 Link Here
249
	private void executeGDBScript(String script, MISession miSession, 
309
	private void executeGDBScript(String script, MISession miSession, 
250
			IProgressMonitor monitor) throws CoreException {
310
			IProgressMonitor monitor) throws CoreException {
251
		// Try to execute any extra command
311
		// Try to execute any extra command
252
		if (script == null)
312
		if (script == null || script.length() == 0)
253
			return;
313
			return;
254
		script = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(script);
314
		script = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(script);
255
		String[] commands = script.split("\\r?\\n");
315
		String[] commands = script.split("\\r?\\n");
Lines 292-298 Link Here
292
	private IGDBJtagDevice getGDBJtagDevice (ILaunchConfiguration config) 
352
	private IGDBJtagDevice getGDBJtagDevice (ILaunchConfiguration config) 
293
		throws CoreException, NullPointerException {
353
		throws CoreException, NullPointerException {
294
		IGDBJtagDevice gdbJtagDevice = null;
354
		IGDBJtagDevice gdbJtagDevice = null;
295
		String jtagDeviceName = config.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, ""); //$NON-NLS-1$
355
		String jtagDeviceName = config.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, IGDBJtagConstants.DEFAULT_JTAG_DEVICE); //$NON-NLS-1$
296
		GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.
356
		GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.
297
			getInstance().getGDBJtagDeviceContribution();
357
			getInstance().getGDBJtagDeviceContribution();
298
		for (int i = 0; i < availableDevices.length; i++) {
358
		for (int i = 0; i < availableDevices.length; i++) {
Lines 313-316 Link Here
313
		}
373
		}
314
		return sb.toString();
374
		return sb.toString();
315
	}
375
	}
376
	
316
}
377
}
(-)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 47-61 Link Here
47
	public static final String ATTR_STOP_AT = Activator.PLUGIN_ID + ".stopAt"; //$NON-NLS-1$
47
	public static final String ATTR_STOP_AT = Activator.PLUGIN_ID + ".stopAt"; //$NON-NLS-1$
48
	public static final String ATTR_SET_RESUME = Activator.PLUGIN_ID + ".setResume"; //$NON-NLS-1$
48
	public static final String ATTR_SET_RESUME = Activator.PLUGIN_ID + ".setResume"; //$NON-NLS-1$
49
	public static final String ATTR_RUN_COMMANDS = Activator.PLUGIN_ID + ".runCommands"; //$NON-NLS-1$
49
	public static final String ATTR_RUN_COMMANDS = Activator.PLUGIN_ID + ".runCommands"; //$NON-NLS-1$
50
	
50
	/** @since 7.0 */ public static final String ATTR_USE_PROJ_BINARY_FOR_IMAGE = Activator.PLUGIN_ID + ".useProjBinaryForImage"; //$NON-NLS-1$
51
	/** @since 7.0 */ public static final String ATTR_USE_FILE_FOR_IMAGE = Activator.PLUGIN_ID + ".useFileForImage"; //$NON-NLS-1$
52
	/** @since 7.0 */ public static final String ATTR_USE_PROJ_BINARY_FOR_SYMBOLS = Activator.PLUGIN_ID + ".useProjBinaryForSymbols"; //$NON-NLS-1$
53
	/** @since 7.0 */ public static final String ATTR_USE_FILE_FOR_SYMBOLS = Activator.PLUGIN_ID + ".useFileForSymbols"; //$NON-NLS-1$
54
51
	public static final boolean DEFAULT_DO_RESET = true;
55
	public static final boolean DEFAULT_DO_RESET = true;
52
	public static final boolean DEFAULT_DO_HALT = true;
56
	public static final boolean DEFAULT_DO_HALT = true;
53
	public static final int DEFAULT_DELAY = 3;
57
	public static final int DEFAULT_DELAY = 3;
54
	public static final boolean DEFAULT_LOAD_IMAGE = false;
58
	public static final boolean DEFAULT_LOAD_IMAGE = true;
55
	public static final boolean DEFAULT_LOAD_SYMBOLS = false;
59
	public static final boolean DEFAULT_LOAD_SYMBOLS = true;
56
	public static final boolean DEFAULT_SET_PC_REGISTER = false;
60
	public static final boolean DEFAULT_SET_PC_REGISTER = false;
57
	public static final boolean DEFAULT_SET_STOP_AT = false;
61
	public static final boolean DEFAULT_SET_STOP_AT = false;
58
	public static final boolean DEFAULT_SET_RESUME = false;
62
	public static final boolean DEFAULT_SET_RESUME = false;
59
	public static final boolean DEFAULT_USE_DEFAULT_RUN = true;
63
	public static final boolean DEFAULT_USE_DEFAULT_RUN = true;
60
		
64
65
	/** @since 7.0 */ public static final String DEFAULT_INIT_COMMANDS = ""; //$NON-NLS-1$
66
	/** @since 7.0 */ public static final String DEFAULT_IMAGE_FILE_NAME = ""; //$NON-NLS-1$
67
	/** @since 7.0 */ public static final String DEFAULT_SYMBOLS_FILE_NAME = ""; //$NON-NLS-1$
68
	/** @since 7.0 */ public static final String DEFAULT_RUN_COMMANDS = ""; //$NON-NLS-1$
69
	/** @since 7.0 */ public static final boolean DEFAULT_USE_PROJ_BINARY_FOR_IMAGE = true;
70
	/** @since 7.0 */ public static final boolean DEFAULT_USE_FILE_FOR_IMAGE = false;
71
	/** @since 7.0 */ public static final boolean DEFAULT_USE_PROJ_BINARY_FOR_SYMBOLS = true;
72
	/** @since 7.0 */ public static final boolean DEFAULT_USE_FILE_FOR_SYMBOLS = false;
73
	/** @since 7.0 */ public static final String DEFAULT_IMAGE_OFFSET = ""; //$NON-NLS-1$
74
	/** @since 7.0 */ public static final String DEFAULT_SYMBOLS_OFFSET = ""; //$NON-NLS-1$
75
	/** @since 7.0 */ public static final String DEFAULT_PC_REGISTER = ""; //$NON-NLS-1$
76
	/** @since 7.0 */ public static final String DEFAULT_STOP_AT = ""; //$NON-NLS-1$
77
	/** @since 7.0 */ public static final String DEFAULT_JTAG_DEVICE = ""; //$NON-NLS-1$
78
	
61
}
79
}
(-)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 / +21 lines)
Lines 72-79 Link Here
72
	 */
72
	 */
73
	public void doLoadImage(String imageFileName, String imageOffset, Collection commands) {
73
	public void doLoadImage(String imageFileName, String imageOffset, Collection commands) {
74
		String file = escapeScpaces(imageFileName);
74
		String file = escapeScpaces(imageFileName);
75
		String cmd = "restore " + file + " " + imageOffset;
75
		
76
		addCmd(commands, cmd);
76
		if (imageOffset.length() > 0) {
77
			// 'restore' simply puts the program into memory. 
78
			addCmd(commands, "restore " + file + " " + imageOffset);
79
		}
80
		else {
81
			// 'load' puts the program into memory and sets the PC. To see why
82
			// we do this when no offset is specified, see
83
			// https://bugs.eclipse.org/bugs/show_bug.cgi?id=310304#c20
84
			addCmd(commands, "load " + file);			
85
		}
86
		
87
		// 'exec-file' specifies the program as the context for getting memory.
88
		// Basically, it tells gdb "this is the program we'll be debugging"
89
		addCmd(commands, "exec-file " + file);
77
	}
90
	}
78
91
79
	/* (non-Javadoc)
92
	/* (non-Javadoc)
Lines 81-88 Link Here
81
	 */
94
	 */
82
	public void doLoadSymbol(String symbolFileName, String symbolOffset, Collection commands) {
95
	public void doLoadSymbol(String symbolFileName, String symbolOffset, Collection commands) {
83
		String file = escapeScpaces(symbolFileName);
96
		String file = escapeScpaces(symbolFileName);
84
		String cmd = "add-sym " + file + " " + symbolOffset;
97
		if (symbolOffset == null || (symbolOffset.length() == 0)) {
85
		addCmd(commands, cmd);
98
			addCmd(commands, "symbol-file " + file);
99
		}
100
		else {
101
			addCmd(commands, "add-sym " + file + " " + symbolOffset);			
102
		}
86
	}
103
	}
87
	
104
	
88
	protected String escapeScpaces(String file) {
105
	protected String escapeScpaces(String file) {
(-)src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java (-4 / +4 lines)
Lines 141-147 Link Here
141
		gdbCommand.setLayoutData(gd);
141
		gdbCommand.setLayoutData(gd);
142
		gdbCommand.addModifyListener(new ModifyListener() {
142
		gdbCommand.addModifyListener(new ModifyListener() {
143
			public void modifyText(ModifyEvent e) {
143
			public void modifyText(ModifyEvent e) {
144
				updateLaunchConfigurationDialog();
144
				scheduleUpdateJob();
145
			}
145
			}
146
		});
146
		});
147
147
Lines 199-205 Link Here
199
		jtagDevice.addModifyListener(new ModifyListener() {
199
		jtagDevice.addModifyListener(new ModifyListener() {
200
			public void modifyText(ModifyEvent e) {
200
			public void modifyText(ModifyEvent e) {
201
				updateDeviceIpPort(jtagDevice.getText());
201
				updateDeviceIpPort(jtagDevice.getText());
202
				updateLaunchConfigurationDialog();
202
				scheduleUpdateJob();
203
			}
203
			}
204
		});
204
		});
205
205
Lines 211-217 Link Here
211
		ipAddress.setLayoutData(gd);
211
		ipAddress.setLayoutData(gd);
212
		ipAddress.addModifyListener(new ModifyListener() {
212
		ipAddress.addModifyListener(new ModifyListener() {
213
			public void modifyText(ModifyEvent e) {
213
			public void modifyText(ModifyEvent e) {
214
				updateLaunchConfigurationDialog();
214
				scheduleUpdateJob();
215
			}
215
			}
216
		});
216
		});
217
217
Lines 228-234 Link Here
228
		});
228
		});
229
		portNumber.addModifyListener(new ModifyListener() {
229
		portNumber.addModifyListener(new ModifyListener() {
230
			public void modifyText(ModifyEvent e) {
230
			public void modifyText(ModifyEvent e) {
231
				updateLaunchConfigurationDialog();
231
				scheduleUpdateJob();
232
			}
232
			}
233
		});
233
		});
234
	}
234
	}
(-)src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDebuggerTab.java (-6 / +6 lines)
Lines 146-152 Link Here
146
		gdbCommand.setLayoutData(gd);
146
		gdbCommand.setLayoutData(gd);
147
		gdbCommand.addModifyListener(new ModifyListener() {
147
		gdbCommand.addModifyListener(new ModifyListener() {
148
			public void modifyText(ModifyEvent e) {
148
			public void modifyText(ModifyEvent e) {
149
				updateLaunchConfigurationDialog();
149
				scheduleUpdateJob();
150
			}
150
			}
151
		});
151
		});
152
152
Lines 186-192 Link Here
186
		commandFactory.addModifyListener(new ModifyListener() {
186
		commandFactory.addModifyListener(new ModifyListener() {
187
			public void modifyText(ModifyEvent e) {
187
			public void modifyText(ModifyEvent e) {
188
				commandFactoryChanged();
188
				commandFactoryChanged();
189
				updateLaunchConfigurationDialog();
189
				scheduleUpdateJob();
190
			}
190
			}
191
		});
191
		});
192
	}
192
	}
Lines 201-207 Link Here
201
		miProtocol = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN);
201
		miProtocol = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN);
202
		miProtocol.addModifyListener(new ModifyListener() {
202
		miProtocol.addModifyListener(new ModifyListener() {
203
			public void modifyText(ModifyEvent e) {
203
			public void modifyText(ModifyEvent e) {
204
				updateLaunchConfigurationDialog();
204
				scheduleUpdateJob();
205
			}
205
			}
206
		});
206
		});
207
	}
207
	}
Lines 272-278 Link Here
272
		jtagDevice.addModifyListener(new ModifyListener() {
272
		jtagDevice.addModifyListener(new ModifyListener() {
273
			public void modifyText(ModifyEvent e) {
273
			public void modifyText(ModifyEvent e) {
274
				updateDeviceIpPort(jtagDevice.getText());
274
				updateDeviceIpPort(jtagDevice.getText());
275
				updateLaunchConfigurationDialog();
275
				scheduleUpdateJob();
276
			}
276
			}
277
		});
277
		});
278
		
278
		
Lines 284-290 Link Here
284
		ipAddress.setLayoutData(gd);
284
		ipAddress.setLayoutData(gd);
285
		ipAddress.addModifyListener(new ModifyListener() {
285
		ipAddress.addModifyListener(new ModifyListener() {
286
			public void modifyText(ModifyEvent e) {
286
			public void modifyText(ModifyEvent e) {
287
				updateLaunchConfigurationDialog();
287
				scheduleUpdateJob();
288
			}
288
			}
289
		});
289
		});
290
		
290
		
Lines 301-307 Link Here
301
		});
301
		});
302
		portNumber.addModifyListener(new ModifyListener() {
302
		portNumber.addModifyListener(new ModifyListener() {
303
			public void modifyText(ModifyEvent e) {
303
			public void modifyText(ModifyEvent e) {
304
				updateLaunchConfigurationDialog();
304
				scheduleUpdateJob();
305
			}
305
			}
306
		});
306
		});
307
	}
307
	}
(-)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 28-33 Link Here
28
GDBJtagStartupTab.symbolsFileBrowseWs_Title=Select symbols file
28
GDBJtagStartupTab.symbolsFileBrowseWs_Title=Select symbols file
29
GDBJtagStartupTab.symbolsFileBrowse_Title=Select symbols file
29
GDBJtagStartupTab.symbolsFileBrowse_Title=Select symbols file
30
GDBJtagStartupTab.symbolsOffsetLabel_Text=Symbols offset (hex):
30
GDBJtagStartupTab.symbolsOffsetLabel_Text=Symbols offset (hex):
31
GDBJtagStartupTab.useProjectBinary_Label=Use project binary:
32
GDBJtagStartupTab.useFile_Label=Use file:
33
GDBJtagStartupTab.useProjectBinary_ToolTip=Use C/C++ application specified in the Main tab.
31
34
32
GDBJtagStartupTab.runOptionGroup_Text=Runtime Options
35
GDBJtagStartupTab.runOptionGroup_Text=Runtime Options
33
GDBJtagStartupTab.setPcRegister_Text=Set program counter at (hex):
36
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