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

bug 229946 - applied Andy's patch - advanced UI support for hardware lunch

This commit is contained in:
Alena Laskavaia 2008-05-02 18:14:50 +00:00
parent 749ea13431
commit 8a4f9177cd
22 changed files with 1315 additions and 186 deletions

View file

@ -13,5 +13,6 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.cdt.core,
org.eclipse.core.variables
Eclipse-LazyStart: true
Export-Package: org.eclipse.cdt.debug.gdbjtag.core
Export-Package: org.eclipse.cdt.debug.gdbjtag.core,
org.eclipse.cdt.debug.gdbjtag.core.jtagdevice
Bundle-Vendor: %providerName

View file

@ -11,3 +11,5 @@
launchConfig.name=GDB Hardware Debugging
pluginName=Eclipse GDB Hardware Debug Core Plug-in
providerName=Eclipse.org
JTagDevice.name=JTAG Device

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension-point id="JTagDevice" name="%JTagDevice.name" schema="schema/JTagDevice.exsd"/>
<extension
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType

View file

@ -0,0 +1,116 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.cdt.debug.gdbjtag.core">
<annotation>
<appInfo>
<meta.schema plugin="org.eclipse.cdt.debug.gdbjtag.core" id="JTagDevice" name="%JTagDevice.name"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="device" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="device">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
<documentation>
</documentation>
</annotation>
</schema>

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 QNX Software Systems and others
* Copyright (c) 2008 QNX Software Systems and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,9 +7,11 @@
*
* Contributors:
* QNX Software Systems - initial API and implementation
* Andy Jin - Hardware debugging UI improvements, bug 229946
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;
@ -19,7 +21,7 @@ import org.osgi.framework.BundleContext;
public class Activator extends Plugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.cdt.debug.gdbremote.core";
public static final String PLUGIN_ID = "org.eclipse.cdt.debug.gdbjtag.core";
// The shared instance
private static Activator plugin;
@ -57,4 +59,20 @@ public class Activator extends Plugin {
return plugin;
}
/**
* Convenience method which returns the unique identifier of this plugin.
*/
public static String getUniqueIdentifier() {
return PLUGIN_ID;
}
/**
* Logs the specified status with this plug-in's log.
*
* @param status status to log
*/
public static void log( IStatus status ) {
getDefault().getLog().log( status );
}
}

View file

