From 9b9fedb9fd11b380b0210069c53057cf4c83400b Mon Sep 17 00:00:00 2001 From: Alena Laskavaia Date: Thu, 6 May 2010 16:57:16 +0000 Subject: [PATCH] Bug 305943 Support for transport specific devices, based on patch from Bruce Griffith --- .../schema/JTagDevice.exsd | 35 +-- .../cdt/debug/gdbjtag/core/Activator.java | 7 + .../core/GDBJtagDSFFinalLaunchSequence.java | 21 +- .../debug/gdbjtag/core/GDBJtagDebugger.java | 23 +- .../gdbjtag/core/IGDBJtagConnection.java | 48 ++++ .../debug/gdbjtag/core/IGDBJtagConstants.java | 7 +- .../DefaultGDBJtagConnectionImpl.java | 60 +++++ .../jtagdevice/GDBJtagDeviceContribution.java | 47 ++-- .../GDBJtagDeviceContributionFactory.java | 27 ++- .../core/jtagdevice/IGDBJtagDevice.java | 6 +- .../plugin.properties | 10 +- .../plugin.xml | 18 ++ .../gdbjtag/ui/GDBJtagDSFDebuggerTab.java | 206 ++++++++++++++---- .../debug/gdbjtag/ui/GDBJtagDebuggerTab.java | 196 +++++++++++++---- .../cdt/debug/gdbjtag/ui/JtagUi.properties | 6 +- 15 files changed, 580 insertions(+), 137 deletions(-) create mode 100644 jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConnection.java create mode 100644 jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagConnectionImpl.java diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/schema/JTagDevice.exsd b/jtag/org.eclipse.cdt.debug.gdbjtag.core/schema/JTagDevice.exsd index b4b24b6b732..6ffa24bdda8 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/schema/JTagDevice.exsd +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/schema/JTagDevice.exsd @@ -1,16 +1,21 @@ - + - [Enter description of this extension point.] + Jtag device extension point + + + + + @@ -44,27 +49,37 @@ - + Unique if of the jtag device contribution. - + Name of the JTag device. - + Class that implements IGDBJtagDevice and provides default commands used by debbuger for various set-up tasks. It is recommended tp extend DefaultGDBJtagConnectionImpl class. + + + + This field can be used to set the default connection string for GDB. It is + not used when the "class" parameter specifies a jtagdevice subclass that + overrides the default implementation of the getDefaultDeviceConnection() + method. + + + @@ -73,7 +88,7 @@ - [Enter the first release in which this extension point appears.] + 5.0 @@ -104,13 +119,5 @@ - - - - - - - - diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Activator.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Activator.java index 27b10807500..7907f2e8e3a 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Activator.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/Activator.java @@ -14,6 +14,7 @@ package org.eclipse.cdt.debug.gdbjtag.core; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Plugin; +import org.eclipse.core.runtime.Status; import org.osgi.framework.BundleContext; /** @@ -74,5 +75,11 @@ public class Activator extends Plugin { public static void log(IStatus status) { getDefault().getLog().log(status); } + /** + * @since 7.0 + */ + public static void log(Throwable t) { + getDefault().getLog().log(new Status(Status.ERROR, PLUGIN_ID, t.getMessage(), t)); + } } diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFFinalLaunchSequence.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFFinalLaunchSequence.java index b374352b100..b3434430248 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFFinalLaunchSequence.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFFinalLaunchSequence.java @@ -8,6 +8,9 @@ * Contributors: * Ericsson - initial API and implementation this class is based on * QNX Software Systems - Initial implementation for Jtag debugging + * Sage Electronic Engineering, LLC - bug 305943 + * - API generalization to become transport-independent (allow + * connections via serial ports and pipes). *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core; @@ -16,6 +19,8 @@ package org.eclipse.cdt.debug.gdbjtag.core; * */ +import java.net.URI; +import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; @@ -373,10 +378,17 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence { ILaunchConfiguration config = fLaunch.getLaunchConfiguration(); try { if (config.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET)) { - String ipAddress = config.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, IGDBJtagConstants.DEFAULT_IP_ADDRESS); - int portNumber = config.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER); List commands = new ArrayList(); - fGdbJtagDevice.doRemote(ipAddress, portNumber, commands); + if (fGdbJtagDevice instanceof IGDBJtagConnection) { + URI uri = new URI(config.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, "")); + IGDBJtagConnection device = (IGDBJtagConnection)fGdbJtagDevice; + device.doRemote(uri.getSchemeSpecificPart(), commands); + } else { + // Handle legacy network device contributions that don't understand URIs + String ipAddress = config.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ""); + int portNumber = config.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, 0); + fGdbJtagDevice.doRemote(ipAddress, portNumber, commands); + } queueCommands(commands, rm); } else { rm.done(); @@ -384,6 +396,9 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence { } catch (CoreException e) { rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Cannot connect to remote target", e)); //$NON-NLS-1$ rm.done(); + } catch (URISyntaxException e) { + rm.setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Invalid remote target connection syntax", e)); //$NON-NLS-1$ + rm.done(); } }}, /* diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java index 10847446069..0dbfc111028 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDebugger.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 - 2008 QNX Software Systems and others. + * Copyright (c) 2007 - 2010 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 @@ -9,11 +9,16 @@ * Doug Schaefer, Adrian Petrescu - QNX Software Systems - Initial API and implementation * Andy Jin - Hardware debugging UI improvements, bug 229946 * Peter Vidler - Monitor support (progress and cancellation) bug 242699 + * Bruce Griffith, Sage Electronic Engineering, LLC - bug 305943 + * - API generalization to become transport-independent (allow + * connections via serial ports and pipes). *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core; import java.io.File; +import java.net.URI; +import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; @@ -118,9 +123,19 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger { boolean useRemote = config.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET); if (useRemote) { submonitor.subTask(Messages.getString("GDBJtagDebugger.2")); //$NON-NLS-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); + try { + if (gdbJtagDevice instanceof IGDBJtagConnection) { + URI connection = new URI(config.getAttribute(IGDBJtagConstants.ATTR_CONNECTION, "")); //$NON-NLS-1$ + IGDBJtagConnection device = (IGDBJtagConnection)gdbJtagDevice; + device.doRemote(connection.getSchemeSpecificPart(), commands); + } else { + String ipAddress = config.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ""); //$NON-NLS-1$ + int portNumber = config.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, 0); + gdbJtagDevice.doRemote(ipAddress, portNumber, commands); + } + } catch (URISyntaxException e) { + throw new OperationCanceledException(); + } executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(10)); if (submonitor.isCanceled()) { throw new OperationCanceledException(); diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConnection.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConnection.java new file mode 100644 index 00000000000..1eb797a41b2 --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConnection.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 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 + * Sage Electronic Engineering, LLC - bug 305943 + * - API generalization to become transport-independent (e.g. to + * allow connections via serial ports and pipes). + *******************************************************************************/ + +package org.eclipse.cdt.debug.gdbjtag.core; + +import java.util.Collection; + +/** + * Provides device specific debug commands for different hardware + * JTAG devices. See DefaultGDBJtagDeviceImpl for + * the default implementations. + * @since 7.0 + */ +public interface IGDBJtagConnection { + + /** + * Used during instantiation to set the device default connection string from XML + * @param connection A device specific default connection string that GDB understands + */ + public void setDefaultDeviceConnection(String connection); + + /** + * Commands to connect to remote JTAG device + * @param connection defines the gdb string required to establish a connection to the target + * @param commands gdb commands to execute on the remote device (usually the target probe) + */ + public void doRemote(String connection, Collection commands); + + /** + * Host specific default device name used by GDB to connect to a device + * @return identifier for the remote device. It is up to GDB to figure out how to interpret + * the connection string (e.g /dev/COM1, 127.0.0.1:8888, etc.) + */ + public String getDefaultDeviceConnection(); + +} diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java index 977c64e132d..aa8905f6e81 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java @@ -23,13 +23,18 @@ public interface IGDBJtagConstants { // Debugger 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$ + /** @since 7.0 */ + public static final String ATTR_CONNECTION = Activator.PLUGIN_ID + ".connection"; //$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$ public static final int DEFAULT_PORT_NUMBER = 10000; - + /** + * @since 7.0 + */ + public static final String DEFAULT_CONNECTION = "localhost:10000"; //$NON-NLS-1$ // 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$ diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagConnectionImpl.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagConnectionImpl.java new file mode 100644 index 00000000000..76ce10c4b1b --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagConnectionImpl.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2010 Sage Electronic Engineering 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: + * Bruce Griffith,Sage Electronic Engineering, LLC - bug 305943 + * - API generalization to become transport-independent (e.g. to + * allow connections via serial ports and pipes). + *******************************************************************************/ + +package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; + +import java.util.Collection; + +import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConnection; + +/** + * @since 7.0 + */ +public class DefaultGDBJtagConnectionImpl extends DefaultGDBJtagDeviceImpl implements IGDBJtagConnection { + + protected String connection = null; + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doDelay(int, java.util.Collection) + */ + public final void setDefaultDeviceConnection(String connection) { + this.connection = connection; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#doRemote(java.lang.String, java.util.Collection) + */ + public void doRemote(String connection, Collection commands) { + String cmd = ""; //$NON-NLS-1$ + if (connection != null) { + cmd = "target remote " + connection; //$NON-NLS-1$ + addCmd(commands, cmd); + } + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice#getDefaultDeviceConnection() + */ + public String getDefaultDeviceConnection() { + return connection; + } + + public String getDefaultIpAddress() { + throw new UnsupportedOperationException(); + } + + public String getDefaultPortNumber() { + throw new UnsupportedOperationException(); + } + +} diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContribution.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContribution.java index 524fde57c44..dce6822e7b9 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContribution.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContribution.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 QNX Software Systems and others. + * Copyright (c) 2008 - 2010 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 @@ -8,22 +8,27 @@ * Contributors: * QNX Software Systems - Initial API and implementation * Andy Jin - Hardware debugging UI improvements, bug 229946 + * Bruce Griffith, Sage Electronic Engineering, LLC - bug 305943 + * - API generalization to become transport-independent (allow + * connections via serial ports and pipes). *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; import org.eclipse.cdt.debug.gdbjtag.core.Activator; +import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConnection; 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 GDBJtagDeviceContribution { - + private String deviceId; private String deviceName; private String deviceClassName; private IGDBJtagDevice device; private String deviceClassBundleName; + private String deviceDefaultConnection; /** * @return the deviceId @@ -74,30 +79,30 @@ public class GDBJtagDeviceContribution { public void setDeviceClassBundleName(String deviceClassBundleName) { this.deviceClassBundleName = deviceClassBundleName; } - + + /** + * @since 7.0 + */ + public void setDeviceDefaultConnection(String connection) { + this.deviceDefaultConnection = connection; + } + public IGDBJtagDevice getDevice() throws NullPointerException { - if (device != null) - return device; + if (device != null) return device; Object o = null; try { o = Platform.getBundle(deviceClassBundleName).loadClass(deviceClassName).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(); + if (o instanceof IGDBJtagConnection) { + ((IGDBJtagConnection) o).setDefaultDeviceConnection(deviceDefaultConnection); + } + device = (IGDBJtagDevice) o; + return device; + } catch (Exception e) { + Activator.log(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, + "Error instantiating " + getDeviceClassName() + " class", e)); //$NON-NLS-1$ //$NON-NLS-2$ + return null; } - return device = (IGDBJtagDevice) o; + } } diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContributionFactory.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContributionFactory.java index 01c6f868fae..47a858217a2 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContributionFactory.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContributionFactory.java @@ -8,12 +8,16 @@ * Contributors: * QNX Software Systems - Initial API and implementation * Andy Jin - Hardware debugging UI improvements, bug 229946 + * Bruce Griffith, Sage Electronic Engineering, LLC - bug 305943 + * - API generalization to become transport-independent (allow + * connections via serial ports and pipes). *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; import java.util.ArrayList; import org.eclipse.cdt.debug.gdbjtag.core.Activator; +import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConstants; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IStatus; @@ -22,19 +26,19 @@ 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 final String EXTENSION_POINT_NAME = "JTagDevice"; //$NON-NLS-1$ + private static final String MAIN_ELEMENT = "device"; //$NON-NLS-1$ private static GDBJtagDeviceContributionFactory instance; - protected ArrayList contributions; + protected ArrayList contributions; private GDBJtagDeviceContributionFactory() { - contributions = new ArrayList(); + contributions = new ArrayList(); loadSubtypeContributions(); } public GDBJtagDeviceContribution[] getGDBJtagDeviceContribution() { - return (GDBJtagDeviceContribution[]) contributions.toArray( + return contributions.toArray( new GDBJtagDeviceContribution[contributions.size()]); } @@ -48,13 +52,15 @@ public class GDBJtagDeviceContributionFactory { 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"); + String id = getRequired(configurationElement, "id"); //$NON-NLS-1$ + String name = getRequired(configurationElement, "name"); //$NON-NLS-1$ + String className = getRequired(configurationElement, "class"); //$NON-NLS-1$ + String connection = getOptional(configurationElement, "default_connection", IGDBJtagConstants.DEFAULT_CONNECTION); //$NON-NLS-1$ GDBJtagDeviceContribution adapter = new GDBJtagDeviceContribution(); adapter.setDeviceId(id); adapter.setDeviceName(name); adapter.setDeviceClassName(className); + adapter.setDeviceDefaultConnection(connection); adapter.setDeviceClassBundleName(configurationElement.getContributor().getName()); addContribution(adapter); } @@ -83,4 +89,9 @@ public class GDBJtagDeviceContributionFactory { return elementValue; } + private static String getOptional(IConfigurationElement configurationElement, String name, String defaultValue) { + String elementValue = configurationElement.getAttribute(name); + return (elementValue != null) ? elementValue : defaultValue; + } + } diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/IGDBJtagDevice.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/IGDBJtagDevice.java index 2c9d1e74704..6bfa8053c0f 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/IGDBJtagDevice.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/IGDBJtagDevice.java @@ -54,7 +54,7 @@ public interface IGDBJtagDevice { * @param ip host name of IP address of JTAG device * @param port TCP socket port number of JTAG device * @param commands remote connection commands - + * @deprecated use @see IGDBJtagConnection#doRemote */ public void doRemote(String ip, int port, Collection commands); @@ -97,14 +97,14 @@ public interface IGDBJtagDevice { /** * Device specific default hostname of IP address * @return default hostname of IP address - + * @deprecated use @see IGDBJtagConnection#getDetaultDeviceConnection */ public String getDefaultIpAddress(); /** * Device specific default port number * @return default port number - + * @deprecated use @see IGDBJtagConnection#getDetaultDeviceConnection */ public String getDefaultPortNumber(); diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.properties b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.properties index 6dcbb710829..9f3521c439c 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.properties +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2007, 2009 QNX Software Systems and others. +# Copyright (c) 2007-2010 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 @@ -8,13 +8,19 @@ # Contributors: # QNX Software Systems - initial API and implementation # IBM Corporation +# Andy Jin (QNX) - Added DSF debugging, bug 248593 +# Bruce Griffith,Sage Electronic Engineering, LLC - bug 305943 +# - API generalization to become transport-independent (e.g. to +# allow connections via serial ports and pipes). ############################################################################### pluginName=Eclipse GDB Hardware Debug UI Plug-in providerName=Eclipse CDT AbatronBDI2000.name=Abatron BDI2000 MacraigorUsb2Demon.name=Macraigor USB2Demon -Generic.name=Generic +GenericSerial.name=Generic Serial +OpenOCDPipe.name=OpenOCD (via pipe) +Generic.name=Generic TCP/IP launchtab.cmaintab.name=Main launchtab.debuggertab.name=Debugger diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.xml b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.xml index 04c6f0ba1c8..352ffb0da54 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.xml +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/plugin.xml @@ -39,6 +39,24 @@ name="%MacraigorUsb2Demon.name"> + + + + + + + +