diff options
author | Torbjörn Svensson | 2018-05-23 12:52:09 +0000 |
---|---|---|
committer | John Dallaway | 2018-05-24 17:24:21 +0000 |
commit | a7b0a1fe806fa248e8e2c497f144177244e8f7e4 (patch) | |
tree | e37d90304f3a50c1bf96d9f4650438420c58e190 /jtag/org.eclipse.cdt.debug.gdbjtag.core | |
parent | 4c50b40f53125c49ba0567738084808f311ea4c6 (diff) | |
download | org.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/org.eclipse.cdt.debug.gdbjtag.core')
6 files changed, 65 insertions, 37 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 b83155a705b..00000000000 --- 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 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 @@ <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 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<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 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; + } } |