@ -1,23 +1,30 @@
/**********************************************************************
* Copyright (c) 2007 QNX Software Systems and others.
/*******************************************************************************
* Copyright (c) 2007 - 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*
* Contributors:
* QNX Software Systems - Initial API and implementation
**********************************************************************/
* Andy Jin - Hardware debugging UI improvements, bug 229946
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContribution;
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContributionFactory;
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice;
import org.eclipse.cdt.debug.mi.core.AbstractGDBCDIDebugger;
import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MIPlugin;
@ -27,8 +34,6 @@ import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIGDBSetNewConsole;
import org.eclipse.cdt.debug.mi.core.command.MITargetDownload;
import org.eclipse.cdt.debug.mi.core.command.MITargetSelect;
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@ -36,11 +41,12 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
/**
* @author Doug Schaefer
* @author Doug Schaefer, Adrian Petrescu
*
*/
public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
@ -64,10 +70,12 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
protected void doStartSession(ILaunch launch, Session session, IProgressMonitor monitor) throws CoreException {
ILaunchConfiguration config = launch.getLaunchConfiguration();
ICDITarget[] targets = session.getTargets();
if (targets.length == 0 || !(targets[0] instanceof Target))
return ; // TODO should raise an exception
if (targets.length == 0 || !(targets[0] instanceof Target)) {
Activator.log(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
DebugPlugin.INTERNAL_ERROR, "Error getting debug target", null));
return;
}
MISession miSession = ((Target)targets[0]).getMISession();
getMISession(session);
CommandFactory factory = miSession.getCommandFactory();
try {
MIGDBSetNewConsole newConsole = factory.createMIGDBSetNewConsole();
@ -82,55 +90,68 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
// on GNU/Linux the new-console is an error.
}
IGDBJtagDevice gdbJtagDevice;
try {
gdbJtagDevice = getGDBJtagDevice(config);
} catch (NullPointerException e) {
return;
}
ArrayList commands = new ArrayList();
// hook up to remote target
boolean useRemote = config.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET);
if (useRemote) {
try {
monitor.beginTask("Connecting to remote", 1);
String ipAddress = config.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, IGDBJtagConstants.DEFAULT_IP_ADDRESS);
int portNumber = config.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER);
String address = ipAddress + ":" + String.valueOf(portNumber);
MITargetSelect targetSelect = factory.createMITargetSelect(new String[] { "remote", address });
miSession.postCommand(targetSelect);
MIInfo info = targetSelect.getMIInfo();
if (info == null) {
throw new MIException(MIPlugin.getResourceString("src.common.No_answer")); //$NON-NLS-1$
}
} catch (MIException e) {
// TODO dunno...
}
monitor.beginTask("Connecting to remote", 1);
String ipAddress = config.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, IGDBJtagConstants.DEFAULT_IP_ADDRESS);
int portNumber = config.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER);
gdbJtagDevice.doRemote(ipAddress, portNumber, commands);
executeGDBScript(getGDBScript(commands), miSession);
}
// execute init script
monitor.beginTask("Executing init commands", 1);
// Run device-specific code to reset the board
if (config.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, true)) {
commands = new ArrayList();
gdbJtagDevice.doReset(commands);
int defaultDelay = gdbJtagDevice.getDefaultDelay();
gdbJtagDevice.doDelay(config.getAttribute(IGDBJtagConstants.ATTR_DELAY, defaultDelay), commands);
gdbJtagDevice.doHalt(commands);
executeGDBScript(getGDBScript(commands), miSession);
}
// execute any user defined init command
executeGDBScript(config, IGDBJtagConstants.ATTR_INIT_COMMANDS, miSession);
// execute load
boolean doLoad = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE);
boolean doLoad = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE);
if (doLoad) {
// Escape windows path separator characters TWICE, once for Java and once for GDB.
String imageFileName = config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, "");
if (imageFileName.length() > 0) {
try {
monitor.beginTask("Loading image", 1);
imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName);
MITargetDownload download = factory.createMITargetDownload(imageFileName);
miSession.postCommand(download, MISession.FOREVER);
MIInfo info = download.getMIInfo();
if (info == null) {
throw new MIException(MIPlugin.getResourceString("src.common.No_answer")); //$NON-NLS-1$
}
} catch (MIException e) {
// TODO dunno...
}
monitor.beginTask("Loading image", 1);
imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName).replace("\\", "\\\\");
String imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, "");
commands = new ArrayList();
gdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
executeGDBScript(getGDBScript(commands), miSession);
}
}
// execute symbol load
boolean doLoadSymbols = config.getAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, IGDBJtagConstants.DEFAULT_LOAD_SYMBOLS);
if (doLoadSymbols) {
String symbolsFileName = config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, "");
if (symbolsFileName.length() > 0) {
symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName).replace("\\", "\\\\");
String symbolsOffset = "0x" + config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, "");
commands = new ArrayList();
gdbJtagDevice.doLoadSymbol(symbolsFileName, symbolsOffset, commands);
executeGDBScript(getGDBScript(commands), miSession);
}
}
}
protected MISession getMISession(Session session) {
ICDITarget[] targets = session.getTargets();
if (targets.length == 0 || !(targets[0] instanceof Target))
return null;
return ((Target)targets[0]).getMISession();
}
public void doRunSession(ILaunch launch, ICDISession session, IProgressMonitor monitor) throws CoreException {
@ -139,16 +160,44 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
if ( targets.length == 0 || !(targets[0] instanceof Target) )
return;
MISession miSession = ((Target)targets[0]).getMISession();
IGDBJtagDevice gdbJtagDevice;
try {
gdbJtagDevice = getGDBJtagDevice(config);
} catch (NullPointerException e) {
return;
}
ArrayList commands = new ArrayList();
// Set program counter
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
monitor.beginTask("Executing run commands", 1);
boolean setStopAt = config.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT);
if (setStopAt) {
String stopAt = config.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, "");
commands = new ArrayList();
gdbJtagDevice.doStopAt(stopAt, commands);
executeGDBScript(getGDBScript(commands), miSession);
}
boolean setResume = config.getAttribute(IGDBJtagConstants.ATTR_SET_RESUME, IGDBJtagConstants.DEFAULT_SET_RESUME);
if (setResume) {
commands = new ArrayList();
gdbJtagDevice.doContinue(commands);
executeGDBScript(getGDBScript(commands), miSession);
}
// Run any user defined command
executeGDBScript(config, IGDBJtagConstants.ATTR_RUN_COMMANDS, miSession);
}
private void executeGDBScript(ILaunchConfiguration configuration, String attribute,
MISession miSession) throws CoreException {
// Try to execute any extrac comand
String script = configuration.getAttribute(attribute, ""); //$NON-NLS-1$
private void executeGDBScript(String script, MISession miSession) throws CoreException {
// Try to execute any extra command
if (script == null)
return;
script = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(script);
String[] commands = script.split("\\r?\\n");
for (int j = 0; j < commands.length; ++j) {
@ -175,5 +224,35 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
}
}
}
private void executeGDBScript(ILaunchConfiguration configuration, String attribute,
MISession miSession) throws CoreException {
executeGDBScript(configuration.getAttribute(attribute, ""), miSession);
}
private IGDBJtagDevice getGDBJtagDevice (ILaunchConfiguration config)
throws CoreException, NullPointerException {
IGDBJtagDevice gdbJtagDevice = null;
String jtagDeviceName = config.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, "");
GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.
getInstance().getGDBJtagDeviceContribution();
for (int i = 0; i < availableDevices.length; i++) {
if (jtagDeviceName.equals(availableDevices[i].getDeviceName())) {
gdbJtagDevice = availableDevices[i].getDevice();
break;
}
}
return gdbJtagDevice;
}
private String getGDBScript(Collection commands) {
if (commands.isEmpty())
return null;
StringBuffer sb = new StringBuffer();
Iterator it = commands.iterator();
while (it.hasNext()) {
sb.append(it.next());
}
return sb.toString();
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 QNX Software Systems and others.
* Copyright (c) 2007 - 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Andy Jin - Hardware debugging UI improvements, bug 229946
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core;
@ -23,6 +24,7 @@ public interface IGDBJtagConstants {
public static final String ATTR_USE_REMOTE_TARGET = Activator.PLUGIN_ID + ".useRemoteTarget"; //$NON-NLS-1$
public static final String ATTR_IP_ADDRESS = Activator.PLUGIN_ID + ".ipAddress"; //$NON-NLS-1$
public static final String ATTR_PORT_NUMBER = Activator.PLUGIN_ID + ".portNumber"; //$NON-NLS-1$
public static final String ATTR_JTAG_DEVICE = Activator.PLUGIN_ID + ".jtagDevice"; //$NON-NLS-1$
public static final boolean DEFAULT_USE_REMOTE_TARGET = true;
public static final String DEFAULT_IP_ADDRESS = "localhost"; //$NON-NLS-1$
@ -30,11 +32,28 @@ public interface IGDBJtagConstants {
// Startup
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_DO_RESET = Activator.PLUGIN_ID + ".doReset"; //$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_IMAGE_FILE_NAME = Activator.PLUGIN_ID + ".imageFileName"; //$NON-NLS-1$
public static final String ATTR_SYMBOLS_FILE_NAME = Activator.PLUGIN_ID + ".symbolsFileName"; //$NON-NLS-1$
public static final String ATTR_IMAGE_OFFSET = Activator.PLUGIN_ID + ".imageOffset"; //$NON-NLS-1$
public static final String ATTR_SYMBOLS_OFFSET = Activator.PLUGIN_ID + ".symbolsOffset"; //$NON-NLS-1$
public static final String ATTR_SET_PC_REGISTER = Activator.PLUGIN_ID + ".setPcRegister"; //$NON-NLS-1$
public static final String ATTR_PC_REGISTER = Activator.PLUGIN_ID + ".pcRegister"; //$NON-NLS-1$
public static final String ATTR_SET_STOP_AT = Activator.PLUGIN_ID + ".setStopAt"; //$NON-NLS-1$
public static final String ATTR_STOP_AT = Activator.PLUGIN_ID + ".stopAt"; //$NON-NLS-1$
public static final String ATTR_SET_RESUME = Activator.PLUGIN_ID + ".setResume"; //$NON-NLS-1$
public static final String ATTR_RUN_COMMANDS = Activator.PLUGIN_ID + ".runCommands"; //$NON-NLS-1$
public static final boolean DEFAULT_LOAD_IMAGE = false;
public static final boolean DEFAULT_USE_DEFAULT_RUN = true;
public static final boolean DEFAULT_DO_RESET = true;
public static final int DEFAULT_DELAY = 3;
public static final boolean DEFAULT_LOAD_IMAGE = false;
public static final boolean DEFAULT_LOAD_SYMBOLS = false;
public static final boolean DEFAULT_SET_PC_REGISTER = false;
public static final boolean DEFAULT_SET_STOP_AT = false;
public static final boolean DEFAULT_SET_RESUME = false;
public static final boolean DEFAULT_USE_DEFAULT_RUN = true;
}

View file

@ -0,0 +1,30 @@
/*******************************************************************************
* Copyright (c) 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Andy Jin - Hardware debugging UI improvements, bug 229946
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
public class AbatronBDI2000 extends DefaultGDBJtagDeviceImpl {
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#getDefaultIpAddress()
*/
public String getDefaultIpAddress() {
return "bdi2000";
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#getDefaultPortNumber()
*/
public String getDefaultPortNumber() {
return "2001";
}
}

View file

@ -0,0 +1,126 @@
/*******************************************************************************
* Copyright (c) 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Andy Jin - Hardware debugging UI improvements, bug 229946
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
import java.util.Collection;
/**
* @author ajin
*
*/
public class DefaultGDBJtagDeviceImpl implements IGDBJtagDevice {
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doDelay(int, java.util.Collection)
*/
public void doDelay(int delay, Collection commands) {
String cmd = "monitor delay " + String.valueOf( delay * 1000 );
addCmd(commands, cmd);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doReset(java.util.Collection)
*/
public void doReset(Collection commands) {
String cmd = "monitor reset run";
addCmd(commands, cmd);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#getDefaultDelay()
*/
public int getDefaultDelay() {
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doRemote(java.lang.String, int, java.util.Collection)
*/
public void doRemote(String ip, int port, Collection commands) {
String cmd = "target remote " + ip + ":" + String.valueOf(port);
addCmd(commands, cmd);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doHalt(java.util.Collection)
*/
public void doHalt(Collection commands) {
String cmd = "monitor halt";
addCmd(commands, cmd);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doContinue(java.util.Collection)
*/
public void doContinue(Collection commands) {
String cmd = "continue";
addCmd(commands, cmd);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doLoadImage(java.lang.String, java.lang.String, java.util.Collection)
*/
public void doLoadImage(String imageFileName, String imageOffset, Collection commands) {
String cmd = "restore " + imageFileName + " " + imageOffset;
addCmd(commands, cmd);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doLoadSymbol(java.lang.String, java.lang.String, java.util.Collection)
*/
public void doLoadSymbol(String symbolFileName, String symbolOffset, Collection commands) {
String cmd = "add-sym " + symbolFileName + " " + symbolOffset;
addCmd(commands, cmd);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doSetPC(java.lang.String, java.util.Collection)
*/
public void doSetPC(String pc, Collection commands) {
String cmd = "set $pc=0x" + pc;
addCmd(commands, cmd);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doStopAt(java.lang.String, java.util.Collection)
*/
public void doStopAt(String stopAt, Collection commands) {
String cmd = "break " + stopAt;
addCmd(commands, cmd);
}
/*
* addCmd Utility method to format commands
*/
protected void addCmd (Collection commands, String cmd) {
commands.add(cmd + System.getProperty("line.separator"));
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#getDefaultIpAddress()
*/
public String getDefaultIpAddress() {
return "localhost";
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#getDefaultPortNumber()
*/
public String getDefaultPortNumber() {
return "10000";
}
}

View file

@ -0,0 +1,93 @@
/*******************************************************************************
* Copyright (c) 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Andy Jin - Hardware debugging UI improvements, bug 229946
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
import org.eclipse.cdt.debug.gdbjtag.core.Activator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
public class GDBJtagDeviceContribution {
private String deviceId;
private String deviceName;
private String deviceClassName;
private IGDBJtagDevice device;
/**
* @return the deviceId
*/
public String getDeviceId() {
return this.deviceId;
}
/**
* @param deviceId the deviceId to set
*/
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
/**
* @return the deviceName
*/
public String getDeviceName() {
return this.deviceName;
}
/**
* @param deviceName the deviceName to set
*/
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
/**
* @return the deviceClassName
*/
public String getDeviceClassName() {
return this.deviceClassName;
}
/**
* @param deviceClassName the deviceClassName to set
*/
public void setDeviceClassName(String deviceClassName) {
this.deviceClassName = deviceClassName;
}
public IGDBJtagDevice getDevice() throws NullPointerException {
if (device != null)
return device;
Object o = null;
try {
o = Class.forName(getDeviceClassName()).newInstance();
} catch (InstantiationException e) {
Activator.log(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
DebugPlugin.INTERNAL_ERROR, "Error instantiating "
+ getDeviceClassName() + " class", null));
throw new NullPointerException();
} catch (IllegalAccessException e) {
Activator.log(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
DebugPlugin.INTERNAL_ERROR, "Error instantiating "
+ getDeviceClassName() + " class", null));
throw new NullPointerException();
} catch (ClassNotFoundException e) {
Activator.log(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
DebugPlugin.INTERNAL_ERROR, "Error instantiating "
+ getDeviceClassName() + " class", null));
throw new NullPointerException();
}
return device = (IGDBJtagDevice) o;
}
}

View file

@ -0,0 +1,85 @@
/*******************************************************************************
* Copyright (c) 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Andy Jin - Hardware debugging UI improvements, bug 229946
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
import java.util.ArrayList;
import org.eclipse.cdt.debug.gdbjtag.core.Activator;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
public class GDBJtagDeviceContributionFactory {
private static final String EXTENSION_POINT_NAME = "JTagDevice";
private static final String MAIN_ELEMENT = "device";
private static GDBJtagDeviceContributionFactory instance;
protected ArrayList contributions;
private GDBJtagDeviceContributionFactory() {
contributions = new ArrayList();
loadSubtypeContributions();
}
public GDBJtagDeviceContribution[] getGDBJtagDeviceContribution() {
return (GDBJtagDeviceContribution[]) contributions.toArray(
new GDBJtagDeviceContribution[contributions.size()]);
}
private void loadSubtypeContributions() {
IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(
Activator.getUniqueIdentifier(), EXTENSION_POINT_NAME);
if (ep == null)
return;
IConfigurationElement[] elements = ep.getConfigurationElements();
for (int i = 0; i < elements.length; i++) {
IConfigurationElement configurationElement = elements[i];
if (configurationElement.getName().equals(MAIN_ELEMENT)) {
String id = getRequired(configurationElement, "id");
String name = getRequired(configurationElement, "name");
String className = getRequired(configurationElement, "class");
GDBJtagDeviceContribution adapter = new GDBJtagDeviceContribution();
adapter.setDeviceId(id);
adapter.setDeviceName(name);
adapter.setDeviceClassName(className);
addContribution(adapter);
}
}
}
public void addContribution(GDBJtagDeviceContribution contribution) {
contributions.add(contribution);
}
public static GDBJtagDeviceContributionFactory getInstance() {
if (instance == null) {
instance = new GDBJtagDeviceContributionFactory();
}
return instance;
}
private static String getRequired(IConfigurationElement configurationElement, String name) {
String elementValue = configurationElement.getAttribute(name);
if (elementValue == null)
Activator.log(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(),
DebugPlugin.INTERNAL_ERROR, "Extension "
+ configurationElement.getDeclaringExtension().getUniqueIdentifier()
+ " missing required attribute: " + name, null));
return elementValue;
}
}

View file

@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Andy Jin - Hardware debugging UI improvements, bug 229946
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
import java.util.Collection;
public class GenericDevice extends DefaultGDBJtagDeviceImpl {
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#doDelay(int, java.util.Collection)
*/
public void doDelay(int delay, Collection commands) {
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#doHalt(java.util.Collection)
*/
public void doHalt(Collection commands) {
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#doReset(java.util.Collection)
*/
public void doReset(Collection commands) {
}
}

View file

@ -0,0 +1,108 @@
/*******************************************************************************
* Copyright (c) 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Andy Jin - Hardware debugging UI improvements, bug 229946
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
import java.util.Collection;
/**
* Provides device specific debug commands for different hardware
* JTAG devices. See <code>DefaultGDBJtagDeviceImpl</code> for
* the default implementations.
*
*/
public interface IGDBJtagDevice {
/**
* Device reset command
* @param commands ommands collection
*/
public void doReset(Collection commands);
/**
* Default device delay in millisecond
* @return delay in second
*/
public int getDefaultDelay();
/**
* Target needs some delay in order to initialize
* @param delay delay in second
* @param commands device specific delay commands
*/
public void doDelay(int delay, Collection commands);
/**
* Target needs to be in pause mode in order to do
* JTAG debug. This should happen before the target
* MMU takes control
* @param commands device specific pause commands
*/
public void doHalt(Collection commands);
/**
* Commands to connect to remote JTAG device
* @param ip host name of IP address of JTAG device
* @param port TCP socket port number of JTAG device
* @param commands remote connection commands
*/
public void doRemote(String ip, int port, Collection commands);
/**
* Commands to download the executable binary to target
* @param imageFileName executable binary file name
* @param imageOffset executable binary memory offset
* @param commands executable binary download commands
*/
public void doLoadImage(String imageFileName, String imageOffset, Collection commands);
/**
* Commands to download the symbols file to target
* @param symbolFileName symbols file name
* @param symbolOffset symbols file memory offset
* @param commands symbols file download command
*/
public void doLoadSymbol(String symbolFileName, String symbolOffset, Collection commands);
/**
* Commands to set initial program counter
* @param pc program counter
* @param commands set program counter commands
*/
public void doSetPC(String pc, Collection commands);
/**
* Commands to set initial breakpoint
* @param stopAt initial breakpoint location
* @param commands set breakpoint commands
*/
public void doStopAt(String stopAt, Collection commands);
/**
* De-freeze the target in order to start debugging
* @param commands commands to continue the target
*/
public void doContinue(Collection commands);
/**
* Device specific default hostname of IP address
* @return default hostname of IP address
*/
public String getDefaultIpAddress();
/**
* Device specific default port number
* @return default port number
*/
public String getDefaultPortNumber();
}

View file

@ -0,0 +1,46 @@
/*******************************************************************************
* Copyright (c) 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Andy Jin - Hardware debugging UI improvements, bug 229946
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
import java.util.Collection;
/**
* @author ajin
*
*/
public class MacraigorUsb2Demon extends DefaultGDBJtagDeviceImpl {
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#getDefaultPortNumber()
*/
public String getDefaultPortNumber() {
return "8888";
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#doDelay(int, java.util.Collection)
*/
public void doDelay(int delay, Collection commands) {
String cmd = "monitor sleep " + String.valueOf(delay);
super.addCmd(commands, cmd);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagDeviceImpl#doReset(java.util.Collection)
*/
public void doReset(Collection commands) {
String cmd = "monitor resetrun";
super.addCmd(commands, cmd);
}
}

View file

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

View file

@ -10,3 +10,7 @@
###############################################################################
pluginName=Eclipse GDB Hardware Debug UI Plug-in
providerName=Eclipse.org
AbatronBDI2000.name=Abatron BDI2000
MacraigorUsb2Demon.name=Macraigor USB2Demon
Generic.name=Generic

View file

@ -15,5 +15,29 @@
id="org.eclipse.cdt.debug.gdbjtag.launchConfigurationTabGroup"
type="org.eclipse.cdt.debug.gdbjtag.launchConfigurationType"/>
</extension>
<extension
point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice">
<device
class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GenericDevice"
id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.genericDevice"
name="%Generic.name">
</device>
</extension>
<extension
point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice">
<device
class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.AbatronBDI2000"
id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.AbatronBDI2000"
name="%AbatronBDI2000.name">
</device>
</extension>
<extension
point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice">
<device
class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.MacraigorUsb2Demon"
id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.MacraigorUsb2Demon"
name="%MacraigorUsb2Demon.name">
</device>
</extension>
</plugin>

View file

@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - initial API and implementation
* Andy Jin - Hardware debugging UI improvements, bug 229946
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.ui;
@ -19,7 +20,7 @@ import org.osgi.framework.BundleContext;
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.cdt.debug.gdbremote.ui";
public static final String PLUGIN_ID = "org.eclipse.cdt.debug.gdbjtag.ui";
// The shared instance
private static Activator plugin;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 QNX Software Systems and others.
* Copyright (c) 2007 - 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,13 +7,18 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Andy Jin - Hardware debugging UI improvements, bug 229946
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.ui;
import java.io.File;
import org.eclipse.cdt.debug.gdbjtag.core.Activator;
import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConstants;
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContribution;
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GDBJtagDeviceContributionFactory;
import org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice;
import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.core.MIPlugin;
import org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoryDescriptor;
@ -43,24 +48,26 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
/**
* @author Doug Schaefer
* @author Doug Schaefer, Adrian Petrescu
*
*/
public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
private static final String TAB_NAME = "Debugger";
private CommandFactoryDescriptor[] cfDescs;
private Text gdbCommand;
private Text gdbinitFile;
private Combo commandFactory;
private Combo miProtocol;
private Button verboseMode;
private Button useRemote;
private Text ipAddress;
private Text portNumber;
private Combo jtagDevice;
public String getName() {
return "Debugger";
return TAB_NAME;
}
public Image getImage() {
@ -83,10 +90,9 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
group.setLayout(layout);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
group.setLayoutData(gd);
group.setText("GDB Setup");
group.setText(Messages.getString("GDBJtagDebuggerTab.gdbSetupGroup_Text"));
createCommandControl(group);
createInitFileControl(group);
createCommandFactoryControl(group);
createProtocolControl(group);
createVerboseModeControl(group);
@ -122,7 +128,7 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
comp.setLayoutData(gd);
Label label = new Label(comp, SWT.NONE);
label.setText("GDB Command:");
label.setText(Messages.getString("GDBJtagDebuggerTab.gdbCommandLabel"));
gd = new GridData();
gd.horizontalSpan = 3;
label.setLayoutData(gd);
@ -137,15 +143,15 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
});
Button button = new Button(comp, SWT.NONE);
button.setText("Browse...");
button.setText(Messages.getString("GDBJtagDebuggerTab.gdbCommandBrowse"));
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
browseButtonSelected("Select gdb", gdbCommand);
browseButtonSelected(Messages.getString("GDBJtagDebuggerTab.gdbCommandBrowse_Title"), gdbCommand);
}
});
button = new Button(comp, SWT.NONE);
button.setText("Variables...");
button.setText(Messages.getString("GDBJtagDebuggerTab.gdbCommandVariable"));
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
variablesButtonSelected(gdbCommand);
@ -153,53 +159,12 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
});
}
private void createInitFileControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
comp.setLayout(layout);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 1;
comp.setLayoutData(gd);
Label label = new Label(comp, SWT.NONE);
label.setText("GDB Init File:");
gd = new GridData();
gd.horizontalSpan = 3;
label.setLayoutData(gd);
gdbinitFile = new Text(comp, SWT.SINGLE | SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gdbinitFile.setLayoutData(gd);
gdbinitFile.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateLaunchConfigurationDialog();
}
});
Button button = new Button(comp, SWT.NONE);
button.setText("Browse...");
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
browseButtonSelected("Select .gdbinit file", gdbinitFile);
}
});
button = new Button(comp, SWT.NONE);
button.setText("Variables...");
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
variablesButtonSelected(gdbinitFile);
}
});
}
private void createCommandFactoryControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
comp.setLayout(layout);
Label label = new Label(comp, SWT.NONE);
label.setText("Command Set:");
label.setText(Messages.getString("GDBJtagDebuggerTab.commandFactoryLabel"));
commandFactory = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN);
@ -223,7 +188,7 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
GridLayout layout = new GridLayout(2, false);
comp.setLayout(layout);
Label label = new Label(comp, SWT.NONE);
label.setText("Protocol Version:");
label.setText(Messages.getString("GDBJtagDebuggerTab.miProtocolLabel"));
miProtocol = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN);
miProtocol.addModifyListener(new ModifyListener() {
@ -254,7 +219,7 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
private void createVerboseModeControl(Composite parent) {
verboseMode = new Button(parent, SWT.CHECK);
verboseMode.setText("Verbose console mode");
verboseMode.setText(Messages.getString("GDBJtagDebuggerTab.verboseModeLabel"));
verboseMode.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
@ -268,10 +233,10 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
group.setLayout(layout);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
group.setLayoutData(gd);
group.setText("Remote Target");
group.setText(Messages.getString("GDBJtagDebuggerTab.remoteGroup_Text"));
useRemote = new Button(group, SWT.CHECK);
useRemote.setText("Use remote target");
useRemote.setText(Messages.getString("GDBJtagDebuggerTab.useRemote_Text"));
useRemote.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
useRemoteChanged();
@ -285,7 +250,26 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
comp.setLayout(layout);
Label label = new Label(comp, SWT.NONE);
label.setText("Host name or IP address:");
label.setText(Messages.getString("GDBJtagDebuggerTab.jtagDeviceLabel"));
jtagDevice = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN);
GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.
getInstance().getGDBJtagDeviceContribution();
for (int i = 0; i < availableDevices.length; i++) {
jtagDevice.add(availableDevices[i].getDeviceName());
}
jtagDevice.select(0);
jtagDevice.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateDeviceIpPort(jtagDevice.getText());
updateLaunchConfigurationDialog();
}
});
label = new Label(comp, SWT.NONE);
label.setText(Messages.getString("GDBJtagDebuggerTab.ipAddressLabel"));
ipAddress = new Text(comp, SWT.BORDER);
gd = new GridData();
gd.widthHint = 100;
@ -297,7 +281,7 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
});
label = new Label(comp, SWT.NONE);
label.setText("Port number:");
label.setText(Messages.getString("GDBJtagDebuggerTab.portNumberLabel"));
portNumber = new Text(comp, SWT.BORDER);
gd = new GridData();
gd.widthHint = 100;
@ -314,8 +298,33 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
});
}
/**
* @param text
*/
protected void updateDeviceIpPort(String selectedDeviceName) {
GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.
getInstance().getGDBJtagDeviceContribution();
IGDBJtagDevice selectedDevice = null;
for (int i = 0; i < availableDevices.length; i++) {
String name = availableDevices[i].getDeviceName();
if (name.equals(selectedDeviceName)) {
try {
selectedDevice = availableDevices[i].getDevice();
} catch (NullPointerException e) {
return;
}
break;
}
}
String ip = selectedDevice.getDefaultIpAddress();
ipAddress.setText(ip);
String port = selectedDevice.getDefaultPortNumber();
portNumber.setText(port);
}
private void useRemoteChanged() {
boolean enabled = useRemote.getSelection();
jtagDevice.setEnabled(enabled);
ipAddress.setEnabled(enabled);
portNumber.setEnabled(enabled);
}
@ -325,9 +334,6 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
String gdbCommandAttr = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
gdbCommand.setText(gdbCommandAttr);
String gdbinitFileAttr = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
gdbinitFile.setText(gdbinitFileAttr);
CommandFactoryManager cfManager = MIPlugin.getDefault().getCommandFactoryManager();
CommandFactoryDescriptor defDesc = cfManager.getDefaultDescriptor(IGDBJtagConstants.DEBUGGER_ID);
String commandFactoryAttr = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, defDesc.getName());
@ -342,10 +348,11 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
String miProtocolAttr = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, defDesc.getMIVersions()[0]);
int n = miProtocol.getItemCount();
for (int i = 0; i < n; ++i) {
if (miProtocol.getItem(i).equals(miProtocolAttr))
if (miProtocol.getItem(i).equals(miProtocolAttr)) {
miProtocol.select(i);
}
}
boolean verboseModeAttr = configuration.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE, IMILaunchConfigurationConstants.DEBUGGER_VERBOSE_MODE_DEFAULT);
verboseMode.setSelection(verboseModeAttr);
@ -358,6 +365,13 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
int portNumberAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER);
portNumber.setText(String.valueOf(portNumberAttr));
String jtagDeviceString = configuration.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, "");
for (int i = 0; i < jtagDevice.getItemCount(); i++) {
if (jtagDevice.getItem(i).equals(jtagDeviceString)) {
jtagDevice.select(i);
}
}
} catch (CoreException e) {
Activator.getDefault().getLog().log(e.getStatus());
}
@ -365,13 +379,10 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbCommand.getText().trim());
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, gdbinitFile.getText().trim());
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, commandFactory.getText());
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, miProtocol.getText());
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE, verboseMode.getSelection());
configuration.setAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, jtagDevice.getText());
configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, useRemote.getSelection());
configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ipAddress.getText().trim());
try {
@ -383,15 +394,11 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
CommandFactoryManager cfManager = MIPlugin.getDefault().getCommandFactoryManager();
CommandFactoryDescriptor defDesc = cfManager.getDefaultDescriptor(IGDBJtagConstants.DEBUGGER_ID);
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, defDesc.getName());
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, defDesc.getMIVersions()[0]);
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE, IMILaunchConfigurationConstants.DEBUGGER_VERBOSE_MODE_DEFAULT);
configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET);
configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, IGDBJtagConstants.DEFAULT_IP_ADDRESS);
configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 QNX Software Systems and others.
* Copyright (c) 2007 - 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Andy Jin - Hardware debugging UI improvements, bug 229946
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.ui;
@ -14,17 +15,22 @@ package org.eclipse.cdt.debug.gdbjtag.ui;
import java.io.File;
import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConstants;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.debug.ui.StringVariableSelectionDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@ -34,23 +40,44 @@ import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.views.navigator.ResourceComparator;
/**
* @author Doug Schaefer
*
*/
public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
private static final String TAB_NAME = "Startup";
Text initCommands;
Text delay;
Button doReset;
Button loadImage;
Text imageFileName;
Button imageFileBrowseWs;
Button imageFileBrowse;
Button imageFileVariables;
Text imageOffset;
Button loadSymbols;
Text symbolsFileName;
Button symbolsFileBrowseWs;
Button symbolsFileBrowse;
Text symbolsOffset;
Button setPcRegister;
Text pcRegister;
Button setStopAt;
Text stopAt;
Button setResume;
boolean resume = false;
Text runCommands;
Button runCommandVariables;
public String getName() {
return "Startup";
return TAB_NAME;
}
public Image getImage() {
@ -70,6 +97,7 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
createInitGroup(comp);
createLoadGroup(comp);
createRunOptionGroup(comp);
createRunGroup(comp);
sc.setMinSize(comp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
@ -87,10 +115,18 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
text.setText(str);
}
private void variablesButtonSelected(Text text) {
StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
dialog.open();
text.append(dialog.getVariableExpression());
private void browseWsButtonSelected(String title, Text text) {
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
dialog.setTitle(title);
dialog.setMessage(Messages.getString("GDBJtagStartupTab.FileBrowseWs_Message"));
dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
if (dialog.open() == IDialogConstants.OK_ID) {
IResource resource = (IResource) dialog.getFirstResult();
String arg = resource.getFullPath().toOSString();
String fileLoc = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", arg); //$NON-NLS-1$
text.setText(fileLoc);
}
}
public void createInitGroup(Composite parent) {
@ -99,11 +135,42 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
group.setLayout(layout);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
group.setLayoutData(gd);
group.setText("Initialization Commands");
group.setText(Messages.getString("GDBJtagStartupTab.initGroup_Text"));
doReset = new Button(group, SWT.CHECK);
doReset.setText(Messages.getString("GDBJtagStartupTab.doReset_Text"));
doReset.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
doResetChanged();
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);
gd = new GridData();
gd.widthHint = 60;
delay.setLayoutData(gd);
delay.addVerifyListener(new VerifyListener() {
public void verifyText(VerifyEvent e) {
e.doit = (Character.isDigit(e.character) || Character.isISOControl(e.character));
}
});
delay.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateLaunchConfigurationDialog();
}
});
initCommands = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 100;
gd.heightHint = 60;
initCommands.setLayoutData(gd);
initCommands.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
@ -111,31 +178,22 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
}
});
Button varsButton = new Button(group, SWT.NONE);
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
varsButton.setLayoutData(gd);
varsButton.setText("Variables...");
varsButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
variablesButtonSelected(initCommands);
}
});
}
private void createLoadGroup(Composite parent) {
Group group = new Group(parent, SWT.NONE);
GridLayout layout = new GridLayout();
group.setLayout(layout);
layout.numColumns = 3;
layout.numColumns = 4;
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 1;
group.setLayoutData(gd);
group.setText("Load Image");
group.setText(Messages.getString("GDBJtagStartupTab.loadGroup_Text"));
loadImage = new Button(group, SWT.CHECK);
loadImage.setText("Automatically load image");
loadImage.setText(Messages.getString("GDBJtagStartupTab.loadImage_Text"));
gd = new GridData();
gd.horizontalSpan = 3;
gd.horizontalSpan = 4;
loadImage.setLayoutData(gd);
loadImage.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@ -144,43 +202,224 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
}
});
Label label = new Label(group, SWT.NONE);
gd = new GridData();
gd.horizontalSpan = 3;
label.setLayoutData(gd);
label.setText("Image file name:");
Composite comp = new Composite(group, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 4;
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
comp.setLayout(layout);
imageFileName = new Text(group, SWT.BORDER);
Label imageLabel = new Label(comp, SWT.NONE);
imageLabel.setText(Messages.getString("GDBJtagStartupTab.imageLabel_Text"));
imageFileName = new Text(comp, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 1;
imageFileName.setLayoutData(gd);
imageFileName.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateLaunchConfigurationDialog();
}
});
imageFileBrowse = new Button(group, SWT.NONE);
imageFileBrowse.setText("Browse...");
imageFileBrowseWs = createPushButton(comp, Messages.getString("GDBJtagStartupTab.FileBrowseWs_Label"), null);
imageFileBrowseWs.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
browseWsButtonSelected(Messages.getString("GDBJtagStartupTab.imageFileBrowseWs_Title"), imageFileName);
}
});
imageFileBrowse = createPushButton(comp, Messages.getString("GDBJtagStartupTab.FileBrowse_Label"), null);
imageFileBrowse.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
browseButtonSelected("Select image file", imageFileName);
browseButtonSelected(Messages.getString("GDBJtagStartupTab.imageFileBrowse_Title"), imageFileName);
}
});
Label imageOffsetLabel = new Label(comp, SWT.NONE);
imageOffsetLabel.setText(Messages.getString("GDBJtagStartupTab.imageOffsetLabel_Text"));
imageOffset = new Text(comp, SWT.BORDER);
gd = new GridData();
gd.horizontalSpan = 1;
gd.widthHint = 100;
imageOffset.setLayoutData(gd);
imageOffset.addVerifyListener(new VerifyListener() {
public void verifyText(VerifyEvent e) {
e.doit = (Character.isDigit(e.character) || Character.isISOControl(e.character) || "abcdef".contains(String.valueOf(e.character).toLowerCase()));
}
});
imageOffset.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateLaunchConfigurationDialog();
}
});
imageFileVariables = new Button(group, SWT.NONE);
imageFileVariables.setText("Variables...");
imageFileVariables.addSelectionListener(new SelectionAdapter() {
loadSymbols = new Button(group, SWT.CHECK);
loadSymbols.setText(Messages.getString("GDBJtagStartupTab.loadSymbols_Text"));
gd = new GridData();
gd.horizontalSpan = 4;
loadSymbols.setLayoutData(gd);
loadSymbols.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
variablesButtonSelected(imageFileName);
loadSymbolsChanged();
updateLaunchConfigurationDialog();
}
});
comp = new Composite(group, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 4;
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
comp.setLayout(layout);
Label symbolLabel = new Label(comp, SWT.NONE);
symbolLabel.setText(Messages.getString("GDBJtagStartupTab.symbolsLabel_Text"));
symbolsFileName = new Text(comp, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 1;
symbolsFileName.setLayoutData(gd);
symbolsFileName.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateLaunchConfigurationDialog();
}
});
symbolsFileBrowseWs = createPushButton(comp, Messages.getString("GDBJtagStartupTab.FileBrowseWs_Label"), null);
symbolsFileBrowseWs.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
browseWsButtonSelected(Messages.getString("GDBJtagStartupTab.symbolsFileBrowseWs_Title"), symbolsFileName);
}
});
symbolsFileBrowse = createPushButton(comp, Messages.getString("GDBJtagStartupTab.FileBrowse_Label"), null);
symbolsFileBrowse.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
browseButtonSelected(Messages.getString("GDBJtagStartupTab.symbolsFileBrowse_Title"), symbolsFileName);
}
});
Label symbolsOffsetLabel = new Label(comp, SWT.NONE);
symbolsOffsetLabel.setText(Messages.getString("GDBJtagStartupTab.symbolsOffsetLabel_Text"));
symbolsOffset = new Text(comp, SWT.BORDER);
gd = new GridData();
gd.horizontalSpan = 1;
gd.widthHint = 100;
symbolsOffset.setLayoutData(gd);
symbolsOffset.addVerifyListener(new VerifyListener() {
public void verifyText(VerifyEvent e) {
e.doit = (Character.isDigit(e.character) || Character.isISOControl(e.character) || "abcdef".contains(String.valueOf(e.character).toLowerCase()));
}
});
symbolsOffset.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateLaunchConfigurationDialog();
}
});
}
public void createRunOptionGroup(Composite parent) {
Group group = new Group(parent, SWT.NONE);
GridLayout layout = new GridLayout();
group.setLayout(layout);
layout.numColumns = 2;
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 1;
group.setLayoutData(gd);
group.setText(Messages.getString("GDBJtagStartupTab.runOptionGroup_Text"));
setPcRegister = new Button(group, SWT.CHECK);
setPcRegister.setText(Messages.getString("GDBJtagStartupTab.setPcRegister_Text"));
gd = new GridData();
gd.horizontalSpan = 1;
setPcRegister.setLayoutData(gd);
setPcRegister.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
pcRegisterChanged();
updateLaunchConfigurationDialog();
}
});
pcRegister = new Text(group, SWT.BORDER);
gd = new GridData();
gd.horizontalSpan = 1;
gd.widthHint = 100;
pcRegister.setLayoutData(gd);
pcRegister.addVerifyListener(new VerifyListener() {
public void verifyText(VerifyEvent e) {
e.doit = (Character.isDigit(e.character) || Character.isISOControl(e.character) || "abcdef".contains(String.valueOf(e.character).toLowerCase()));
}
});
pcRegister.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateLaunchConfigurationDialog();
}
});
setStopAt = new Button(group, SWT.CHECK);
setStopAt.setText(Messages.getString("GDBJtagStartupTab.setStopAt_Text"));
gd = new GridData();
gd.horizontalSpan = 1;
setStopAt.setLayoutData(gd);
setStopAt.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
stopAtChanged();
updateLaunchConfigurationDialog();
}
});
stopAt = new Text(group, SWT.BORDER);
gd = new GridData();
gd.horizontalSpan = 1;
gd.widthHint = 100;
stopAt.setLayoutData(gd);
stopAt.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateLaunchConfigurationDialog();
}
});
setResume = new Button(group, SWT.CHECK);
setResume.setText(Messages.getString("GDBJtagStartupTab.setResume_Text"));
gd = new GridData();
gd.horizontalSpan = 1;
setResume.setLayoutData(gd);
setResume.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
resumeChanged();
updateLaunchConfigurationDialog();
}
});
}
private void doResetChanged() {
delay.setEnabled(doReset.getSelection());
}
private void loadImageChanged() {
boolean enabled = loadImage.getSelection();
imageFileName.setEnabled(enabled);
imageFileBrowseWs.setEnabled(enabled);
imageFileBrowse.setEnabled(enabled);
imageFileVariables.setEnabled(enabled);
imageOffset.setEnabled(enabled);
}
private void loadSymbolsChanged() {
boolean enabled = loadSymbols.getSelection();
symbolsFileName.setEnabled(enabled);
symbolsFileBrowseWs.setEnabled(enabled);
symbolsFileBrowse.setEnabled(enabled);
symbolsOffset.setEnabled(enabled);
}
private void pcRegisterChanged() {
pcRegister.setEnabled(setPcRegister.getSelection());
}
private void stopAtChanged() {
stopAt.setEnabled(setStopAt.getSelection());
}
private void resumeChanged() {
resume = setResume.getSelection();
}
public void createRunGroup(Composite parent) {
@ -189,35 +428,41 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
group.setLayout(layout);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
group.setLayoutData(gd);
group.setText("Run Commands");
group.setText(Messages.getString("GDBJtagStartupTab.runGroup_Text"));
runCommands = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 100;
gd.heightHint = 60;
runCommands.setLayoutData(gd);
runCommands.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
updateLaunchConfigurationDialog();
}
});
runCommandVariables = new Button(group, SWT.NONE);
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
runCommandVariables.setLayoutData(gd);
runCommandVariables.setText("Variables...");
runCommandVariables.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
variablesButtonSelected(runCommands);
}
});
}
public void initializeFrom(ILaunchConfiguration configuration) {
try {
initCommands.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, "")); //$NON-NLS-1$
doReset.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET));
doResetChanged();
delay.setText(String.valueOf(configuration.getAttribute(IGDBJtagConstants.ATTR_DELAY, IGDBJtagConstants.DEFAULT_DELAY)));
loadImage.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE));
loadImageChanged();
imageFileName.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, "")); //$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));
loadSymbolsChanged();
symbolsFileName.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, "")); //$NON-NLS-1$
symbolsOffset.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, "")); //$NON-NLS-1$
setPcRegister.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER));
pcRegisterChanged();
pcRegister.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, "")); //$NON-NLS-1$
setStopAt.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT));
stopAtChanged();
stopAt.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, "")); //$NON-NLS-1$
setResume.setSelection(configuration.getAttribute(IGDBJtagConstants.ATTR_SET_RESUME, IGDBJtagConstants.DEFAULT_SET_RESUME));
resumeChanged();
runCommands.setText(configuration.getAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, "")); //$NON-NLS-1$)
} catch (CoreException e) {
Activator.getDefault().getLog().log(e.getStatus());
@ -226,8 +471,19 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(IGDBJtagConstants.ATTR_INIT_COMMANDS, initCommands.getText());
configuration.setAttribute(IGDBJtagConstants.ATTR_DELAY, Integer.parseInt(delay.getText()));
configuration.setAttribute(IGDBJtagConstants.ATTR_DO_RESET, doReset.getSelection());
configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, loadImage.getSelection());
configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, imageFileName.getText().trim());
configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, imageOffset.getText());
configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_SYMBOLS, loadSymbols.getSelection());
configuration.setAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, symbolsOffset.getText());
configuration.setAttribute(IGDBJtagConstants.ATTR_SYMBOLS_FILE_NAME, symbolsFileName.getText().trim());
configuration.setAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, setPcRegister.getSelection());
configuration.setAttribute(IGDBJtagConstants.ATTR_PC_REGISTER, pcRegister.getText());
configuration.setAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, setStopAt.getSelection());
configuration.setAttribute(IGDBJtagConstants.ATTR_STOP_AT, stopAt.getText());
configuration.setAttribute(IGDBJtagConstants.ATTR_SET_RESUME, setResume.getSelection());
configuration.setAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, runCommands.getText());
}
@ -236,6 +492,7 @@ public class GDBJtagStartupTab extends AbstractLaunchConfigurationTab {
configuration.setAttribute(IGDBJtagConstants.ATTR_LOAD_IMAGE, IGDBJtagConstants.DEFAULT_LOAD_IMAGE);
configuration.setAttribute(IGDBJtagConstants.ATTR_IMAGE_FILE_NAME, ""); //$NON-NLS-1$
configuration.setAttribute(IGDBJtagConstants.ATTR_RUN_COMMANDS, ""); //$NON-NLS-1$
configuration.setAttribute(IGDBJtagConstants.ATTR_DO_RESET, true);
}
}

