mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 305943 Support for transport specific devices, based on patch from Bruce Griffith
This commit is contained in:
parent
221d891570
commit
9b9fedb9fd
15 changed files with 580 additions and 137 deletions
|
@ -1,16 +1,21 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.eclipse.cdt.debug.gdbjtag.core">
|
||||
<schema targetNamespace="org.eclipse.cdt.debug.gdbjtag.core" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.schema plugin="org.eclipse.cdt.debug.gdbjtag.core" id="JTagDevice" name="%JTagDevice.name"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
Jtag device extension point
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.element />
|
||||
</appInfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element ref="device" minOccurs="1" maxOccurs="unbounded"/>
|
||||
|
@ -44,27 +49,37 @@
|
|||
<attribute name="id" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
Unique if of the jtag device contribution.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
Name of the JTag device.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
Class that implements IGDBJtagDevice and provides default commands used by debbuger for various set-up tasks. It is recommended tp extend DefaultGDBJtagConnectionImpl class.
|
||||
</documentation>
|
||||
<appInfo>
|
||||
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.IGDBJtagDevice"/>
|
||||
</appInfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="default_connection" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
|
@ -73,7 +88,7 @@
|
|||
<meta.section type="since"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
[Enter the first release in which this extension point appears.]
|
||||
5.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
|
@ -104,13 +119,5 @@
|
|||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<String> commands = new ArrayList<String>();
|
||||
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();
|
||||
}
|
||||
}},
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
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();
|
||||
|
|
|
@ -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 <code>DefaultGDBJtagDeviceImpl</code> 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<String> 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();
|
||||
|
||||
}
|
|
@ -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$
|
||||
|
|
|
@ -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<String> 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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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,10 +8,14 @@
|
|||
* 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;
|
||||
|
@ -24,6 +28,7 @@ public class GDBJtagDeviceContribution {
|
|||
private String deviceClassName;
|
||||
private IGDBJtagDevice device;
|
||||
private String deviceClassBundleName;
|
||||
private String deviceDefaultConnection;
|
||||
|
||||
/**
|
||||
* @return the deviceId
|
||||
|
@ -75,29 +80,29 @@ public class GDBJtagDeviceContribution {
|
|||
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);
|
||||
}
|
||||
return device = (IGDBJtagDevice) o;
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<GDBJtagDeviceContribution> contributions;
|
||||
|
||||
private GDBJtagDeviceContributionFactory() {
|
||||
contributions = new ArrayList();
|
||||
contributions = new ArrayList<GDBJtagDeviceContribution>();
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<String> 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();
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -39,6 +39,24 @@
|
|||
name="%MacraigorUsb2Demon.name">
|
||||
</device>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice">
|
||||
<device
|
||||
class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagConnectionImpl"
|
||||
default_connection="/dev/com1"
|
||||
id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GenericSerial"
|
||||
name="%GenericSerial.name">
|
||||
</device>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice">
|
||||
<device
|
||||
class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.DefaultGDBJtagConnectionImpl"
|
||||
default_connection="| openocd --pipe"
|
||||
id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.OpenOCD"
|
||||
name="%OpenOCDPipe.name">
|
||||
</device>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.debug.ui.launchConfigurationTabs">
|
||||
<tab
|
||||
|
|
|
@ -6,13 +6,25 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial implementation
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Andy Jin - Hardware debugging UI improvements, bug 229946
|
||||
* Anna Dushistova(MontaVista) - bug 241279
|
||||
* - Hardware Debugging: Host name or ip address not saving in
|
||||
* the debug configuration
|
||||
* 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).
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.debug.gdbjtag.ui;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import org.eclipse.cdt.debug.gdbjtag.core.Activator;
|
||||
import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConnection;
|
||||
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;
|
||||
|
@ -29,6 +41,7 @@ import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
|
|||
import org.eclipse.debug.ui.StringVariableSelectionDialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.ScrolledComposite;
|
||||
import org.eclipse.swt.custom.StackLayout;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
|
@ -57,9 +70,14 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
|
||||
private Text gdbCommand;
|
||||
private Button useRemote;
|
||||
private Combo jtagDevice;
|
||||
private Composite remoteConnectionParameters;
|
||||
private StackLayout remoteConnectParmsLayout;
|
||||
private Composite remoteTcpipBox;
|
||||
private Text ipAddress;
|
||||
private Text portNumber;
|
||||
private Combo jtagDevice;
|
||||
private Composite remoteConnectionBox;
|
||||
private Text connection;
|
||||
private String savedJtagDevice;
|
||||
protected Button fUpdateThreadlistOnSuspend;
|
||||
|
||||
|
@ -195,7 +213,6 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
jtagDevice.add(availableDevices[i].getDeviceName());
|
||||
}
|
||||
|
||||
jtagDevice.select(0);
|
||||
jtagDevice.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
updateDeviceIpPort(jtagDevice.getText());
|
||||
|
@ -203,24 +220,64 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
}
|
||||
});
|
||||
|
||||
label = new Label(comp, SWT.NONE);
|
||||
label.setText(Messages.getString("GDBJtagDebuggerTab.ipAddressLabel"));
|
||||
ipAddress = new Text(comp, SWT.BORDER);
|
||||
remoteConnectionParameters = new Composite(group, SWT.NO_TRIM | SWT.NO_FOCUS);
|
||||
remoteConnectParmsLayout = new StackLayout();
|
||||
remoteConnectionParameters.setLayout(remoteConnectParmsLayout);
|
||||
|
||||
//
|
||||
// Create entry fields for TCP/IP connections
|
||||
//
|
||||
|
||||
{
|
||||
remoteTcpipBox = new Composite(remoteConnectionParameters, SWT.NO_TRIM | SWT.NO_FOCUS);
|
||||
layout = new GridLayout();
|
||||
layout.numColumns = 2;
|
||||
remoteTcpipBox.setLayout(layout);
|
||||
remoteTcpipBox.setBackground(remoteConnectionParameters.getParent().getBackground());
|
||||
|
||||
label = new Label(remoteTcpipBox, SWT.NONE);
|
||||
label.setText(Messages.getString("GDBJtagDebuggerTab.ipAddressLabel")); //$NON-NLS-1$
|
||||
ipAddress = new Text(remoteTcpipBox, SWT.BORDER);
|
||||
gd = new GridData();
|
||||
gd.widthHint = 100;
|
||||
gd.widthHint = 125;
|
||||
ipAddress.setLayoutData(gd);
|
||||
|
||||
label = new Label(remoteTcpipBox, SWT.NONE);
|
||||
label.setText(Messages.getString("GDBJtagDebuggerTab.portNumberLabel")); //$NON-NLS-1$
|
||||
portNumber = new Text(remoteTcpipBox, SWT.BORDER);
|
||||
gd = new GridData();
|
||||
gd.widthHint = 125;
|
||||
portNumber.setLayoutData(gd);
|
||||
}
|
||||
|
||||
//
|
||||
// Create entry fields for other types of connections
|
||||
//
|
||||
|
||||
{
|
||||
remoteConnectionBox = new Composite(remoteConnectionParameters, SWT.NO_TRIM | SWT.NO_FOCUS);
|
||||
layout = new GridLayout();
|
||||
layout.numColumns = 2;
|
||||
remoteConnectionBox.setLayout(layout);
|
||||
remoteConnectionBox.setBackground(remoteConnectionParameters.getParent().getBackground());
|
||||
|
||||
label = new Label(remoteConnectionBox, SWT.NONE);
|
||||
label.setText(Messages.getString("GDBJtagDebuggerTab.connectionLabel")); //$NON-NLS-1$
|
||||
connection = new Text(remoteConnectionBox, SWT.BORDER);
|
||||
gd = new GridData();
|
||||
gd.widthHint = 125;
|
||||
connection.setLayoutData(gd);
|
||||
}
|
||||
|
||||
//
|
||||
// Add watchers for user data entry
|
||||
//
|
||||
|
||||
ipAddress.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
});
|
||||
|
||||
label = new Label(comp, SWT.NONE);
|
||||
label.setText(Messages.getString("GDBJtagDebuggerTab.portNumberLabel"));
|
||||
portNumber = new Text(comp, SWT.BORDER);
|
||||
gd = new GridData();
|
||||
gd.widthHint = 100;
|
||||
portNumber.setLayoutData(gd);
|
||||
portNumber.addVerifyListener(new VerifyListener() {
|
||||
public void verifyText(VerifyEvent e) {
|
||||
e.doit = Character.isDigit(e.character) || Character.isISOControl(e.character);
|
||||
|
@ -231,6 +288,12 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
});
|
||||
|
||||
connection.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -246,10 +309,14 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
if (name.equals(selectedDeviceName)) {
|
||||
selectedDevice = availableDevices[i].getDevice();
|
||||
if (selectedDevice != null) {
|
||||
String ip = selectedDevice.getDefaultIpAddress();
|
||||
ipAddress.setText(ip);
|
||||
String port = selectedDevice.getDefaultPortNumber();
|
||||
portNumber.setText(port);
|
||||
if (selectedDevice instanceof IGDBJtagConnection) {
|
||||
IGDBJtagConnection connectionDevice = (IGDBJtagConnection)selectedDevice;
|
||||
connection.setText(connectionDevice.getDefaultDeviceConnection());
|
||||
} else {
|
||||
ipAddress.setText(selectedDevice.getDefaultIpAddress());
|
||||
portNumber.setText(selectedDevice.getDefaultPortNumber());
|
||||
}
|
||||
useRemoteChanged();
|
||||
updateLaunchConfigurationDialog();
|
||||
break;
|
||||
}
|
||||
|
@ -262,6 +329,31 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
jtagDevice.setEnabled(enabled);
|
||||
ipAddress.setEnabled(enabled);
|
||||
portNumber.setEnabled(enabled);
|
||||
connection.setEnabled(enabled);
|
||||
GDBJtagDeviceContribution selectedDeviceEntry = findJtagDeviceByName(jtagDevice.getText());
|
||||
if ((selectedDeviceEntry == null) || (selectedDeviceEntry.getDevice() == null)) {
|
||||
remoteConnectParmsLayout.topControl = null;
|
||||
remoteConnectionParameters.layout();
|
||||
} else {
|
||||
IGDBJtagDevice device = selectedDeviceEntry.getDevice();
|
||||
if (device instanceof IGDBJtagConnection) {
|
||||
remoteConnectParmsLayout.topControl = remoteConnectionBox;
|
||||
remoteConnectionBox.getParent().layout();
|
||||
} else {
|
||||
remoteConnectParmsLayout.topControl = remoteTcpipBox;
|
||||
remoteTcpipBox.getParent().layout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private GDBJtagDeviceContribution findJtagDeviceByName(String name) {
|
||||
GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance().getGDBJtagDeviceContribution();
|
||||
for (GDBJtagDeviceContribution device : availableDevices) {
|
||||
if (device.getDeviceName().equals(name)) {
|
||||
return device;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void initializeFrom(ILaunchConfiguration configuration) {
|
||||
|
@ -273,25 +365,45 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
boolean useRemoteAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET,
|
||||
IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET);
|
||||
useRemote.setSelection(useRemoteAttr);
|
||||
useRemoteChanged();
|
||||
|
||||
String ipAddressAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS,
|
||||
IGDBJtagConstants.DEFAULT_IP_ADDRESS);
|
||||
ipAddress.setText(ipAddressAttr);
|
||||
|
||||
int portNumberAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER,
|
||||
IGDBJtagConstants.DEFAULT_PORT_NUMBER);
|
||||
portNumber.setText(String.valueOf(portNumberAttr));
|
||||
|
||||
savedJtagDevice = configuration.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, "");
|
||||
if (savedJtagDevice.isEmpty()) {
|
||||
jtagDevice.select(0);
|
||||
} else {
|
||||
String storedAddress = ""; //$NON-NLS-1$
|
||||
int storedPort = 0;
|
||||
String storedConnection = ""; //$NON-NLS-1$
|
||||
|
||||
for (int i = 0; i < jtagDevice.getItemCount(); i++) {
|
||||
if (jtagDevice.getItem(i).equals(savedJtagDevice)) {
|
||||
storedAddress = configuration.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ""); //$NON-NLS-1$
|
||||
storedPort = configuration.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, 0);
|
||||
storedConnection = configuration.getAttribute(IGDBJtagConstants.ATTR_CONNECTION, ""); //$NON-NLS-1$
|
||||
jtagDevice.select(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (storedConnection!=null) {
|
||||
try {
|
||||
connection.setText(new URI(storedConnection).getSchemeSpecificPart());
|
||||
} catch (URISyntaxException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
if (storedAddress!=null)
|
||||
{
|
||||
// Treat as legacy network probe
|
||||
ipAddress.setText(storedAddress);
|
||||
String portString = (0<storedPort)&&(storedPort<=65535) ? Integer.valueOf(storedPort).toString() : ""; //$NON-NLS-1$
|
||||
portNumber.setText(portString);
|
||||
}
|
||||
}
|
||||
boolean updateThreadsOnSuspend = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND_DEFAULT);
|
||||
fUpdateThreadlistOnSuspend.setSelection(updateThreadsOnSuspend);
|
||||
|
||||
useRemoteChanged();
|
||||
} catch (CoreException e) {
|
||||
Activator.getDefault().getLog().log(e.getStatus());
|
||||
}
|
||||
|
@ -312,12 +424,24 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
savedJtagDevice = jtagDevice.getText();
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, savedJtagDevice);
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, useRemote.getSelection());
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ipAddress.getText().trim());
|
||||
if (!savedJtagDevice.isEmpty()) {
|
||||
try {
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, Integer
|
||||
.parseInt(portNumber.getText().trim()));
|
||||
IGDBJtagDevice device = findJtagDeviceByName(jtagDevice.getText()).getDevice();
|
||||
if (device instanceof IGDBJtagConnection) {
|
||||
String conn = connection.getText().trim();
|
||||
URI uri = new URI("gdb", conn, ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_CONNECTION, uri.toString());
|
||||
} else {
|
||||
String ip = ipAddress.getText().trim();
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ip);
|
||||
int port = Integer.valueOf(portNumber.getText().trim()).intValue();
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, port);
|
||||
}
|
||||
} catch (URISyntaxException e) {
|
||||
Activator.log(e);
|
||||
} catch (NumberFormatException e) {
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, 0);
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
|
||||
fUpdateThreadlistOnSuspend.getSelection());
|
||||
|
@ -334,8 +458,6 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
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);
|
||||
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND_DEFAULT);
|
||||
}
|
||||
|
|
|
@ -8,15 +8,23 @@
|
|||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Andy Jin - Hardware debugging UI improvements, bug 229946
|
||||
* Anna Dushistova(MontaVista) - Hardware Debugging: Host name or ip address not saving in the debug configuration, bug 241279
|
||||
* Anna Dushistova(MontaVista) - bug 241279
|
||||
* - Hardware Debugging: Host name or ip address not saving in
|
||||
* the debug configuration
|
||||
* 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).
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.debug.gdbjtag.ui;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import org.eclipse.cdt.debug.gdbjtag.core.Activator;
|
||||
import org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConnection;
|
||||
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;
|
||||
|
@ -33,6 +41,7 @@ import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
|
|||
import org.eclipse.debug.ui.StringVariableSelectionDialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.ScrolledComposite;
|
||||
import org.eclipse.swt.custom.StackLayout;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
|
@ -66,9 +75,14 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
private Combo miProtocol;
|
||||
private Button verboseMode;
|
||||
private Button useRemote;
|
||||
private Combo jtagDevice;
|
||||
private Composite remoteConnectionParameters;
|
||||
private StackLayout remoteConnectParmsLayout;
|
||||
private Composite remoteTcpipBox;
|
||||
private Text ipAddress;
|
||||
private Text portNumber;
|
||||
private Combo jtagDevice;
|
||||
private Composite remoteConnectionBox;
|
||||
private Text connection;
|
||||
private String savedJtagDevice;
|
||||
|
||||
|
||||
|
@ -268,7 +282,6 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
jtagDevice.add(availableDevices[i].getDeviceName());
|
||||
}
|
||||
|
||||
jtagDevice.select(0);
|
||||
jtagDevice.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
updateDeviceIpPort(jtagDevice.getText());
|
||||
|
@ -276,24 +289,64 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
}
|
||||
});
|
||||
|
||||
label = new Label(comp, SWT.NONE);
|
||||
label.setText(Messages.getString("GDBJtagDebuggerTab.ipAddressLabel"));
|
||||
ipAddress = new Text(comp, SWT.BORDER);
|
||||
remoteConnectionParameters = new Composite(group, SWT.NO_TRIM | SWT.NO_FOCUS);
|
||||
remoteConnectParmsLayout = new StackLayout();
|
||||
remoteConnectionParameters.setLayout(remoteConnectParmsLayout);
|
||||
|
||||
//
|
||||
// Create entry fields for TCP/IP connections
|
||||
//
|
||||
|
||||
{
|
||||
remoteTcpipBox = new Composite(remoteConnectionParameters, SWT.NO_TRIM | SWT.NO_FOCUS);
|
||||
layout = new GridLayout();
|
||||
layout.numColumns = 2;
|
||||
remoteTcpipBox.setLayout(layout);
|
||||
remoteTcpipBox.setBackground(remoteConnectionParameters.getParent().getBackground());
|
||||
|
||||
label = new Label(remoteTcpipBox, SWT.NONE);
|
||||
label.setText(Messages.getString("GDBJtagDebuggerTab.ipAddressLabel")); //$NON-NLS-1$
|
||||
ipAddress = new Text(remoteTcpipBox, SWT.BORDER);
|
||||
gd = new GridData();
|
||||
gd.widthHint = 100;
|
||||
gd.widthHint = 125;
|
||||
ipAddress.setLayoutData(gd);
|
||||
|
||||
label = new Label(remoteTcpipBox, SWT.NONE);
|
||||
label.setText(Messages.getString("GDBJtagDebuggerTab.portNumberLabel")); //$NON-NLS-1$
|
||||
portNumber = new Text(remoteTcpipBox, SWT.BORDER);
|
||||
gd = new GridData();
|
||||
gd.widthHint = 125;
|
||||
portNumber.setLayoutData(gd);
|
||||
}
|
||||
|
||||
//
|
||||
// Create entry fields for other types of connections
|
||||
//
|
||||
|
||||
{
|
||||
remoteConnectionBox = new Composite(remoteConnectionParameters, SWT.NO_TRIM | SWT.NO_FOCUS);
|
||||
layout = new GridLayout();
|
||||
layout.numColumns = 2;
|
||||
remoteConnectionBox.setLayout(layout);
|
||||
remoteConnectionBox.setBackground(remoteConnectionParameters.getParent().getBackground());
|
||||
|
||||
label = new Label(remoteConnectionBox, SWT.NONE);
|
||||
label.setText(Messages.getString("GDBJtagDebuggerTab.connectionLabel")); //$NON-NLS-1$
|
||||
connection = new Text(remoteConnectionBox, SWT.BORDER);
|
||||
gd = new GridData();
|
||||
gd.widthHint = 125;
|
||||
connection.setLayoutData(gd);
|
||||
}
|
||||
|
||||
//
|
||||
// Add watchers for user data entry
|
||||
//
|
||||
|
||||
ipAddress.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
});
|
||||
|
||||
label = new Label(comp, SWT.NONE);
|
||||
label.setText(Messages.getString("GDBJtagDebuggerTab.portNumberLabel"));
|
||||
portNumber = new Text(comp, SWT.BORDER);
|
||||
gd = new GridData();
|
||||
gd.widthHint = 100;
|
||||
portNumber.setLayoutData(gd);
|
||||
portNumber.addVerifyListener(new VerifyListener() {
|
||||
public void verifyText(VerifyEvent e) {
|
||||
e.doit = Character.isDigit(e.character) || Character.isISOControl(e.character);
|
||||
|
@ -304,6 +357,12 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
});
|
||||
|
||||
connection.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -321,10 +380,14 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
if (name.equals(selectedDeviceName)) {
|
||||
selectedDevice = availableDevices[i].getDevice();
|
||||
if (selectedDevice != null) {
|
||||
String ip = selectedDevice.getDefaultIpAddress();
|
||||
ipAddress.setText(ip);
|
||||
String port = selectedDevice.getDefaultPortNumber();
|
||||
portNumber.setText(port);
|
||||
if (selectedDevice instanceof IGDBJtagConnection) {
|
||||
IGDBJtagConnection connectionDevice = (IGDBJtagConnection)selectedDevice;
|
||||
connection.setText(connectionDevice.getDefaultDeviceConnection());
|
||||
} else {
|
||||
ipAddress.setText(selectedDevice.getDefaultIpAddress());
|
||||
portNumber.setText(selectedDevice.getDefaultPortNumber());
|
||||
}
|
||||
useRemoteChanged();
|
||||
updateLaunchConfigurationDialog();
|
||||
break;
|
||||
}
|
||||
|
@ -337,6 +400,31 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
jtagDevice.setEnabled(enabled);
|
||||
ipAddress.setEnabled(enabled);
|
||||
portNumber.setEnabled(enabled);
|
||||
connection.setEnabled(enabled);
|
||||
GDBJtagDeviceContribution selectedDeviceEntry = findJtagDeviceByName(jtagDevice.getText());
|
||||
if ((selectedDeviceEntry == null) || (selectedDeviceEntry.getDevice() == null)) {
|
||||
remoteConnectParmsLayout.topControl = null;
|
||||
remoteConnectionParameters.layout();
|
||||
} else {
|
||||
IGDBJtagDevice device = selectedDeviceEntry.getDevice();
|
||||
if (device instanceof IGDBJtagConnection) {
|
||||
remoteConnectParmsLayout.topControl = remoteConnectionBox;
|
||||
remoteConnectionBox.getParent().layout();
|
||||
} else {
|
||||
remoteConnectParmsLayout.topControl = remoteTcpipBox;
|
||||
remoteTcpipBox.getParent().layout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private GDBJtagDeviceContribution findJtagDeviceByName(String name) {
|
||||
GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance().getGDBJtagDeviceContribution();
|
||||
for (GDBJtagDeviceContribution device : availableDevices) {
|
||||
if (device.getDeviceName().equals(name)) {
|
||||
return device;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void initializeFrom(ILaunchConfiguration configuration) {
|
||||
|
@ -370,16 +458,37 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
useRemote.setSelection(useRemoteAttr);
|
||||
useRemoteChanged();
|
||||
|
||||
String ipAddressAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, IGDBJtagConstants.DEFAULT_IP_ADDRESS);
|
||||
ipAddress.setText(ipAddressAttr);
|
||||
savedJtagDevice = configuration.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, ""); //$NON-NLS-1$
|
||||
if (savedJtagDevice.isEmpty()) {
|
||||
jtagDevice.select(0);
|
||||
} else {
|
||||
String storedAddress = ""; //$NON-NLS-1$
|
||||
int storedPort = 0;
|
||||
String storedConnection = ""; //$NON-NLS-1$
|
||||
|
||||
int portNumberAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER);
|
||||
portNumber.setText(String.valueOf(portNumberAttr));
|
||||
|
||||
savedJtagDevice = configuration.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, "");
|
||||
for (int i = 0; i < jtagDevice.getItemCount(); i++) {
|
||||
if (jtagDevice.getItem(i).equals(savedJtagDevice)) {
|
||||
storedAddress = configuration.getAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ""); //$NON-NLS-1$
|
||||
storedPort = configuration.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, 0);
|
||||
storedConnection = configuration.getAttribute(IGDBJtagConstants.ATTR_CONNECTION, ""); //$NON-NLS-1$
|
||||
jtagDevice.select(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (storedConnection!=null) {
|
||||
try {
|
||||
connection.setText(new URI(storedConnection).getSchemeSpecificPart());
|
||||
} catch (URISyntaxException e) {
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
if (storedAddress!=null)
|
||||
{
|
||||
// Treat as legacy network probe
|
||||
ipAddress.setText(storedAddress);
|
||||
String portString = (0<storedPort)&&(storedPort<=65535) ? Integer.valueOf(storedPort).toString() : ""; //$NON-NLS-1$
|
||||
portNumber.setText(portString);
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
|
@ -405,11 +514,24 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
savedJtagDevice = jtagDevice.getText();
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, savedJtagDevice);
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, useRemote.getSelection());
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ipAddress.getText().trim());
|
||||
if (!savedJtagDevice.isEmpty()) {
|
||||
try {
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, Integer.parseInt(portNumber.getText().trim()));
|
||||
IGDBJtagDevice device = findJtagDeviceByName(jtagDevice.getText()).getDevice();
|
||||
if (device instanceof IGDBJtagConnection) {
|
||||
String conn = connection.getText().trim();
|
||||
URI uri = new URI("gdb", conn, ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_CONNECTION, uri.toString());
|
||||
} else {
|
||||
String ip = ipAddress.getText().trim();
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ip);
|
||||
int port = Integer.valueOf(portNumber.getText().trim()).intValue();
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, port);
|
||||
}
|
||||
} catch (URISyntaxException e) {
|
||||
Activator.log(e);
|
||||
} catch (NumberFormatException e) {
|
||||
configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, 0);
|
||||
Activator.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -421,8 +543,6 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
@ -7,6 +7,9 @@
|
|||
#
|
||||
# Contributors:
|
||||
# QNX Software Systems - initial API and implementation
|
||||
# Bruce Griffith,Sage Electronic Engineering, LLC - bug 305943
|
||||
# - API generalization to become transport-independent (e.g. to
|
||||
# allow connections via serial ports and pipes).
|
||||
###############################################################################
|
||||
|
||||
GDBJtagStartupTab.initGroup_Text=Initialization Commands
|
||||
|
@ -58,4 +61,5 @@ GDBJtagDebuggerTab.useRemote_Text=Use remote target
|
|||
GDBJtagDebuggerTab.jtagDeviceLabel=JTAG Device:
|
||||
GDBJtagDebuggerTab.ipAddressLabel=Host name or IP address:
|
||||
GDBJtagDebuggerTab.portNumberLabel=Port number:
|
||||
GDBJtagDebuggerTab.connectionLabel=GDB Connection String:
|
||||
GDBJtagDebuggerTab.update_thread_list_on_suspend=Force thread list update on suspend
|
||||
|
|
Loading…
Add table
Reference in a new issue