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/gdbjtag/core/GDBJtagDebugger.java (-21 / +96 lines)
Lines 18-24 Link Here
18
import java.util.List;
18
import java.util.List;
19
19
20
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
20
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
21
import org.eclipse.cdt.core.model.ICProject;
21
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
22
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
23
import org.eclipse.cdt.debug.core.CDebugUtils;
22
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
24
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
23
import org.eclipse.cdt.debug.core.cdi.ICDISession;
25
import org.eclipse.cdt.debug.core.cdi.ICDISession;
24
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
26
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
Lines 35-41 Link Here
35
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
37
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
36
import org.eclipse.cdt.debug.mi.core.command.MIGDBSetNewConsole;
38
import org.eclipse.cdt.debug.mi.core.command.MIGDBSetNewConsole;
37
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
39
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
40
import org.eclipse.core.resources.IFile;
38
import org.eclipse.core.runtime.CoreException;
41
import org.eclipse.core.runtime.CoreException;
42
import org.eclipse.core.runtime.IPath;
39
import org.eclipse.core.runtime.IProgressMonitor;
43
import org.eclipse.core.runtime.IProgressMonitor;
40
import org.eclipse.core.runtime.IStatus;
44
import org.eclipse.core.runtime.IStatus;
41
import org.eclipse.core.runtime.MultiStatus;
45
import org.eclipse.core.runtime.MultiStatus;
Lines 115-120 Link Here
115
			if (submonitor.isCanceled()) {
119
			if (submonitor.isCanceled()) {
116
				throw new OperationCanceledException();
120
				throw new OperationCanceledException();
117
			}
121
			}
122
			
123
			// execute symbol load
124
			boolean doLoadSymbols = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS);
125
			if (doLoadSymbols) {
126
				String symbolsFileName = null;
127
				if (config.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_SYMBOLS)) {
128
					IPath programFile = getProgramFile(config);
129
					if (programFile != null) {
130
						symbolsFileName = programFile.toOSString();
131
					}
132
				}
133
				else {
134
					symbolsFileName = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, IGDBJtagConstants.DEFAULT_IMAGE_FILE_NAME);
135
					if (symbolsFileName.length() > 0) {
136
						monitor.beginTask(Messages.getString("GDBJtagDebugger.5"), 1); //$NON-NLS-1$
137
						symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName);
138
					}
139
				}
140
				if (symbolsFileName == null) {
141
					throw new CoreException(new Status( IStatus.ERROR,
142
							Activator.getUniqueIdentifier(),
143
							-1, "symbols file not specified", null));
144
				}
145
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
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15));
155
			}
156
			
118
			boolean useRemote = config.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET);
157
			boolean useRemote = config.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET);
119
			if (useRemote) {
158
			if (useRemote) {
120
				submonitor.subTask(Messages.getString("GDBJtagDebugger.2")); //$NON-NLS-1$
159
				submonitor.subTask(Messages.getString("GDBJtagDebugger.2")); //$NON-NLS-1$
Lines 155-185 Link Here
155
			// execute load
194
			// execute load
156
			boolean doLoad = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE);
195
			boolean doLoad = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE);
157
			if (doLoad) {
196
			if (doLoad) {
158
				// Escape windows path separator characters TWICE, once for Java and once for GDB.
197
				String imageFileName = null;
159
				String imageFileName = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, ""); //$NON-NLS-1$
198
				if (config.getAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_IMAGE)) {
160
				if (imageFileName.length() > 0) {
199
					IPath programFile = getProgramFile(config);
161
					monitor.beginTask(Messages.getString("GDBJtagDebugger.5"), 1); //$NON-NLS-1$
200
					if (programFile != null) {
162
					imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName).replace("\\", "\\\\");
201
						imageFileName = programFile.toOSString();
163
					String imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, ""); //$NON-NLS-2$ //$NON-NLS-4$
202
					}
164
					commands.clear();
165
					gdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
166
					executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
167
				}
203
				}
204
				else {
205
					imageFileName = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, IGDBJtagConstants.DEFAULT_IMAGE_FILE_NAME);
206
					if (imageFileName.length() > 0) {
207
						monitor.beginTask(Messages.getString("GDBJtagDebugger.5"), 1); //$NON-NLS-1$
208
						imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName);
209
					}
210
				}
