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 b83155a705b..00000000000
--- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/.settings/.api_filters
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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 32004182441..766acf2a1b1 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 6ffa24bdda8..de56b802698 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 @@
- Jtag device extension point
+ JTAG device extension point
@@ -49,14 +49,14 @@
- Unique if of the jtag device contribution.
+ Unique id of the JTAG device contribution.
- Name of the JTag device.
+ Name of the JTAG device.
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 4316b4d5f9f..ffd30026f6a 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 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);
}
}
- return gdbJtagDevice;
+
+ // 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);
+ }
+ }
+
+ // 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 118922d0734..b487c604ba0 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 fc6154923e5..803b1ba6ed2 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 7c78c753870..89a04d336d2 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 de750037630..e6054d6e5fa 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$