Skip to main content
summaryrefslogtreecommitdiffstats
path: root/jtag
diff options
context:
space:
mode:
authorTorbjörn Svensson2018-05-23 08:52:09 -0400
committerJohn Dallaway2018-05-24 13:24:21 -0400
commita7b0a1fe806fa248e8e2c497f144177244e8f7e4 (patch)
treee37d90304f3a50c1bf96d9f4650438420c58e190 /jtag
parent4c50b40f53125c49ba0567738084808f311ea4c6 (diff)
downloadorg.eclipse.cdt-a7b0a1fe806fa248e8e2c497f144177244e8f7e4.tar.gz
org.eclipse.cdt-a7b0a1fe806fa248e8e2c497f144177244e8f7e4.tar.xz
org.eclipse.cdt-a7b0a1fe806fa248e8e2c497f144177244e8f7e4.zip
Bug 535024: Use deviceId for determine JTAG probe
The name of the JTAG probe is not translateable since the name is saved as-is in the launch configuration. To make the string translateable, use the id instead to select probe implementation. Change-Id: Id7e654ea1e26f47cd1c8ccfec857a94f3be9e0ad Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com> Signed-off-by: John Dallaway <john@dallaway.org.uk>
Diffstat (limited to 'jtag')
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/.settings/.api_filters19
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF2
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/schema/JTagDevice.exsd6
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFFinalLaunchSequence.java38
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java11
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContributionFactory.java26
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF2
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java68
8 files changed, 122 insertions, 50 deletions
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/.settings/.api_filters b/jtag/org.eclipse.cdt.debug.gdbjtag.core/.settings/.api_filters
deleted file mode 100644
index b83155a705..0000000000
--- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/.settings/.api_filters
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<component id="org.eclipse.cdt.debug.gdbjtag.core" version="2">
- <resource path="src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java" type="org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConstants">
- <filter id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConstants"/>
- <message_argument value="DEFAULT_DO_HALT"/>
- <message_argument value="1"/>
- </message_arguments>
- </filter>
- <filter id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.cdt.debug.gdbjtag.core.IGDBJtagConstants"/>
- <message_argument value="DEFAULT_DO_RESET"/>
- <message_argument value="1"/>
- </message_arguments>
- </filter>
- </resource>
-</component>
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF b/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF
index 3200418244..766acf2a1b 100644
--- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.gdbjtag.core;singleton:=true
-Bundle-Version: 9.2.0.qualifier
+Bundle-Version: 10.0.0.qualifier
Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.core.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
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 6ffa24bdda..de56b80269 100644
--- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/schema/JTagDevice.exsd
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/schema/JTagDevice.exsd
@@ -6,7 +6,7 @@
<meta.schema plugin="org.eclipse.cdt.debug.gdbjtag.core" id="JTagDevice" name="%JTagDevice.name"/>
</appInfo>
<documentation>
- Jtag device extension point
+ JTAG device extension point
</documentation>
</annotation>
@@ -49,14 +49,14 @@
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
- Unique if of the jtag device contribution.
+ Unique id of the JTAG device contribution.
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
<documentation>
- Name of the JTag device.
+ Name of the JTAG device.
</documentation>
</annotation>
</attribute>
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 4316b4d5f9..ffd30026f6 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2017 QNX Software Systems and others.
+ * Copyright (c) 2007, 2018 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
@@ -17,6 +17,7 @@
* Marc Khouzam (Ericsson) - Cannot disable Delay command (bug 413437)
* John Dallaway - Execute run commands before resume (Bug 525692)
* John Dallaway - Test for reset/delay/halt command not defined (Bug 361881)
+ * Torbjörn Svensson (STMicroelectronics) - Bug 535024
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core;
@@ -238,7 +239,7 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
public void stepRetrieveJTAGDevice(final RequestMonitor rm) {
Exception exception = null;
try {
- fGdbJtagDevice = getGDBJtagDevice();
+ fGdbJtagDevice = getGDBJtagDeviceContribution().getDevice();
} catch (NullPointerException e) {
exception = e;
}
@@ -630,20 +631,33 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
}
private String getGDBJtagDeviceName() {
- return CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_JTAG_DEVICE, IGDBJtagConstants.DEFAULT_JTAG_DEVICE);
+ GDBJtagDeviceContribution contribution = getGDBJtagDeviceContribution();
+ if (contribution != null) {
+ return contribution.getDeviceName();
+ }
+ return IGDBJtagConstants.DEFAULT_JTAG_DEVICE_NAME;
}
- private IGDBJtagDevice getGDBJtagDevice () {
- IGDBJtagDevice gdbJtagDevice = null;
- String jtagDeviceName = getGDBJtagDeviceName();
- GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance().getGDBJtagDeviceContribution();
- for (GDBJtagDeviceContribution availableDevice : availableDevices) {
- if (jtagDeviceName.equals(availableDevice.getDeviceName())) {
- gdbJtagDevice = availableDevice.getDevice();
- break;
+ @SuppressWarnings("deprecation")
+ private GDBJtagDeviceContribution getGDBJtagDeviceContribution() {
+ Map<String, Object> attributes = getAttributes();
+ if (attributes.containsKey(IGDBJtagConstants.ATTR_JTAG_DEVICE_ID)) {
+ String deviceId = CDebugUtils.getAttribute(attributes, IGDBJtagConstants.ATTR_JTAG_DEVICE_ID, "");
+ if (!deviceId.isEmpty()) {
+ return GDBJtagDeviceContributionFactory.getInstance().findByDeviceId(deviceId);
+ }
+ }
+
+ // Fall back to old behavior with name only if ID is missing
+ if (attributes.containsKey(IGDBJtagConstants.ATTR_JTAG_DEVICE)) {
+ String deviceName = CDebugUtils.getAttribute(attributes, IGDBJtagConstants.ATTR_JTAG_DEVICE, "");
+ if (!deviceName.isEmpty()) {
+ return GDBJtagDeviceContributionFactory.getInstance().findByDeviceName(deviceName);
}
}
- return gdbJtagDevice;
+
+ // No matching device contribution found
+ return null;
}
/**
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 118922d073..b487c604ba 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
@@ -9,6 +9,7 @@
* QNX Software Systems - Initial API and implementation
* Andy Jin - Hardware debugging UI improvements, bug 229946
* John Dallaway - Disable reset and halt by default, bug 529171
+ * Torbjörn Svensson (STMicroelectronics) - Bug 535024
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core;
@@ -23,7 +24,9 @@ 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$
+ /** @deprecated Use {@link #ATTR_JTAG_DEVICE ID} instead */
public static final String ATTR_JTAG_DEVICE = Activator.PLUGIN_ID + ".jtagDevice"; //$NON-NLS-1$
+ /** @since 10.0*/ public static final String ATTR_JTAG_DEVICE_ID = Activator.PLUGIN_ID + ".jtagDeviceId"; //$NON-NLS-1$
public static final boolean DEFAULT_USE_REMOTE_TARGET = true;
public static final String DEFAULT_IP_ADDRESS = "unspecified-ip-address"; //$NON-NLS-1$
@@ -73,6 +76,12 @@ public interface IGDBJtagConstants {
/** @since 7.0 */ public static final String DEFAULT_SYMBOLS_OFFSET = ""; //$NON-NLS-1$
/** @since 7.0 */ public static final String DEFAULT_PC_REGISTER = ""; //$NON-NLS-1$
/** @since 7.0 */ public static final String DEFAULT_STOP_AT = ""; //$NON-NLS-1$
- /** @since 7.0 */ public static final String DEFAULT_JTAG_DEVICE = ""; //$NON-NLS-1$
+ /** @since 10.0*/ public static final String DEFAULT_JTAG_DEVICE_ID = ""; //$NON-NLS-1$
+ /** @since 10.0*/ public static final String DEFAULT_JTAG_DEVICE_NAME = ""; //$NON-NLS-1$
+ /**
+ * @since 7.0
+ * @deprecated Use either {@link #DEFAULT_JTAG_DEVICE_ID} or {@link #DEFAULT_JTAG_DEVICE_NAME}
+ */
+ public static final String DEFAULT_JTAG_DEVICE = ""; //$NON-NLS-1$
}
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 fc6154923e..803b1ba6ed 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 QNX Software Systems and others.
+ * Copyright (c) 2008, 2018 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
@@ -11,6 +11,7 @@
* Bruce Griffith, Sage Electronic Engineering, LLC - bug 305943
* - API generalization to become transport-independent (allow
* connections via serial ports and pipes).
+ * Torbjörn Svensson (STMicroelectronics) - Bug 535024
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
@@ -94,4 +95,27 @@ public class GDBJtagDeviceContributionFactory {
return (elementValue != null) ? elementValue : defaultValue;
}
+ /**
+ * @since 10.0
+ */
+ public GDBJtagDeviceContribution findByDeviceName(String name) {
+ for (GDBJtagDeviceContribution contribution : getGDBJtagDeviceContribution()) {
+ if (contribution.getDeviceName().equals(name)) {
+ return contribution;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @since 10.0
+ */
+ public GDBJtagDeviceContribution findByDeviceId(String id) {
+ for (GDBJtagDeviceContribution contribution : getGDBJtagDeviceContribution()) {
+ if (contribution.getDeviceId().equals(id)) {
+ return contribution;
+ }
+ }
+ return null;
+ }
}
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF
index 7c78c75387..89a04d336d 100644
--- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.gdbjtag.ui;singleton:=true
-Bundle-Version: 8.0.2.qualifier
+Bundle-Version: 8.1.0.qualifier
Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.ui.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java
index de75003763..e6054d6e5f 100644
--- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java
+++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java
@@ -16,6 +16,7 @@
* - API generalization to become transport-independent (e.g. to
* allow connections via serial ports and pipes).
* John Dallaway - Ensure correct SessionType enabled, bug 334110
+ * Torbjörn Svensson (STMicroelectronics) - Bug 535024
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.ui;
@@ -384,7 +385,7 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
ipAddress.setEnabled(enabled);
portNumber.setEnabled(enabled);
connection.setEnabled(enabled);
- GDBJtagDeviceContribution selectedDeviceEntry = findJtagDeviceByName(jtagDevice.getText());
+ GDBJtagDeviceContribution selectedDeviceEntry = GDBJtagDeviceContributionFactory.getInstance().findByDeviceName(jtagDevice.getText());
if ((selectedDeviceEntry == null) || (selectedDeviceEntry.getDevice() == null)) {
remoteConnectParmsLayout.topControl = null;
remoteConnectionParameters.layout();
@@ -400,13 +401,50 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
}
}
- private GDBJtagDeviceContribution findJtagDeviceByName(String name) {
- GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance().getGDBJtagDeviceContribution();
- for (GDBJtagDeviceContribution device : availableDevices) {
- if (device.getDeviceName().equals(name)) {
- return device;
- }
+ /**
+ * Returns the device name for a given device id or {@link IGDBJtagConstants.DEFAULT_JTAG_DEVICE_NAME}
+ *
+ * @param jtagDeviceId The device id
+ * @return The device id if found, else {@link IGDBJtagConstants.DEFAULT_JTAG_DEVICE_NAME}
+ * @since 8.1
+ */
+ protected String getDeviceNameForDeviceId(String jtagDeviceId) {
+ GDBJtagDeviceContribution contribution = GDBJtagDeviceContributionFactory.getInstance().findByDeviceId(jtagDeviceId);
+ if (contribution != null) {
+ return contribution.getDeviceName();
}
+ return IGDBJtagConstants.DEFAULT_JTAG_DEVICE_NAME;
+ }
+
+ /**
+ * Returns the device id for a given device name or {@link IGDBJtagConstants.DEFAULT_JTAG_DEVICE_ID}
+ *
+ * @param jtagDeviceName The device name
+ * @return The device id if found, else {@link IGDBJtagConstants.DEFAULT_JTAG_DEVICE_ID}
+ * @since 8.1
+ */
+ protected String getDeviceIdForDeviceName(String jtagDeviceName) {
+ GDBJtagDeviceContribution device = GDBJtagDeviceContributionFactory.getInstance().findByDeviceName(jtagDeviceName);
+ if (device != null) {
+ return device.getDeviceId();
+ }
+ return IGDBJtagConstants.DEFAULT_JTAG_DEVICE_ID;
+ }
+
+ private GDBJtagDeviceContribution getDeviceContribution(ILaunchConfiguration configuration) throws CoreException {
+ String deviceId = configuration.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE_ID, (String)null);
+ if (deviceId != null) {
+ return GDBJtagDeviceContributionFactory.getInstance().findByDeviceId(deviceId);
+ }
+
+ // Fall back to old behavior with name only if ID is missing
+ @SuppressWarnings("deprecation")
+ String deviceName = configuration.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, (String)null);
+ if (deviceName != null) {
+ return GDBJtagDeviceContributionFactory.getInstance().findByDeviceName(deviceName);
+ }
+
+ // No matching device contribution found
return null;
}
@@ -422,8 +460,14 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET);
useRemote.setSelection(useRemoteAttr);
- savedJtagDevice = configuration.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, "");
- if (savedJtagDevice.length() == 0) {
+ GDBJtagDeviceContribution savedDeviceContribution = getDeviceContribution(configuration);
+ if (savedDeviceContribution != null) {
+ savedJtagDevice = savedDeviceContribution.getDeviceName();
+ } else {
+ savedJtagDevice = IGDBJtagConstants.DEFAULT_JTAG_DEVICE_NAME;
+ }
+
+ if (savedJtagDevice.isEmpty()) {
jtagDevice.select(0);
} else {
String storedAddress = ""; //$NON-NLS-1$
@@ -485,7 +529,7 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbCommand.getText().trim()); // DSF
savedJtagDevice = jtagDevice.getText();
- configuration.setAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, savedJtagDevice);
+ configuration.setAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE_ID, getDeviceIdForDeviceName(savedJtagDevice));
configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, useRemote.getSelection());
if (useRemote.getSelection()) {
// ensure LaunchUtils.getSessionType() returns SessionType.REMOTE (bug 334110)
@@ -495,9 +539,9 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab {
// ensure LaunchUtils.getSessionType() returns the default session type
configuration.removeAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE);
}
- if (savedJtagDevice.length() > 0) {
+ if (!savedJtagDevice.isEmpty()) {
try {
- IGDBJtagDevice device = findJtagDeviceByName(jtagDevice.getText()).getDevice();
+ IGDBJtagDevice device = GDBJtagDeviceContributionFactory.getInstance().findByDeviceName(savedJtagDevice).getDevice();
if (device instanceof IGDBJtagConnection) {
String conn = connection.getText().trim();
URI uri = new URI("gdb", conn, ""); //$NON-NLS-1$ //$NON-NLS-2$

Back to the top