211
				if (imageFileName == null) {
212
					throw new CoreException(new Status( IStatus.ERROR,
213
							Activator.getUniqueIdentifier(),
214
							-1, "image file not specified", null));
215
				}
216
				
217
				imageFileName = imageFileName.replace("\\", "\\\\");
218
				
219
				String imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, ""); //$NON-NLS-2$ //$NON-NLS-4$
220
				commands.clear();
221
				gdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
222
				executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
168
			}
223
			}
169
			submonitor.setWorkRemaining(15); // compensate for optional work above
224
			submonitor.setWorkRemaining(15); // compensate for optional work above
170
225
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) {
226
		} catch (OperationCanceledException e) {
184
			if (launch != null && launch.canTerminate()) {
227
			if (launch != null && launch.canTerminate()) {
185
				launch.terminate();
228
				launch.terminate();
Lines 313-316 Link Here
313
		}
356
		}
314
		return sb.toString();
357
		return sb.toString();
315
	}
358
	}
359
	
360
	private static IPath getProgramFile(ILaunchConfiguration config) throws CoreException {
361
362
		IPath programPath = CDebugUtils.getProgramPath(config);
363
		if (programPath != null & programPath.isEmpty()) {
364
			return null;
365
		}
366
367
		if (!programPath.isAbsolute()) {
368
			ICProject cproject = CDebugUtils.getCProject(config);
369
			if (cproject == null) {
370
				return null;
371
			}
372
		
373
			IPath location = cproject.getProject().getLocation();
374
			if (location != null) {
375
				programPath = location.append(programPath);
376
				if (!programPath.toFile().exists()) {
377
					// Try the old way, which is required to support linked resources.
378
					IFile projFile = null;
379
					try {
380
						projFile = cproject.getProject().getFile(CDebugUtils.getProgramPath(config));
381
					}
382
					catch (IllegalArgumentException exc) {}	// thrown if relative path that resolves to a root file (e.g., "..\somefile")
383
					if (projFile != null && projFile.exists()) {
384
						programPath = projFile.getLocation();
385
					}
386
				}
387
			}
388
		}
389
		return programPath;
390
	}
316
}
391
}
(-)src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagLaunchConfigurationDelegate.java (-1 / +1 lines)
Lines 51-57 Link Here
51
			ICProject project = verifyCProject(configuration);
51
			ICProject project = verifyCProject(configuration);
52
			IPath exePath = verifyProgramPath(configuration);
52
			IPath exePath = verifyProgramPath(configuration);
53
			File exeFile = exePath != null ? exePath.toFile() : null;
53
			File exeFile = exePath != null ? exePath.toFile() : null;
54
			ICDISession session = debugger.createSession(launch, exeFile, submonitor.newChild(1));
54
			ICDISession session = debugger.createSession(launch, null, submonitor.newChild(1));
55
			IBinaryObject exeBinary = null;
55
			IBinaryObject exeBinary = null;
56
			if ( exePath != null ) {
56
			if ( exePath != null ) {
57
				exeBinary = verifyBinary(project, exePath);
57
				exeBinary = verifyBinary(project, exePath);
(-)src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java (-4 / +21 lines)
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
	
61
}
78
}
(-)src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagDeviceImpl.java (-2 / +13 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
		
76
		// 'restore' simply puts the program into memory. 
75
		String cmd = "restore " + file + " " + imageOffset;
77
		String cmd = "restore " + file + " " + imageOffset;
76
		addCmd(commands, cmd);
78
		addCmd(commands, cmd);
79
		
80
		// 'exec-file' specifies the program as the context for getting memory.
81
		// Basically, it tells gdb "this is the program we'll be debugging"
82
		cmd = "exec-file " + file;
83
		addCmd(commands, cmd);
77
	}
84
	}
78
85
79
	/* (non-Javadoc)
86
	/* (non-Javadoc)
Lines 81-88 Link Here
81
	 */
88
	 */
82
	public void doLoadSymbol(String symbolFileName, String symbolOffset, Collection commands) {
89
	public void doLoadSymbol(String symbolFileName, String symbolOffset, Collection commands) {
83
		String file = escapeScpaces(symbolFileName);
90
		String file = escapeScpaces(symbolFileName);
84
		String cmd = "add-sym " + file + " " + symbolOffset;
91
		if (symbolOffset == null || (symbolOffset.length() == 0)) {
85
		addCmd(commands, cmd);
92
			addCmd(commands, "symbol-file " + file);
93
		}
94
		else {
95
			addCmd(commands, "add-sym " + file + " " + symbolOffset);			
96
		}
86
	}
97
	}
