mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 566462: Eliminate deprecated network-oriented API
Device contributions should now extend DefaultGDBJtagConnectionImpl and provide default connection details in the JTagDevice extension declaration. Launch configurations providing legacy connection data (ipAddress and portNumber) are accommodated at launch and upgraded to use connection URIs when edited. Change-Id: I36b5d3e49f1d8f0becf1b898b7a48eb239453f1b
This commit is contained in:
parent
4376632208
commit
eee4440071
15 changed files with 88 additions and 231 deletions
|
@ -213,23 +213,27 @@ public class DapGdbJtagLaunchDelegate extends DapLaunchDelegate {
|
|||
IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET)) {
|
||||
List<String> 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);
|
||||
}
|
||||
|
|
|
@ -27,16 +27,19 @@
|
|||
point="org.eclipse.cdt.debug.gdbjtag.core.JTagDevice">
|
||||
<device
|
||||
class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.GenericDevice"
|
||||
default_connection="localhost:10000"
|
||||
id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.genericDevice"
|
||||
name="%Generic.name">
|
||||
</device>
|
||||
<device
|
||||
class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.AbatronBDI2000"
|
||||
default_connection="bdi2000:2001"
|
||||
id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.AbatronBDI2000"
|
||||
name="%AbatronBDI2000.name">
|
||||
</device>
|
||||
<device
|
||||
class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.MacraigorUsb2Demon"
|
||||
default_connection="localhost:8888"
|
||||
id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.MacraigorUsb2Demon"
|
||||
name="%MacraigorUsb2Demon.name">
|
||||
</device>
|
||||
|
@ -54,21 +57,25 @@
|
|||
</device>
|
||||
<device
|
||||
class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.OpenOCDSocket"
|
||||
default_connection="localhost:3333"
|
||||
id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.OpenOCDSocket"
|
||||
name="%OpenOCDSocket.name">
|
||||
</device>
|
||||
<device
|
||||
class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.PEMicro"
|
||||
default_connection="localhost:7224"
|
||||
id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.PEMicro"
|
||||
name="%PEMicro.name">
|
||||
</device>
|
||||
<device
|
||||
class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.SeggerJLink"
|
||||
default_connection="localhost:2331"
|
||||
id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.SeggerJLink"
|
||||
name="%SeggerJLink.name">
|
||||
</device>
|
||||
<device
|
||||
class="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.STLink"
|
||||
default_connection="localhost:61234"
|
||||
id="org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.STLink"
|
||||
name="%STLink.name">
|
||||
</device>
|
||||
|
|
|
@ -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<String> 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();
|
||||
}
|
||||
|
|
|
@ -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<String> commands) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<String> 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<String> 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$
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<String> commands) {
|
||||
|
|
|
@ -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<String> commands);
|
||||
|
||||
/**
|
||||
* Commands to download the executable binary to target
|
||||
*
|
||||
|
@ -169,25 +151,4 @@ public interface IGDBJtagDevice {
|
|||
*/
|
||||
public void doContinue(Collection<String> 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();
|
||||
}
|
||||
|
|
|
@ -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<String> commands) {
|
||||
|
|
|
@ -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<String> commands) {
|
||||
|
|
|
@ -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<String> commands) {
|
||||
|
|
|
@ -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<String> commands) {
|
||||
|
|
|
@ -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<String> commands) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue