1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 08:46:02 +02:00

pr 98684 - ui updates and validator - patch from Andy

This commit is contained in:
Alena Laskavaia 2008-05-05 21:07:00 +00:00
parent df1f2e40e1
commit c6ce322757
6 changed files with 148 additions and 25 deletions

View file

@ -118,6 +118,12 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
gdbJtagDevice.doReset(commands); gdbJtagDevice.doReset(commands);
int defaultDelay = gdbJtagDevice.getDefaultDelay(); int defaultDelay = gdbJtagDevice.getDefaultDelay();
gdbJtagDevice.doDelay(config.getAttribute(IGDBJtagConstants.ATTR_DELAY, defaultDelay), commands); gdbJtagDevice.doDelay(config.getAttribute(IGDBJtagConstants.ATTR_DELAY, defaultDelay), commands);
executeGDBScript(getGDBScript(commands), miSession);
}
// Run device-specific code to halt the board
if (config.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, true)) {
commands = new ArrayList();
gdbJtagDevice.doHalt(commands); gdbJtagDevice.doHalt(commands);
executeGDBScript(getGDBScript(commands), miSession); executeGDBScript(getGDBScript(commands), miSession);
} }
@ -170,9 +176,12 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
ArrayList commands = new ArrayList(); ArrayList commands = new ArrayList();
// Set program counter // Set program counter
String pcRegister = config.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, "")); boolean setPc = config.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER);
gdbJtagDevice.doSetPC(pcRegister, commands); if (setPc) {
executeGDBScript(getGDBScript(commands), miSession); String pcRegister = config.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, ""));
gdbJtagDevice.doSetPC(pcRegister, commands);
executeGDBScript(getGDBScript(commands), miSession);
}
// execute run script // execute run script
monitor.beginTask("Executing run commands", 1); monitor.beginTask("Executing run commands", 1);

View file