87
	
98
	
88
	protected String escapeScpaces(String file) {
99
	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 (-80 / +216 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
	private Button fUseProjectBinaryForImage;
88
	private Button fUseFileForImage;
89
	private Button fUseProjectBinaryForSymbols;
90
	private Button fUseFileForSymbols;
91
	private Label fImageOffsetLabel;
92
	private Label fSymbolsOffsetLabel;
93
	private Label fProjBinaryLabel1;
94
	private Label fProjBinaryLabel2;
85
95
86
	public String getName() {
96
	public String getName() {
87
		return TAB_NAME;
97
		return TAB_NAME;
Lines 170-176 Link Here
170
		});
180
		});
171
		delay.addModifyListener(new ModifyListener() {
181
		delay.addModifyListener(new ModifyListener() {
172
			public void modifyText(ModifyEvent e) {
182
			public void modifyText(ModifyEvent e) {
173
				updateLaunchConfigurationDialog();
183
				scheduleUpdateJob();
174
			}
184
			}
175
		});
185
		});
176
		
186
		
Lines 197-203 Link Here
197
		initCommands.setLayoutData(gd);
207
		initCommands.setLayoutData(gd);
198
		initCommands.addModifyListener(new ModifyListener() {
208
		initCommands.addModifyListener(new ModifyListener() {
199
			public void modifyText(ModifyEvent evt) {
209
			public void modifyText(ModifyEvent evt) {
200
				updateLaunchConfigurationDialog();
210
				scheduleUpdateJob();
201
			}
211
			}
202
		});
212
		});
203
		
213
		
Lines 231-245 Link Here
231
		comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
241
		comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
232
		comp.setLayout(layout);
242
		comp.setLayout(layout);
233
		
243
		
234
		Label imageLabel = new Label(comp, SWT.NONE);
244
		SelectionListener radioButtonListener = new SelectionListener() {
235
		imageLabel.setText(Messages.getString("GDBJtagStartupTab.imageLabel_Text"));	
245
			public void widgetSelected(SelectionEvent e) {
246
				updateLaunchConfigurationDialog();
247
				updateUseFileEnablement();
248
			}
249
			public void widgetDefaultSelected(SelectionEvent e) {
250
			}
251
		};
252
		
253
		fUseProjectBinaryForImage = new Button(comp, SWT.RADIO);
254
		fUseProjectBinaryForImage.setText("Use project binary:");
255
		gd = new GridData();
256
		gd.horizontalSpan = 1;
257
		fUseProjectBinaryForImage.setLayoutData(gd);
258
		fUseProjectBinaryForImage.addSelectionListener(radioButtonListener);
259
		
260
		fProjBinaryLabel1 = new Label(comp, SWT.NONE);
261
		gd = new GridData(GridData.FILL_HORIZONTAL);
262
		gd.horizontalSpan = 3;
263
		fProjBinaryLabel1.setLayoutData(gd);
264
		
265
		fUseFileForImage = new Button(comp, SWT.RADIO);
266
		fUseFileForImage.setText("Use file:");
267
		gd = new GridData();
268
		gd.horizontalSpan = 1;
269
		fUseFileForImage.setLayoutData(gd);
270
		fUseFileForImage.addSelectionListener(radioButtonListener);		
271
236
		imageFileName = new Text(comp, SWT.BORDER);
272
		imageFileName = new Text(comp, SWT.BORDER);
237
		gd = new GridData(GridData.FILL_HORIZONTAL);
273
		gd = new GridData(GridData.FILL_HORIZONTAL);
238
		gd.horizontalSpan = 1;
274
		gd.horizontalSpan = 1;
239
		imageFileName.setLayoutData(gd);
275
		imageFileName.setLayoutData(gd);
240
		imageFileName.addModifyListener(new ModifyListener() {
276
		imageFileName.addModifyListener(new ModifyListener() {
241
			public void modifyText(ModifyEvent e) {
277
			public void modifyText(ModifyEvent e) {
242
				updateLaunchConfigurationDialog();
278
				scheduleUpdateJob();
243
			}
279
			}
244
		});
280
		});
245
		
281
		
Lines 257-264 Link Here
257
			}
293
			}
258
		});	
294
		});	
