diff --git a/jtag/org.eclipse.cdt.debug.dap.gdbjtag/src/org/eclipse/cdt/debug/dap/gdbjtag/DapGdbJtagLaunchDelegate.java b/jtag/org.eclipse.cdt.debug.dap.gdbjtag/src/org/eclipse/cdt/debug/dap/gdbjtag/DapGdbJtagLaunchDelegate.java index fd4a0975332..f1f9515e30b 100644 --- a/jtag/org.eclipse.cdt.debug.dap.gdbjtag/src/org/eclipse/cdt/debug/dap/gdbjtag/DapGdbJtagLaunchDelegate.java +++ b/jtag/org.eclipse.cdt.debug.dap.gdbjtag/src/org/eclipse/cdt/debug/dap/gdbjtag/DapGdbJtagLaunchDelegate.java @@ -213,23 +213,27 @@ public class DapGdbJtagLaunchDelegate extends DapLaunchDelegate { IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET)) { List commands = new ArrayList<>(); if (jtagDevice instanceof IGDBJtagConnection) { - URI uri; - try { - uri = new URI(CDebugUtils.getAttribute(attributes, IGDBJtagConstants.ATTR_CONNECTION, - IGDBJtagConstants.DEFAULT_CONNECTION)); - } catch (URISyntaxException e) { - throw newCoreException("Invalid remote target connection syntax", e); + String connection = IGDBJtagConstants.DEFAULT_CONNECTION; + String connectionUri = CDebugUtils.getAttribute(attributes, IGDBJtagConstants.ATTR_CONNECTION, + IGDBJtagConstants.DEFAULT_CONNECTION); + if (!IGDBJtagConstants.DEFAULT_CONNECTION.equals(connectionUri)) { + try { + connection = new URI(connectionUri).getSchemeSpecificPart(); + } catch (URISyntaxException e) { + throw newCoreException("Invalid remote target connection syntax", e); + } + } else { + // Handle legacy launch configurations + String ipAddress = CDebugUtils.getAttribute(attributes, IGDBJtagConstants.ATTR_IP_ADDRESS, + IGDBJtagConstants.DEFAULT_IP_ADDRESS); + int portNumber = CDebugUtils.getAttribute(attributes, IGDBJtagConstants.ATTR_PORT_NUMBER, + IGDBJtagConstants.DEFAULT_PORT_NUMBER); + if (!IGDBJtagConstants.DEFAULT_IP_ADDRESS.equals(ipAddress)) { + connection = String.format("%s:%d", ipAddress, portNumber); //$NON-NLS-1$ + } } - IGDBJtagConnection device = (IGDBJtagConnection) jtagDevice; - device.doRemote(uri.getSchemeSpecificPart(), commands); - } else { - // Handle legacy network device contributions that don't understand URIs - String ipAddress = CDebugUtils.getAttribute(attributes, IGDBJtagConstants.ATTR_IP_ADDRESS, - IGDBJtagConstants.DEFAULT_IP_ADDRESS); - int portNumber = CDebugUtils.getAttribute(attributes, IGDBJtagConstants.ATTR_PORT_NUMBER, - IGDBJtagConstants.DEFAULT_PORT_NUMBER); - jtagDevice.doRemote(ipAddress, portNumber, commands); + device.doRemote(connection, commands); } target.put(CONNECT_COMMANDS, commands); } diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml b/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml index faa32f1d968..c9f69fa0503 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/plugin.xml @@ -27,16 +27,19 @@ point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice"> @@ -54,21 +57,25 @@ 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 0f76769f7c3..767fb2242dc 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 @@ -378,7 +378,6 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence { * Hook up to remote target */ /** @since 8.2 */ - @SuppressWarnings("deprecation") @Execute public void stepConnectToTarget(final RequestMonitor rm) { try { @@ -386,19 +385,27 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence { IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET)) { List commands = new ArrayList<>(); if (fGdbJtagDevice instanceof IGDBJtagConnection) { - URI uri = new URI(CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_CONNECTION, - IGDBJtagConstants.DEFAULT_CONNECTION)); + String connection = IGDBJtagConstants.DEFAULT_CONNECTION; + String connectionUri = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_CONNECTION, + IGDBJtagConstants.DEFAULT_CONNECTION); + if (!IGDBJtagConstants.DEFAULT_CONNECTION.equals(connectionUri)) { + connection = new URI(connectionUri).getSchemeSpecificPart(); + } else { + // Handle legacy launch configurations + String ipAddress = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_IP_ADDRESS, + IGDBJtagConstants.DEFAULT_IP_ADDRESS); + int portNumber = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_PORT_NUMBER, + IGDBJtagConstants.DEFAULT_PORT_NUMBER); + if (!IGDBJtagConstants.DEFAULT_IP_ADDRESS.equals(ipAddress)) { + connection = String.format("%s:%d", ipAddress, portNumber); //$NON-NLS-1$ + } + } IGDBJtagConnection device = (IGDBJtagConnection) fGdbJtagDevice; - device.doRemote(uri.getSchemeSpecificPart(), commands); + device.doRemote(connection, commands); + queueCommands(commands, rm); } else { - // Handle legacy network device contributions that don't understand URIs - String ipAddress = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_IP_ADDRESS, - IGDBJtagConstants.DEFAULT_IP_ADDRESS); - int portNumber = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_PORT_NUMBER, - IGDBJtagConstants.DEFAULT_PORT_NUMBER); - fGdbJtagDevice.doRemote(ipAddress, portNumber, commands); + rm.done(); } - queueCommands(commands, rm); } else { rm.done(); } diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/AbatronBDI2000.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/AbatronBDI2000.java index 9e9685fbd56..7158469fb72 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/AbatronBDI2000.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/AbatronBDI2000.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2019 QNX Software Systems and others. + * Copyright (c) 2008, 2020 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -12,22 +12,13 @@ * QNX Software Systems - Initial API and implementation * Andy Jin - Hardware debugging UI improvements, bug 229946 * John Dallaway - Provide 'reset and halt' command, bug 550963 + * John Dallaway - Eliminate deprecated API, bug 566462 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; import java.util.Collection; -public class AbatronBDI2000 extends DefaultGDBJtagDeviceImpl { - - @Override - public String getDefaultIpAddress() { - return "bdi2000"; //$NON-NLS-1$ - } - - @Override - public String getDefaultPortNumber() { - return "2001"; //$NON-NLS-1$ - } +public class AbatronBDI2000 extends DefaultGDBJtagConnectionImpl { @Override public void doResetAndHalt(Collection commands) { diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagConnectionImpl.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagConnectionImpl.java index d85f4a2e959..23bd38b57e6 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagConnectionImpl.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagConnectionImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2012 Sage Electronic Engineering and others. + * Copyright (c) 2010, 2020 Sage Electronic Engineering and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -12,6 +12,7 @@ * Bruce Griffith,Sage Electronic Engineering, LLC - bug 305943 * - API generalization to become transport-independent (e.g. to * allow connections via serial ports and pipes). + * John Dallaway - Eliminate deprecated API - bug 566462 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; @@ -51,14 +52,4 @@ public class DefaultGDBJtagConnectionImpl extends DefaultGDBJtagDeviceImpl imple return connection; } - @Override - public String getDefaultIpAddress() { - throw new UnsupportedOperationException(); - } - - @Override - public String getDefaultPortNumber() { - throw new UnsupportedOperationException(); - } - } diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagDeviceImpl.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagDeviceImpl.java index 08b68303f4c..6e49bfc48ba 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagDeviceImpl.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/DefaultGDBJtagDeviceImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 QNX Software Systems and others. + * Copyright (c) 2008, 2020 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -12,6 +12,7 @@ * QNX Software Systems - Initial API and implementation * Andy Jin - Hardware debugging UI improvements, bug 229946 * John Dallaway - Use GDB/MI for temporary breakpoint, bug 525726 + * John Dallaway - Eliminate deprecated API, bug 566462 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; @@ -46,17 +47,6 @@ public class DefaultGDBJtagDeviceImpl implements IGDBJtagDevice { return 0; } - @Override - public void doRemote(String ip, int port, Collection commands) { - // The CLI version (target remote) does not let us know - // that we have properly connected. For older GDBs (<= 6.8) - // we need this information for a DSF session. - // The MI version does tell us, which is why we must use it - // Bug 348043 - String cmd = "-target-select remote " + ip + ":" + String.valueOf(port); //$NON-NLS-1$ //$NON-NLS-2$ - addCmd(commands, cmd); - } - @Override public void doHalt(Collection commands) { String cmd = "monitor halt"; //$NON-NLS-1$ @@ -116,14 +106,4 @@ public class DefaultGDBJtagDeviceImpl implements IGDBJtagDevice { commands.add(cmd + LINESEP); } - @Override - public String getDefaultIpAddress() { - return "localhost"; //$NON-NLS-1$ - } - - @Override - public String getDefaultPortNumber() { - return "10000"; //$NON-NLS-1$ - } - } diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContribution.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContribution.java index da412e5ce2a..ab90d4d4b08 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContribution.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GDBJtagDeviceContribution.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 - 2010 QNX Software Systems and others. + * Copyright (c) 2008 - 2020 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -14,6 +14,7 @@ * Bruce Griffith, Sage Electronic Engineering, LLC - bug 305943 * - API generalization to become transport-independent (allow * connections via serial ports and pipes). + * John Dallaway - Eliminate deprecated API - bug 566462 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; @@ -95,7 +96,7 @@ public class GDBJtagDeviceContribution { return device; Object o = null; try { - o = Platform.getBundle(deviceClassBundleName).loadClass(deviceClassName).newInstance(); + o = Platform.getBundle(deviceClassBundleName).loadClass(deviceClassName).getConstructor().newInstance(); if (o instanceof IGDBJtagConnection) { ((IGDBJtagConnection) o).setDefaultDeviceConnection(deviceDefaultConnection); } diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GenericDevice.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GenericDevice.java index f12d3e1db91..e884417c352 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GenericDevice.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/GenericDevice.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 QNX Software Systems and others. + * Copyright (c) 2008, 2020 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -11,12 +11,13 @@ * Contributors: * QNX Software Systems - Initial API and implementation * Andy Jin - Hardware debugging UI improvements, bug 229946 + * John Dallaway - Eliminate deprecated API, bug 566462 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; import java.util.Collection; -public class GenericDevice extends DefaultGDBJtagDeviceImpl { +public class GenericDevice extends DefaultGDBJtagConnectionImpl { @Override public void doDelay(int delay, Collection commands) { diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/IGDBJtagDevice.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/IGDBJtagDevice.java index 461b2528d8a..4c6a8998d89 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/IGDBJtagDevice.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/IGDBJtagDevice.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2019 QNX Software Systems and others. + * Copyright (c) 2008, 2020 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -12,6 +12,7 @@ * QNX Software Systems - Initial API and implementation * Andy Jin - Hardware debugging UI improvements, bug 229946 * John Dallaway - Support 'reset and halt' command, bug 535163 + * John Dallaway - Eliminate deprecated API, bug 566462 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; @@ -83,25 +84,6 @@ public interface IGDBJtagDevice { /* override where supported by debugger */ } - /** - * Commands to connect to remote JTAG device - * - * @param ip - * host name of IP address of JTAG device - * @param port - * TCP socket port number of JTAG device - * @param commands - * implementation should populate the collection with the gdb - * commands that will connect to the device, or leave the - * collection as-is if that operation is either unsupported or - * not applicable - * @deprecated an implementor should adapt to IGDBJtagConnection instead of - * implementing this method (implementation should throw - * UnsupportedOperationException) - */ - @Deprecated - public void doRemote(String ip, int port, Collection commands); - /** * Commands to download the executable binary to target * @@ -169,25 +151,4 @@ public interface IGDBJtagDevice { */ public void doContinue(Collection commands); - /** - * Device specific default hostname of IP address - * - * @return default hostname of IP address - * @deprecated an implementor should adapt to IGDBJtagConnection instead of - * implementing this method (implementation should throw - * UnsupportedOperationException) - */ - @Deprecated - public String getDefaultIpAddress(); - - /** - * Device specific default port number - * - * @return default port number - * @deprecated an implementor should adapt to IGDBJtagConnection instead of - * implementing this method (implementation should throw - * UnsupportedOperationException) - */ - @Deprecated - public String getDefaultPortNumber(); } diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/MacraigorUsb2Demon.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/MacraigorUsb2Demon.java index e36ea08aa0a..25d0480c07a 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/MacraigorUsb2Demon.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/MacraigorUsb2Demon.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2019 QNX Software Systems and others. + * Copyright (c) 2008, 2020 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -12,6 +12,7 @@ * QNX Software Systems - Initial API and implementation * Andy Jin - Hardware debugging UI improvements, bug 229946 * John Dallaway - Provide 'reset and halt' command, bug 550963 + * John Dallaway - Eliminate deprecated API, bug 566462 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; @@ -21,12 +22,7 @@ import java.util.Collection; * @author ajin * */ -public class MacraigorUsb2Demon extends DefaultGDBJtagDeviceImpl { - - @Override - public String getDefaultPortNumber() { - return "8888"; //$NON-NLS-1$ - } +public class MacraigorUsb2Demon extends DefaultGDBJtagConnectionImpl { @Override public void doDelay(int delay, Collection commands) { diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/OpenOCDSocket.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/OpenOCDSocket.java index 5eaf676bd78..72666ce803a 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/OpenOCDSocket.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/OpenOCDSocket.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2019 QNX Software Systems and others. + * Copyright (c) 2008, 2020 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -13,6 +13,7 @@ * Andy Jin - Hardware debugging UI improvements, bug 229946 * John Dallaway - OpenOCD extensions, bug 494059 * John Dallaway - Provide 'reset and halt' command, bug 550963 + * John Dallaway - Eliminate deprecated API, bug 566462 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; @@ -21,12 +22,7 @@ import java.util.Collection; /** * @since 9.2 */ -public class OpenOCDSocket extends DefaultGDBJtagDeviceImpl { - - @Override - public String getDefaultPortNumber() { - return "3333"; //$NON-NLS-1$ - } +public class OpenOCDSocket extends DefaultGDBJtagConnectionImpl { @Override public void doDelay(int delay, Collection commands) { diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/PEMicro.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/PEMicro.java index 0fc57d3c055..1555486988e 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/PEMicro.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/PEMicro.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2019 QNX Software Systems and others. + * Copyright (c) 2008, 2020 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -12,6 +12,7 @@ * QNX Software Systems - Initial API and implementation * Andy Jin - Hardware debugging UI improvements, bug 229946 * John Dallaway - PEmicro extension, bug 552597 + * John Dallaway - Eliminate deprecated API, bug 566462 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; @@ -20,12 +21,7 @@ import java.util.Collection; /** * @since 9.4 */ -public class PEMicro extends DefaultGDBJtagDeviceImpl { - - @Override - public String getDefaultPortNumber() { - return "7224"; //$NON-NLS-1$ - } +public class PEMicro extends DefaultGDBJtagConnectionImpl { @Override public void doDelay(int delay, Collection commands) { diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/STLink.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/STLink.java index 6c9eed7aef8..88caf0114c0 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/STLink.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/STLink.java @@ -12,6 +12,7 @@ * QNX Software Systems - Initial API and implementation * Andy Jin - Hardware debugging UI improvements, bug 229946 * John Dallaway - ST-LINK extension, bug 558266 + * John Dallaway - Eliminate deprecated API, bug 566462 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; @@ -20,12 +21,7 @@ import java.util.Collection; /** * @since 9.5 */ -public class STLink extends DefaultGDBJtagDeviceImpl { - - @Override - public String getDefaultPortNumber() { - return "61234"; //$NON-NLS-1$ - } +public class STLink extends DefaultGDBJtagConnectionImpl { @Override public void doDelay(int delay, Collection commands) { diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/SeggerJLink.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/SeggerJLink.java index b86e0728c89..5c9eee25912 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/SeggerJLink.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/SeggerJLink.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2019 QNX Software Systems and others. + * Copyright (c) 2008, 2020 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -13,6 +13,7 @@ * Andy Jin - Hardware debugging UI improvements, bug 229946 * John Dallaway - SEGGER J-Link extension, bug 548281 * John Dallaway - Provide 'reset and halt' command, bug 550963 + * John Dallaway - Eliminate deprecated API, bug 566462 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; @@ -21,12 +22,7 @@ import java.util.Collection; /** * @since 9.3 */ -public class SeggerJLink extends DefaultGDBJtagDeviceImpl { - - @Override - public String getDefaultPortNumber() { - return "2331"; //$NON-NLS-1$ - } +public class SeggerJLink extends DefaultGDBJtagConnectionImpl { @Override public void doDelay(int delay, Collection commands) { 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 ff7510085f3..e90d6819d72 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 @@ -57,8 +57,6 @@ import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.VerifyEvent; -import org.eclipse.swt.events.VerifyListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -86,9 +84,6 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { private Combo jtagDevice; private Composite remoteConnectionParameters; private StackLayout remoteConnectParmsLayout; - private Composite remoteTcpipBox; - private Text ipAddress; - private Text portNumber; private Composite remoteConnectionBox; private Text connection; private String savedJtagDevice; @@ -277,32 +272,6 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { remoteConnectionParameters.setLayout(remoteConnectParmsLayout); remoteConnectionParameters.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create()); - // - // 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 = 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 // @@ -325,26 +294,6 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { // // Add watchers for user data entry // - - ipAddress.addModifyListener(new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - scheduleUpdateJob(); // provides much better performance for Text listeners - } - }); - portNumber.addVerifyListener(new VerifyListener() { - @Override - public void verifyText(VerifyEvent e) { - e.doit = Character.isDigit(e.character) || Character.isISOControl(e.character); - } - }); - portNumber.addModifyListener(new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - scheduleUpdateJob(); // provides much better performance for Text listeners - } - }); - connection.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { @@ -356,7 +305,6 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { /** * @param text */ - @SuppressWarnings("deprecation") protected void updateDeviceIpPort(String selectedDeviceName) { if (selectedDeviceName.equals(savedJtagDevice)) { return; @@ -372,10 +320,6 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { if (selectedDevice instanceof IGDBJtagConnection) { IGDBJtagConnection connectionDevice = (IGDBJtagConnection) selectedDevice; connection.setText(connectionDevice.getDefaultDeviceConnection()); - } else { - // support for deprecated TCP/IP based methods - ipAddress.setText(selectedDevice.getDefaultIpAddress()); - portNumber.setText(selectedDevice.getDefaultPortNumber()); } useRemoteChanged(); updateLaunchConfigurationDialog(); @@ -394,8 +338,6 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { remoteTimeoutEnabled.setEnabled(enabled); remoteTimeoutValue.setEnabled(remoteTimeoutEnabled.getSelection()); jtagDevice.setEnabled(enabled); - ipAddress.setEnabled(enabled); - portNumber.setEnabled(enabled); connection.setEnabled(enabled); GDBJtagDeviceContribution selectedDeviceEntry = GDBJtagDeviceContributionFactory.getInstance() .findByDeviceName(jtagDevice.getText()); @@ -408,8 +350,8 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { remoteConnectParmsLayout.topControl = remoteConnectionBox; remoteConnectionBox.getParent().layout(); } else { - remoteConnectParmsLayout.topControl = remoteTcpipBox; - remoteTcpipBox.getParent().layout(); + remoteConnectParmsLayout.topControl = null; + remoteConnectionParameters.layout(); } } } @@ -495,34 +437,30 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { jtagDevice.select(index); } else { String storedAddress = ""; //$NON-NLS-1$ - int storedPort = 0; - String storedConnection = ""; //$NON-NLS-1$ + int storedPort = -1; + String storedConnection = null; 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$ + storedPort = configuration.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, -1); + storedConnection = configuration.getAttribute(IGDBJtagConstants.ATTR_CONNECTION, (String) null); jtagDevice.select(i); break; } } - if (storedConnection != null) { + String connectionText = IGDBJtagConstants.DEFAULT_CONNECTION; + if (null != storedConnection) { // if a connection URI try { - connection.setText(new URI(storedConnection).getSchemeSpecificPart()); + connectionText = new URI(storedConnection).getSchemeSpecificPart(); } catch (URISyntaxException e) { Activator.log(e); } + } else if (storedPort != -1) { // if a legacy address:port + connectionText = String.format("%s:%d", storedAddress, storedPort); //$NON-NLS-1$ } - 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); - } + connection.setText(connectionText); } boolean updateThreadsOnSuspend = configuration.getAttribute( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND, @@ -573,14 +511,10 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { String conn = connection.getText().trim(); URI uri = new URI("gdb", conn, ""); //$NON-NLS-1$ //$NON-NLS-2$ configuration.setAttribute(IGDBJtagConstants.ATTR_CONNECTION, uri.toString()); + configuration.removeAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS); + configuration.removeAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER); } else { - String ip = ipAddress.getText().trim(); - configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ip); - String port = portNumber.getText().trim(); - if (!port.isEmpty()) { - configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, - Integer.valueOf(port).intValue()); - } + configuration.removeAttribute(IGDBJtagConstants.ATTR_CONNECTION); } } catch (URISyntaxException e) { Activator.log(e);