@ -34,6 +34,7 @@ public interface IGDBJtagConstants {
public static final String ATTR_INIT_COMMANDS = Activator.PLUGIN_ID + ".initCommands"; //$NON-NLS-1$ public static final String ATTR_INIT_COMMANDS = Activator.PLUGIN_ID + ".initCommands"; //$NON-NLS-1$
public static final String ATTR_DELAY = Activator.PLUGIN_ID + ".delay"; //$NON-NLS-1$ public static final String ATTR_DELAY = Activator.PLUGIN_ID + ".delay"; //$NON-NLS-1$
public static final String ATTR_DO_RESET = Activator.PLUGIN_ID + ".doReset"; //$NON-NLS-1$ public static final String ATTR_DO_RESET = Activator.PLUGIN_ID + ".doReset"; //$NON-NLS-1$
public static final String ATTR_DO_HALT = Activator.PLUGIN_ID + ".doHalt"; //$NON-NLS-1$
public static final String ATTR_LOAD_IMAGE = Activator.PLUGIN_ID + ".loadImage"; //$NON-NLS-1$ public static final String ATTR_LOAD_IMAGE = Activator.PLUGIN_ID + ".loadImage"; //$NON-NLS-1$
public static final String ATTR_LOAD_SYMBOLS = Activator.PLUGIN_ID + ".loadSymbols"; //$NON-NLS-1$ public static final String ATTR_LOAD_SYMBOLS = Activator.PLUGIN_ID + ".loadSymbols"; //$NON-NLS-1$
public static final String ATTR_IMAGE_FILE_NAME = Activator.PLUGIN_ID + ".imageFileName"; //$NON-NLS-1$ public static final String ATTR_IMAGE_FILE_NAME = Activator.PLUGIN_ID + ".imageFileName"; //$NON-NLS-1$
@ -48,6 +49,7 @@ public interface IGDBJtagConstants {
public static final String ATTR_RUN_COMMANDS = Activator.PLUGIN_ID + ".runCommands"; //$NON-NLS-1$ public static final String ATTR_RUN_COMMANDS = Activator.PLUGIN_ID + ".runCommands"; //$NON-NLS-1$
public static final boolean DEFAULT_DO_RESET = true; public static final boolean DEFAULT_DO_RESET = true;
public static final boolean DEFAULT_DO_HALT = true;
public static final int DEFAULT_DELAY = 3; public static final int DEFAULT_DELAY = 3;
public static final boolean DEFAULT_LOAD_IMAGE = false; public static final boolean DEFAULT_LOAD_IMAGE = false;
public static final boolean DEFAULT_LOAD_SYMBOLS = false; public static final boolean DEFAULT_LOAD_SYMBOLS = false;

View file

@ -98,7 +98,7 @@ public class DefaultGDBJtagDeviceImpl implements IGDBJtagDevice {
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doStopAt(java.lang.String, java.util.Collection) * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doStopAt(java.lang.String, java.util.Collection)
*/ */
public void doStopAt(String stopAt, Collection commands) { public void doStopAt(String stopAt, Collection commands) {
String cmd = "break " + stopAt; String cmd = "tbreak " + stopAt;
addCmd(commands, cmd); addCmd(commands, cmd);
} }

View file

@ -15,6 +15,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.cdt.debug.gdbjtag.core, org.eclipse.cdt.debug.gdbjtag.core,
org.eclipse.core.variables, org.eclipse.core.variables,
org.eclipse.cdt.managedbuilder.ui, org.eclipse.cdt.managedbuilder.ui,
org.eclipse.ui.ide org.eclipse.ui.ide,
org.eclipse.cdt.debug.core
Eclipse-LazyStart: true Eclipse-LazyStart: true
Bundle-Vendor: %providerName Bundle-Vendor: %providerName

View file

@ -14,10 +14,13 @@ package org.eclipse.cdt.debug.gdbjtag.ui;
import java.io.File; import java.io.File;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConstants; import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConstants;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.variables.VariablesPlugin; import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
@ -52,6 +55,7 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
Text initCommands; Text initCommands;
Text delay; Text delay;
Button doReset; Button doReset;
Button doHalt;
Button loadImage; Button loadImage;
Text imageFileName; Text imageFileName;
@ -137,7 +141,13 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
group.setLayoutData(gd); group.setLayoutData(gd);
group.setText(Messages.getString("GDBJtagStartupTab.initGroup_Text")); group.setText(Messages.getString("GDBJtagStartupTab.initGroup_Text"));
doReset = new Button(group, SWT.CHECK); Composite comp = new Composite(group, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 0;
comp.setLayout(layout);
doReset = new Button(comp, SWT.CHECK);
doReset.setText(Messages.getString("GDBJtagStartupTab.doReset_Text")); doReset.setText(Messages.getString("GDBJtagStartupTab.doReset_Text"));
doReset.addSelectionListener(new SelectionAdapter() { doReset.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
@ -145,16 +155,9 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
updateLaunchConfigurationDialog(); updateLaunchConfigurationDialog();
} }
}); });
Composite comp = new Composite(group, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 2;
comp.setLayout(layout);
Label delayLabel = new Label(comp, SWT.NONE);
delayLabel.setText(Messages.getString("GDBJtagStartupTab.delayLabel_Text"));
delay = new Text(comp, SWT.BORDER); delay = new Text(comp, SWT.BORDER);
gd = new GridData(); gd = new GridData();
gd.horizontalSpan = 1;
gd.widthHint = 60; gd.widthHint = 60;
delay.setLayoutData(gd); delay.setLayoutData(gd);
delay.addVerifyListener(new VerifyListener() { delay.addVerifyListener(new VerifyListener() {
@ -168,6 +171,23 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
} }
}); });
comp = new Composite(group, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 1;
layout.marginHeight = 0;
comp.setLayout(layout);
doHalt = new Button(comp, SWT.CHECK);
doHalt.setText(Messages.getString("GDBJtagStartupTab.doHalt_Text"));
gd = new GridData();
gd.horizontalSpan = 1;
doHalt.setLayoutData(gd);
doHalt.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
initCommands = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL); initCommands = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
gd = new GridData(GridData.FILL_BOTH); gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 60; gd.heightHint = 60;
@ -441,15 +461,95 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
}); });
} }
/* (non-Javadoc)
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
*/
public boolean isValid(ILaunchConfiguration launchConfig) {
if (!super.isValid(launchConfig))
return false;
setErrorMessage(null);
setMessage(null);
if (loadImage.getSelection()) {
if (imageFileName.getText().trim().length() == 0) {
setErrorMessage(Messages.getString("GDBJtagStartupTab.imageFileName_not_specified"));
return false;
}
String path;
try {
path = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName.getText().trim());
IPath filePath = new Path(path);
if (!filePath.toFile().exists()) {
setErrorMessage(Messages.getString("GDBJtagStartupTab.imageFileName_does_not_exist"));
return false;
}
} catch (CoreException e) {
Activator.getDefault().getLog().log(e.getStatus());
}
} else {
setErrorMessage(null);
}
if (loadSymbols.getSelection()) {
if (symbolsFileName.getText().trim().length() == 0) {
setErrorMessage(Messages.getString("GDBJtagStartupTab.symbolsFileName_not_specified"));
return false;
}
String path;
try {
path = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName.getText().trim());
IPath filePath = new Path(path);
if (!filePath.toFile().exists()) {
setErrorMessage(Messages.getString("GDBJtagStartupTab.symbolsFileName_does_not_exist"));
return false;
}
} catch (CoreException e) {
Activator.getDefault().getLog().log(e.getStatus());
}
} else {
setErrorMessage(null);
}
if (setPcRegister.getSelection()) {
if (pcRegister.getText().trim().length() == 0) {
setErrorMessage(Messages.getString("GDBJtagStartupTab.pcRegister_not_specified"));
return false;
}
} else {
setErrorMessage(null);
}
if (setStopAt.getSelection()) {
if (stopAt.getText().trim().length() == 0) {
setErrorMessage(Messages.getString("GDBJtagStartupTab.stopAt_not_specified"));
}
} else {
setErrorMessage(null);
}
return true;
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
*/
// protected void updateLaunchConfigurationDialog() {
// super.updateLaunchConfigurationDialog();
// isValid(getLaunchConfigurationDialog());
// }
public void initializeFrom(ILaunchConfiguration configuration) { public void initializeFrom(ILaunchConfiguration configuration) {
try { try {
initCommands.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, "")); //$NON-NLS-1$ initCommands.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, "")); //$NON-NLS-1$
doReset.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET)); doReset.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET));
doResetChanged(); doResetChanged();
doHalt.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, IGDBJtagConstants.DEFAULT_DO_HALT));
delay.setText(String.valueOf(configuration.getAttribute(IGDBJtagConstants.ATTR_DELAY, IGDBJtagConstants.DEFAULT_DELAY))); delay.setText(String.valueOf(configuration.getAttribute(IGDBJtagConstants.ATTR_DELAY, IGDBJtagConstants.DEFAULT_DELAY)));
loadImage.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE)); loadImage.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE));
loadImageChanged(); loadImageChanged();
imageFileName.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, "")); //$NON-NLS-1$ String defaultImageFileName = configuration.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, ""); //$NON-NLS-1$
if (defaultImageFileName.equals("")) {
defaultImageFileName = configuration.getWorkingCopy().getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, ""); //$NON-NLS-1$
}
imageFileName.setText(defaultImageFileName);
imageOffset.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, "")); //$NON-NLS-1$ imageOffset.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, "")); //$NON-NLS-1$
loadSymbols.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS)); loadSymbols.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS));
loadSymbolsChanged(); loadSymbolsChanged();
@ -473,6 +573,7 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
configuration.setAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, initCommands.getText()); configuration.setAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, initCommands.getText());
configuration.setAttribute(IGDBJtagConstants.ATTR_DELAY, Integer.parseInt(delay.getText())); configuration.setAttribute(IGDBJtagConstants.ATTR_DELAY, Integer.parseInt(delay.getText()));
configuration.setAttribute(IGDBJtagConstants.ATTR_DO_RESET, doReset.getSelection()); configuration.setAttribute(IGDBJtagConstants.ATTR_DO_RESET, doReset.getSelection());
configuration.setAttribute(IGDBJtagConstants.ATTR_DO_HALT, doHalt.getSelection());
configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, loadImage.getSelection()); configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, loadImage.getSelection());
configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, imageFileName.getText().trim()); configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, imageFileName.getText().trim());
configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, imageOffset.getText()); configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, imageOffset.getText());
@ -493,6 +594,7 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, ""); //$NON-NLS-1$ configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, ""); //$NON-NLS-1$
configuration.setAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, ""); //$NON-NLS-1$ configuration.setAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, ""); //$NON-NLS-1$
configuration.setAttribute(IGDBJtagConstants.ATTR_DO_RESET, true); configuration.setAttribute(IGDBJtagConstants.ATTR_DO_RESET, true);
configuration.setAttribute(IGDBJtagConstants.ATTR_DO_HALT, true);
} }
} }