259
		
295
		
260
		Label imageOffsetLabel = new Label(comp, SWT.NONE);
296
		fImageOffsetLabel = new Label(comp, SWT.NONE);
261
		imageOffsetLabel.setText(Messages.getString("GDBJtagStartupTab.imageOffsetLabel_Text"));
297
		fImageOffsetLabel.setText(Messages.getString("GDBJtagStartupTab.imageOffsetLabel_Text"));
262
		imageOffset = new Text(comp, SWT.BORDER);
298
		imageOffset = new Text(comp, SWT.BORDER);
263
		gd = new GridData();
299
		gd = new GridData();
264
		gd.horizontalSpan = 1;
300
		gd.horizontalSpan = 1;
Lines 271-280 Link Here
271
		});
307
		});
272
		imageOffset.addModifyListener(new ModifyListener() {
308
		imageOffset.addModifyListener(new ModifyListener() {
273
			public void modifyText(ModifyEvent e) {
309
			public void modifyText(ModifyEvent e) {
274
				updateLaunchConfigurationDialog();
310
				scheduleUpdateJob();
275
			}
311
			}
276
		});
312
		});
277
		
313
		
314
		
278
		loadSymbols = new Button(group, SWT.CHECK);
315
		loadSymbols = new Button(group, SWT.CHECK);
279
		loadSymbols.setText(Messages.getString("GDBJtagStartupTab.loadSymbols_Text"));
316
		loadSymbols.setText(Messages.getString("GDBJtagStartupTab.loadSymbols_Text"));
280
		gd = new GridData();
317
		gd = new GridData();
Lines 292-307 Link Here
292
		layout.numColumns = 4;
329
		layout.numColumns = 4;
293
		comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
330
		comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
294
		comp.setLayout(layout);
331
		comp.setLayout(layout);
332
333
		fUseProjectBinaryForSymbols = new Button(comp, SWT.RADIO);
334
		fUseProjectBinaryForSymbols.setText("Use project binary");
335
		gd = new GridData();
336
		gd.horizontalSpan = 1;
337
		fUseProjectBinaryForSymbols.setLayoutData(gd);
338
		fUseProjectBinaryForSymbols.addSelectionListener(radioButtonListener);
339
		
340
		fProjBinaryLabel2 = new Label(comp, SWT.NONE);
341
		gd = new GridData(GridData.FILL_HORIZONTAL);
342
		gd.horizontalSpan = 3;
343
		fProjBinaryLabel2.setLayoutData(gd);
344
		
345
		fUseFileForSymbols = new Button(comp, SWT.RADIO);
346
		fUseFileForSymbols.setText("Use file:");
347
		gd = new GridData();
348
		gd.horizontalSpan = 1;
349
		fUseFileForSymbols.setLayoutData(gd);
350
		fUseFileForSymbols.addSelectionListener(radioButtonListener);
295
		
351
		
296
		Label symbolLabel = new Label(comp, SWT.NONE);
297
		symbolLabel.setText(Messages.getString("GDBJtagStartupTab.symbolsLabel_Text"));	
298
		symbolsFileName = new Text(comp, SWT.BORDER);
352
		symbolsFileName = new Text(comp, SWT.BORDER);
299
		gd = new GridData(GridData.FILL_HORIZONTAL);
353
		gd = new GridData(GridData.FILL_HORIZONTAL);
300
		gd.horizontalSpan = 1;
354
		gd.horizontalSpan = 1;
301
		symbolsFileName.setLayoutData(gd);
355
		symbolsFileName.setLayoutData(gd);
302
		symbolsFileName.addModifyListener(new ModifyListener() {
356
		symbolsFileName.addModifyListener(new ModifyListener() {
303
			public void modifyText(ModifyEvent e) {
357
			public void modifyText(ModifyEvent e) {
304
				updateLaunchConfigurationDialog();
358
				scheduleUpdateJob();
305
			}
359
			}
306
		});	
360
		});	
307
		
361
		
Lines 319-326 Link Here
319
			}
373
			}
320
		});
374
		});
321
		
375
		
322
		Label symbolsOffsetLabel = new Label(comp, SWT.NONE);
376
		fSymbolsOffsetLabel = new Label(comp, SWT.NONE);
323
		symbolsOffsetLabel.setText(Messages.getString("GDBJtagStartupTab.symbolsOffsetLabel_Text"));
