From a6808f07ab11aa707a44fbf740b738e3a9a5d054 Mon Sep 17 00:00:00 2001 From: John Dallaway Date: Thu, 21 Oct 2021 15:11:52 +0100 Subject: [PATCH] Bug 576811: Provide default launch delay implementation Change-Id: Ieedd3f935b9b396c5c9022aed0a161477df285fd Signed-off-by: John Dallaway --- .../debug/gdbjtag/core/jtagdevice/AbatronBDI2000.java | 8 +++++++- .../core/jtagdevice/DefaultGDBJtagDeviceImpl.java | 8 ++++++-- .../cdt/debug/gdbjtag/core/jtagdevice/GenericDevice.java | 9 ++++----- .../cdt/debug/gdbjtag/core/jtagdevice/PEMicro.java | 8 ++------ .../eclipse/cdt/debug/gdbjtag/core/jtagdevice/PyOCD.java | 6 +----- .../cdt/debug/gdbjtag/core/jtagdevice/STLink.java | 8 ++------ 6 files changed, 22 insertions(+), 25 deletions(-) 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 7158469fb72..404a46601b9 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, 2020 QNX Software Systems and others. + * Copyright (c) 2008, 2021 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 - Provide 'reset and halt' command, bug 550963 * John Dallaway - Eliminate deprecated API, bug 566462 + * John Dallaway - Override default delay implementation, bug 576811 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; @@ -20,6 +21,11 @@ import java.util.Collection; public class AbatronBDI2000 extends DefaultGDBJtagConnectionImpl { + @Override + public void doDelay(int delay, Collection commands) { + addCmd(commands, "monitor delay " + String.valueOf(delay * 1000)); //$NON-NLS-1$ + } + @Override public void doResetAndHalt(Collection commands) { addCmd(commands, "monitor reset halt"); //$NON-NLS-1$ 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 6e49bfc48ba..73b70de8d55 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, 2020 QNX Software Systems and others. + * Copyright (c) 2008, 2021 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 - Use GDB/MI for temporary breakpoint, bug 525726 * John Dallaway - Eliminate deprecated API, bug 566462 + * John Dallaway - Generalize default delay implementation, bug 576811 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; @@ -32,7 +33,10 @@ public class DefaultGDBJtagDeviceImpl implements IGDBJtagDevice { @Override public void doDelay(int delay, Collection commands) { - String cmd = "monitor delay " + String.valueOf(delay * 1000); //$NON-NLS-1$ + // sleep is available on most hosts (including Cygwin and MSYS2) as + // part of the coreutils package but extenders should override this + // method to use an equivalent GDB "monitor" command if available + String cmd = "shell sleep " + String.valueOf(delay); //$NON-NLS-1$ addCmd(commands, cmd); } 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 e884417c352..d42eb9586d1 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, 2020 QNX Software Systems and others. + * Copyright (c) 2008, 2021 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 - Eliminate deprecated API, bug 566462 + * John Dallaway - Use default delay implementation, bug 576811 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; @@ -19,16 +20,14 @@ import java.util.Collection; public class GenericDevice extends DefaultGDBJtagConnectionImpl { - @Override - public void doDelay(int delay, Collection commands) { - } - @Override public void doHalt(Collection commands) { + /* not supported */ } @Override public void doReset(Collection commands) { + /* not supported */ } } 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 1555486988e..c40241ca365 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, 2020 QNX Software Systems and others. + * Copyright (c) 2008, 2021 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 - PEmicro extension, bug 552597 * John Dallaway - Eliminate deprecated API, bug 566462 + * John Dallaway - Use default delay implementation, bug 576811 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; @@ -23,11 +24,6 @@ import java.util.Collection; */ public class PEMicro extends DefaultGDBJtagConnectionImpl { - @Override - public void doDelay(int delay, Collection commands) { - /* not supported */ - } - @Override public void doHalt(Collection commands) { /* not supported */ diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/PyOCD.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/PyOCD.java index 6c0a857b44e..dd91d5bfee8 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/PyOCD.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/PyOCD.java @@ -12,6 +12,7 @@ * QNX Software Systems - Initial API and implementation * Andy Jin - Hardware debugging UI improvements, bug 229946 * John Dallaway - PyOCD extension, bug 574928 + * John Dallaway - Use default delay implementation, bug 576811 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; @@ -22,11 +23,6 @@ import java.util.Collection; */ public class PyOCD extends DefaultGDBJtagConnectionImpl { - @Override - public void doDelay(int delay, Collection commands) { - /* not supported */ - } - @Override public void doReset(Collection commands) { addCmd(commands, "monitor reset"); //$NON-NLS-1$ 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 88caf0114c0..221cda7f542 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2020 QNX Software Systems and others. + * Copyright (c) 2008, 2021 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 - ST-LINK extension, bug 558266 * John Dallaway - Eliminate deprecated API, bug 566462 + * John Dallaway - Use default delay implementation, bug 576811 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice; @@ -23,11 +24,6 @@ import java.util.Collection; */ public class STLink extends DefaultGDBJtagConnectionImpl { - @Override - public void doDelay(int delay, Collection commands) { - /* not supported */ - } - @Override public void doHalt(Collection commands) { /* not supported */