View file

@ -1,31 +1,40 @@
GDBJtagStartupTab.initGroup_Text=Initialization Commands GDBJtagStartupTab.initGroup_Text=Initialization Commands
GDBJtagStartupTab.doReset_Text=Automatically reset board and halt GDBJtagStartupTab.doReset_Text=Reset and Delay (seconds):
GDBJtagStartupTab.delayLabel_Text=Delay (s): GDBJtagStartupTab.doHalt_Text=Halt
GDBJtagStartupTab.loadGroup_Text=Load Image and Symbols GDBJtagStartupTab.loadGroup_Text=Load Image and Symbols
GDBJtagStartupTab.loadImage_Text=Automatically load image GDBJtagStartupTab.loadImage_Text=Load image
GDBJtagStartupTab.imageLabel_Text=Image file name: GDBJtagStartupTab.imageLabel_Text=Image file name:
GDBJtagStartupTab.imageFileBrowseWs_Title=Select image file GDBJtagStartupTab.imageFileBrowseWs_Title=Select image file
GDBJtagStartupTab.imageFileBrowse_Title=Select image file GDBJtagStartupTab.imageFileBrowse_Title=Select image file
GDBJtagStartupTab.imageOffsetLabel_Text=Image offset: GDBJtagStartupTab.imageOffsetLabel_Text=Image offset (hex):
GDBJtagStartupTab.FileBrowseWs_Label=Workspace... GDBJtagStartupTab.FileBrowseWs_Label=Workspace...
GDBJtagStartupTab.FileBrowseWs_Message=Select a workspace resource GDBJtagStartupTab.FileBrowseWs_Message=Select a workspace resource
GDBJtagStartupTab.FileBrowse_Label=File System... GDBJtagStartupTab.FileBrowse_Label=File System...
GDBJtagStartupTab.FileBrowse_Message=Select a file from file system GDBJtagStartupTab.FileBrowse_Message=Select a file from file system
GDBJtagStartupTab.loadSymbols_Text=Automatically load symbols GDBJtagStartupTab.loadSymbols_Text=Load symbols
GDBJtagStartupTab.symbolsLabel_Text=Symbol file name: GDBJtagStartupTab.symbolsLabel_Text=Symbols file name:
GDBJtagStartupTab.symbolsFileBrowseWs_Title=Select symbols file GDBJtagStartupTab.symbolsFileBrowseWs_Title=Select symbols file
GDBJtagStartupTab.symbolsFileBrowse_Title=Select symbols file GDBJtagStartupTab.symbolsFileBrowse_Title=Select symbols file
GDBJtagStartupTab.symbolsOffsetLabel_Text=Symbols offset: GDBJtagStartupTab.symbolsOffsetLabel_Text=Symbols offset (hex):
GDBJtagStartupTab.runOptionGroup_Text=Runtime Options GDBJtagStartupTab.runOptionGroup_Text=Runtime Options
GDBJtagStartupTab.setPcRegister_Text=Automatically set program counter at: GDBJtagStartupTab.setPcRegister_Text=Set program counter at (hex):
GDBJtagStartupTab.setStopAt_Text=Automatically stop on startup at: GDBJtagStartupTab.setStopAt_Text=Set breakpoint at:
GDBJtagStartupTab.setResume_Text=Automatically resume GDBJtagStartupTab.setResume_Text=Resume
GDBJtagStartupTab.runGroup_Text=Run Commands GDBJtagStartupTab.runGroup_Text=Run Commands
GDBJtagStartupTab.imageFileName_not_specified=Image file name not specified
GDBJtagStartupTab.imageFileName_does_not_exist=Image file does not exist
GDBJtagStartupTab.imageOffset_not_specified=Image offset not specified
GDBJtagStartupTab.symbolsFileName_not_specified=Symbols file name not specified
GDBJtagStartupTab.symbolsFileName_does_not_exist=Symbols file does not exist
GDBJtagStartupTab.symbolsOffset_not_specified=Symbols offset not specified
GDBJtagStartupTab.pcRegister_not_specified=Program counter not specified
GDBJtagStartupTab.stopAt_not_specified=Breakpoint location not specified
GDBJtagDebuggerTab.gdbSetupGroup_Text=GDB Setup GDBJtagDebuggerTab.gdbSetupGroup_Text=GDB Setup
GDBJtagDebuggerTab.gdbCommandLabel=GDB Command: GDBJtagDebuggerTab.gdbCommandLabel=GDB Command:
GDBJtagDebuggerTab.gdbCommandBrowse=Browse... GDBJtagDebuggerTab.gdbCommandBrowse=Browse...