377
		fSymbolsOffsetLabel.setText(Messages.getString("GDBJtagStartupTab.symbolsOffsetLabel_Text"));
324
		symbolsOffset = new Text(comp, SWT.BORDER);
378
		symbolsOffset = new Text(comp, SWT.BORDER);
325
		gd = new GridData();
379
		gd = new GridData();
326
		gd.horizontalSpan = 1;
380
		gd.horizontalSpan = 1;
Lines 333-344 Link Here
333
		});
387
		});
334
		symbolsOffset.addModifyListener(new ModifyListener() {
388
		symbolsOffset.addModifyListener(new ModifyListener() {
335
			public void modifyText(ModifyEvent e) {
389
			public void modifyText(ModifyEvent e) {
336
				updateLaunchConfigurationDialog();
390
				scheduleUpdateJob();
337
			}
391
			}
338
		});
392
		});
339
		
393
		
340
	}
394
	}
341
	
395
	
396
	private void updateUseFileEnablement() {
397
		boolean enabled = loadImage.getSelection() && fUseFileForImage.getSelection();
398
		imageFileName.setEnabled(enabled);
399
		imageFileBrowseWs.setEnabled(enabled);
400
		imageFileBrowse.setEnabled(enabled);
401
		
402
		enabled = loadSymbols.getSelection() && fUseFileForSymbols.getSelection();
403
		symbolsFileName.setEnabled(enabled);
404
		symbolsFileBrowseWs.setEnabled(enabled);
405
		symbolsFileBrowse.setEnabled(enabled);
406
	}
407
342
	public void createRunOptionGroup(Composite parent) {
408
	public void createRunOptionGroup(Composite parent) {
343
		Group group = new Group(parent, SWT.NONE);
409
		Group group = new Group(parent, SWT.NONE);
344
		GridLayout layout = new GridLayout();
410
		GridLayout layout = new GridLayout();
Lines 373-379 Link Here
373
		});
439
		});
374
		pcRegister.addModifyListener(new ModifyListener() {
440
		pcRegister.addModifyListener(new ModifyListener() {
375
			public void modifyText(ModifyEvent e) {
441
			public void modifyText(ModifyEvent e) {
376
				updateLaunchConfigurationDialog();
442
				scheduleUpdateJob();
377
			}
443
			}
378
		});
444
		});
379
		
445
		
Lines 396-402 Link Here
396
		stopAt.setLayoutData(gd);
462
		stopAt.setLayoutData(gd);
397
		stopAt.addModifyListener(new ModifyListener() {
463
		stopAt.addModifyListener(new ModifyListener() {
398
			public void modifyText(ModifyEvent e) {
464
			public void modifyText(ModifyEvent e) {
399
				updateLaunchConfigurationDialog();
465
				scheduleUpdateJob();
400
			}
466
			}
401
		});
467
		});
402
468
Lines 419-436 Link Here
419
485
420
	private void loadImageChanged() {
486
	private void loadImageChanged() {
421
		boolean enabled = loadImage.getSelection();
487
		boolean enabled = loadImage.getSelection();
422
		imageFileName.setEnabled(enabled);
488
		fUseProjectBinaryForImage.setEnabled(enabled);
423
		imageFileBrowseWs.setEnabled(enabled);
489
		fUseFileForImage.setEnabled(enabled);
424
		imageFileBrowse.setEnabled(enabled);
425
		imageOffset.setEnabled(enabled);
490
		imageOffset.setEnabled(enabled);
491
		fImageOffsetLabel.setEnabled(enabled);
492
		updateUseFileEnablement();
426
	}
493
	}
427
	
494
	
428
	private void loadSymbolsChanged() {
495
	private void loadSymbolsChanged() {
429
		boolean enabled = loadSymbols.getSelection();
496
		boolean enabled = loadSymbols.getSelection();
430
		symbolsFileName.setEnabled(enabled);
497
		fUseProjectBinaryForSymbols.setEnabled(enabled);
431
		symbolsFileBrowseWs.setEnabled(enabled);
498
		fUseFileForSymbols.setEnabled(enabled);
432
		symbolsFileBrowse.setEnabled(enabled);
433
		symbolsOffset.setEnabled(enabled);
499
		symbolsOffset.setEnabled(enabled);
500
		fSymbolsOffsetLabel.setEnabled(enabled);
501
		updateUseFileEnablement();		
434
	}
502
	}