View file

@ -0,0 +1,41 @@
GDBJtagStartupTab.initGroup_Text=Initialization Commands
GDBJtagStartupTab.doReset_Text=Automatically reset board and halt
GDBJtagStartupTab.delayLabel_Text=Delay (s):
GDBJtagStartupTab.loadGroup_Text=Load Image and Symbols
GDBJtagStartupTab.loadImage_Text=Automatically load image
GDBJtagStartupTab.imageLabel_Text=Image file name:
GDBJtagStartupTab.imageFileBrowseWs_Title=Select image file
GDBJtagStartupTab.imageFileBrowse_Title=Select image file
GDBJtagStartupTab.imageOffsetLabel_Text=Image offset:
GDBJtagStartupTab.FileBrowseWs_Label=Workspace...
GDBJtagStartupTab.FileBrowseWs_Message=Select a workspace resource
GDBJtagStartupTab.FileBrowse_Label=File System...
GDBJtagStartupTab.FileBrowse_Message=Select a file from file system
GDBJtagStartupTab.loadSymbols_Text=Automatically load symbols
GDBJtagStartupTab.symbolsLabel_Text=Symbol file name:
GDBJtagStartupTab.symbolsFileBrowseWs_Title=Select symbols file
GDBJtagStartupTab.symbolsFileBrowse_Title=Select symbols file
GDBJtagStartupTab.symbolsOffsetLabel_Text=Symbols offset:
GDBJtagStartupTab.runOptionGroup_Text=Runtime Options
GDBJtagStartupTab.setPcRegister_Text=Automatically set program counter at:
GDBJtagStartupTab.setStopAt_Text=Automatically stop on startup at:
GDBJtagStartupTab.setResume_Text=Automatically resume
GDBJtagStartupTab.runGroup_Text=Run Commands
GDBJtagDebuggerTab.gdbSetupGroup_Text=GDB Setup
GDBJtagDebuggerTab.gdbCommandLabel=GDB Command:
GDBJtagDebuggerTab.gdbCommandBrowse=Browse...
GDBJtagDebuggerTab.gdbCommandBrowse_Title=Select GDB Binary
GDBJtagDebuggerTab.gdbCommandVariable=Variables...
GDBJtagDebuggerTab.commandFactoryLabel=Command Set:
GDBJtagDebuggerTab.miProtocolLabel=Protocol Version:
GDBJtagDebuggerTab.verboseModeLabel=Verbose console mode
GDBJtagDebuggerTab.remoteGroup_Text=Remote Target
GDBJtagDebuggerTab.useRemote_Text=Use remote target
GDBJtagDebuggerTab.jtagDeviceLabel=JTAG Device:
GDBJtagDebuggerTab.ipAddressLabel=Host name or IP address:
GDBJtagDebuggerTab.portNumberLabel=Port number:

View file

@ -0,0 +1,34 @@
package org.eclipse.cdt.debug.gdbjtag.ui;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class Messages {
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.gdbjtag.ui.JtagUi"; //$NON-NLS-1$
private static /* final */ ResourceBundle RESOURCE_BUNDLE; // = ResourceBundle.getBundle(BUNDLE_NAME);
static {
try {
RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
} catch (MissingResourceException e) {
System.out.println(e.getMessage());
}
}
private Messages() {
}
public static String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
}
public static ResourceBundle getResourceBundle() {
return RESOURCE_BUNDLE;
}
}