435
	
503
	
436
	private void pcRegisterChanged() {
504
	private void pcRegisterChanged() {
Lines 459-465 Link Here
459
		runCommands.setLayoutData(gd);
527
		runCommands.setLayoutData(gd);
460
		runCommands.addModifyListener(new ModifyListener() {
528
		runCommands.addModifyListener(new ModifyListener() {
461
			public void modifyText(ModifyEvent evt) {
529
			public void modifyText(ModifyEvent evt) {
462
				updateLaunchConfigurationDialog();
530
				scheduleUpdateJob();
463
			}
531
			}
464
		});
532
		});
465
	}
533
	}
Lines 474-513 Link Here
474
		setMessage(null);
542
		setMessage(null);
475
543
476
		if (loadImage.getSelection()) {
544
		if (loadImage.getSelection()) {
477
			if (imageFileName.getText().trim().length() == 0) {
545
			if (!fUseProjectBinaryForImage.getSelection()) {
478
				setErrorMessage(Messages.getString("GDBJtagStartupTab.imageFileName_not_specified"));
546
				if (imageFileName.getText().trim().length() == 0) {
479
				return false;
547
					setErrorMessage(Messages.getString("GDBJtagStartupTab.imageFileName_not_specified"));
480
			}
548
					return false;
481
549
				}
482
			String path;
550
	
483
			try {
551
				try {
484
				path = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName.getText().trim());
552
					String path = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName.getText().trim());
485
				IPath filePath = new Path(path);
553
					IPath filePath = new Path(path);
486
				if (!filePath.toFile().exists()) {
554
					if (!filePath.toFile().exists()) {
555
						setErrorMessage(Messages.getString("GDBJtagStartupTab.imageFileName_does_not_exist"));
556
						return false;
557
					}
558
				} catch (CoreException e) { // string substitution throws this if expression doesn't resolve 
487
					setErrorMessage(Messages.getString("GDBJtagStartupTab.imageFileName_does_not_exist"));
559
					setErrorMessage(Messages.getString("GDBJtagStartupTab.imageFileName_does_not_exist"));
488
					return false;
560
					return false;
489
				}
561
				}
490
			} catch (CoreException e) {
491
				Activator.getDefault().getLog().log(e.getStatus());
492
			}
562
			}
493
		} else {
563
		} else {
494
			setErrorMessage(null);
564
			setErrorMessage(null);
495
		}
565
		}
496
		if (loadSymbols.getSelection()) {
566
		if (loadSymbols.getSelection()) {
497
			if (symbolsFileName.getText().trim().length() == 0) {
567
			if (!fUseProjectBinaryForSymbols.getSelection()) {
498
				setErrorMessage(Messages.getString("GDBJtagStartupTab.symbolsFileName_not_specified"));
568
				if (symbolsFileName.getText().trim().length() == 0) {
499
				return false;
569
					setErrorMessage(Messages.getString("GDBJtagStartupTab.symbolsFileName_not_specified"));
500
			}
570
					return false;
501
			String path;
571
				}
502
			try {
572
			
503
				path = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName.getText().trim());
573
				try {
504
				IPath filePath = new Path(path);
574
					String path = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName.getText().trim());
505
				if (!filePath.toFile().exists()) {
575
					IPath filePath = new Path(path);
576
					if (!filePath.toFile().exists()) {
577
						setErrorMessage(Messages.getString("GDBJtagStartupTab.symbolsFileName_does_not_exist"));
578
						return false;
579
					}
580
				} catch (CoreException e) { // string substitution throws this if expression doesn't resolve 
506
					setErrorMessage(Messages.getString("GDBJtagStartupTab.symbolsFileName_does_not_exist"));
581
					setErrorMessage(Messages.getString("GDBJtagStartupTab.symbolsFileName_does_not_exist"));
507
					return false;
582
					return false;
508
				}
583
				}
509
			} catch (CoreException e) {
510
				Activator.getDefault().getLog().log(e.getStatus());
511
			}
584
			}
512
		} else {
585
		} else {
513
			setErrorMessage(null);
586
			setErrorMessage(null);
Lines 540-611 Link Here
540
	}
613
	}
541
	
614
	
542
	/* (non-Javadoc)
615
	/* (non-Javadoc)
543
	 * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
616
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
544
	 */
617
	 */
545
//	protected void updateLaunchConfigurationDialog() {
546
//		super.updateLaunchConfigurationDialog();
547
//		isValid(getLaunchConfigurationDialog());
548
//	}
549
	
550
	public void initializeFrom(ILaunchConfiguration configuration) {
618
	public void initializeFrom(ILaunchConfiguration configuration) {
551
		try {
619
		try {
552
			initCommands.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, "")); //$NON-NLS-1$
620
			// Initialization Commands
553
			doReset.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET));
621
			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)));
622
			delay.setText(String.valueOf(configuration.getAttribute(IGDBJtagConstants.ATTR_DELAY, IGDBJtagConstants.DEFAULT_DELAY)));
623
			doHalt.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, IGDBJtagConstants.DEFAULT_DO_HALT));
624
			initCommands.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, IGDBJtagConstants.DEFAULT_INIT_COMMANDS));
625
			
626
			// Load Image...
557
			loadImage.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE));
627
			loadImage.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE));
558
			loadImageChanged();
628
			fUseProjectBinaryForImage.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$
629
			fUseFileForImage.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_USE_FILE_FOR_IMAGE, IGDBJtagConstants.DEFAULT_USE_FILE_FOR_IMAGE));
560
			if (defaultImageFileName.equals("")) {
630
			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$
631
			imageOffset.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET));
562
			}
632
			
563
			imageFileName.setText(defaultImageFileName);
633
			//.. 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));
634
			loadSymbols.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS));
566
			loadSymbolsChanged();
635
			fUseProjectBinaryForSymbols.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$
636
			fUseFileForSymbols.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$
637
			symbolsFileName.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, IGDBJtagConstants.DEFAULT_SYMBOLS_FILE_NAME));
638
			symbolsOffset.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, IGDBJtagConstants.DEFAULT_SYMBOLS_OFFSET));
639
			
640
			// Runtime Options
569
			setPcRegister.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER));
641
			setPcRegister.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER));
570
			pcRegisterChanged();
642
			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));
643
			setStopAt.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT));
573
			stopAtChanged();
644
			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));
645
			setResume.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_SET_RESUME, IGDBJtagConstants.DEFAULT_SET_RESUME));
646
			
647
			// Run Commands
648
			runCommands.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, IGDBJtagConstants.DEFAULT_RUN_COMMANDS));
649
650
			String programName = CDebugUtils.getProgramName(configuration);
651
			if (programName != null) {
652
				int lastSlash = programName.indexOf('\\');
653
				if (lastSlash >= 0) {
654
					programName = programName.substring(lastSlash + 1);
655
				}
656
				lastSlash = programName.indexOf('/');
657
				if (lastSlash >= 0) {
658
					programName = programName.substring(lastSlash + 1);
659
				}
660
				fProjBinaryLabel1.setText(programName);
661
				fProjBinaryLabel2.setText(programName);
662
			}
663
		
664
			doResetChanged();
665
			loadImageChanged();
666
			loadSymbolsChanged();
667
			pcRegisterChanged();
668
			stopAtChanged();
576
			resumeChanged();
669
			resumeChanged();
577
			runCommands.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, "")); //$NON-NLS-1$)
670
			updateUseFileEnablement();
671
			
578
		} catch (CoreException e) {
672
		} catch (CoreException e) {
579
			Activator.getDefault().getLog().log(e.getStatus());
673
			Activator.getDefault().getLog().log(e.getStatus());
580
		}
674
		}
581
	}
675
	}
582
676
677
	/* (non-Javadoc)
678
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
679
	 */
583
	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
680
	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
584
		configuration.setAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, initCommands.getText());
681
		
585
		configuration.setAttribute(IGDBJtagConstants.ATTR_DELAY, Integer.parseInt(delay.getText()));
682
		// Initialization Commands
586
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_RESET, doReset.getSelection());
683
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_RESET, doReset.getSelection());
684
		configuration.setAttribute(IGDBJtagConstants.ATTR_DELAY, Integer.parseInt(delay.getText()));
587
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_HALT, doHalt.getSelection());
685
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_HALT, doHalt.getSelection());
686
		configuration.setAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, initCommands.getText());
687
		
688
		// Load Image...
588
		configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, loadImage.getSelection());
689
		configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, loadImage.getSelection());
690
		configuration.setAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_IMAGE, fUseProjectBinaryForImage.getSelection());
691
		configuration.setAttribute(IGDBJtagConstants.ATTR_USE_FILE_FOR_IMAGE, fUseFileForImage.getSelection());
589
		configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, imageFileName.getText().trim());
692
		configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, imageFileName.getText().trim());
590
		configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, imageOffset.getText());
693
		configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, imageOffset.getText());
694
		
695
		//.. and Symbols
591
		configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, loadSymbols.getSelection());
696
		configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, loadSymbols.getSelection());
592
		configuration.setAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, symbolsOffset.getText());
697
		configuration.setAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS, fUseProjectBinaryForSymbols.getSelection());
698
		configuration.setAttribute(IGDBJtagConstants.ATTR_USE_FILE_FOR_SYMBOLS, fUseFileForSymbols.getSelection());
593
		configuration.setAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, symbolsFileName.getText().trim());
699
		configuration.setAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, symbolsFileName.getText().trim());
700
		configuration.setAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, symbolsOffset.getText());
701
		
702
		// Runtime Options
594
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, setPcRegister.getSelection());
703
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, setPcRegister.getSelection());
595
		configuration.setAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, pcRegister.getText());
704
		configuration.setAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, pcRegister.getText());
596
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, setStopAt.getSelection());
705
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, setStopAt.getSelection());
597
		configuration.setAttribute(IGDBJtagConstants.ATTR_STOP_AT, stopAt.getText());
706
		configuration.setAttribute(IGDBJtagConstants.ATTR_STOP_AT, stopAt.getText());
598
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_RESUME, setResume.getSelection());
707
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_RESUME, setResume.getSelection());
708
		
709
		// Run Commands
599
		configuration.setAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, runCommands.getText());
710
		configuration.setAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, runCommands.getText());
600
	}
711
	}
601
712
713
	/* (non-Javadoc)
714
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
715
	 */
602
	public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
716
	public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
603
		configuration.setAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, ""); //$NON-NLS-1$
717
		// Initialization Commands
718
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET);
719
		configuration.setAttribute(IGDBJtagConstants.ATTR_DELAY, IGDBJtagConstants.DEFAULT_DELAY);
720
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_HALT, IGDBJtagConstants.DEFAULT_DO_HALT);
721
		configuration.setAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, IGDBJtagConstants.DEFAULT_INIT_COMMANDS);
722
723
		// Load Image...
604
		configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE);
724
		configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE);
605
		configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, ""); //$NON-NLS-1$
725
		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$
726
		configuration.setAttribute(IGDBJtagConstants.ATTR_USE_FILE_FOR_IMAGE, IGDBJtagConstants.DEFAULT_USE_FILE_FOR_IMAGE);
607
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_RESET, true);
727
		configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, IGDBJtagConstants.DEFAULT_IMAGE_FILE_NAME);
608
		configuration.setAttribute(IGDBJtagConstants.ATTR_DO_HALT, true);
728
		configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, IGDBJtagConstants.DEFAULT_IMAGE_OFFSET);
609
	}
729
730
		//.. and Symbols
731
		configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS);
732
		configuration.setAttribute(IGDBJtagConstants.ATTR_USE_PROJ_BINARY_FOR_SYMBOLS, IGDBJtagConstants.DEFAULT_USE_PROJ_BINARY_FOR_SYMBOLS);
733
		configuration.setAttribute(IGDBJtagConstants.ATTR_USE_FILE_FOR_SYMBOLS, IGDBJtagConstants.DEFAULT_USE_FILE_FOR_SYMBOLS);
734
		configuration.setAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, IGDBJtagConstants.DEFAULT_SYMBOLS_FILE_NAME);
735
		configuration.setAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, IGDBJtagConstants.DEFAULT_SYMBOLS_OFFSET);
736
		
737
		// Runtime Options
738
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER);
739
		configuration.setAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, IGDBJtagConstants.DEFAULT_PC_REGISTER);
740
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT);
741
		configuration.setAttribute(IGDBJtagConstants.ATTR_STOP_AT, IGDBJtagConstants.DEFAULT_STOP_AT);
742
		configuration.setAttribute(IGDBJtagConstants.ATTR_SET_RESUME, IGDBJtagConstants.DEFAULT_SET_RESUME);
610
743
744
		// Run Commands
745
		configuration.setAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, IGDBJtagConstants.DEFAULT_RUN_COMMANDS); 
746
	}
611
}
747
}

Return to bug 310304