Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Dallaway2019-08-23 14:40:30 +0000
committerJohn Dallaway2019-08-23 14:43:32 +0000
commit49c7ae5f3b8d566b4192f865aa3ce0cc5330c467 (patch)
tree42a888756133c9d3782669f37ba2d51bec07d61d
parentb1f14709b82e5b044e745cfed9d3659285d4a92d (diff)
downloadorg.eclipse.cdt-49c7ae5f3b8d566b4192f865aa3ce0cc5330c467.tar.gz
org.eclipse.cdt-49c7ae5f3b8d566b4192f865aa3ce0cc5330c467.tar.xz
org.eclipse.cdt-49c7ae5f3b8d566b4192f865aa3ce0cc5330c467.zip
Bug 535163: Use 'reset and halt' command
Change-Id: Icfe5796a33c01208c1fa98cc6357d21c0e83b9ae Signed-off-by: John Dallaway <john@dallaway.org.uk>
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/GDBJtagDSFFinalLaunchSequence.java32
-rw-r--r--jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/jtagdevice/IGDBJtagDevice.java25
2 files changed, 47 insertions, 10 deletions
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 4e1761704dc..59f169e6ed8 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
@@ -22,6 +22,7 @@
* John Dallaway - Test for reset/delay/halt command not defined (Bug 361881)
* Torbjörn Svensson (STMicroelectronics) - Bug 535024
* John Dallaway - Report download progress (Bug 543149)
+ * John Dallaway - Use 'reset and halt' command (Bug 535163)
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core;
@@ -412,7 +413,11 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
if (CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DO_RESET,
IGDBJtagConstants.DEFAULT_DO_RESET)) {
List<String> commands = new ArrayList<>();
- fGdbJtagDevice.doReset(commands);
+ if (useResetAndHalt()) {
+ fGdbJtagDevice.doResetAndHalt(commands);
+ } else {
+ fGdbJtagDevice.doReset(commands);
+ }
if (commands.isEmpty()) {
setError(String.format(Messages.getString("GDBJtagDebugger.reset_not_defined"), getGDBJtagDeviceName()), //$NON-NLS-1$
rm);
@@ -437,9 +442,11 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
List<String> commands = new ArrayList<>();
int delay = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DELAY, defaultDelay);
fGdbJtagDevice.doDelay(delay, commands);
- if (commands.isEmpty() && (delay != 0)) {
- setError(String.format(Messages.getString("GDBJtagDebugger.delay_not_defined"), getGDBJtagDeviceName()), //$NON-NLS-1$
- rm);
+ if (0 == delay) {
+ rm.done();
+ } else if (commands.isEmpty()) {
+ setError(String.format(Messages.getString("GDBJtagDebugger.delay_not_defined"), //$NON-NLS-1$
+ getGDBJtagDeviceName()), rm);
} else {
queueCommands(commands, rm);
}
@@ -454,7 +461,7 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
/** @since 8.2 */
@Execute
public void stepHaltBoard(final RequestMonitor rm) {
- if (CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DO_HALT,
+ if (!useResetAndHalt() && CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DO_HALT,
IGDBJtagConstants.DEFAULT_DO_HALT)) {
List<String> commands = new ArrayList<>();
fGdbJtagDevice.doHalt(commands);
@@ -773,6 +780,21 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
}
/**
+ * Determine if reset and halt should be issued as one command
+ */
+ private boolean useResetAndHalt() {
+ final boolean doReset = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DO_RESET,
+ IGDBJtagConstants.DEFAULT_DO_RESET);
+ final boolean doHalt = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DO_HALT,
+ IGDBJtagConstants.DEFAULT_DO_HALT);
+ final int defaultDelay = fGdbJtagDevice.getDefaultDelay();
+ final int delay = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DELAY, defaultDelay);
+ final List<String> resetAndHaltCommands = new ArrayList<>();
+ fGdbJtagDevice.doResetAndHalt(resetAndHaltCommands);
+ return doReset && doHalt && (0 == delay) && !resetAndHaltCommands.isEmpty();
+ }
+
+ /**
* Cleanup now that the sequence has been run.
* @since 8.2
*/
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 c854cee390b..461b2528d8a 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, 2012 QNX Software Systems and others.
+ * Copyright (c) 2008, 2019 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,6 +11,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Andy Jin - Hardware debugging UI improvements, bug 229946
+ * John Dallaway - Support 'reset and halt' command, bug 535163
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core.jtagdevice;
@@ -26,13 +27,13 @@ import java.util.Collection;
public interface IGDBJtagDevice {
/**
- * Device reset command
+ * Device reset and run commands
*
* @param commands
* implementation should populate the collection with the gdb
- * commands that will reset the device, or leave the collection
- * as-is if that operation is either unsupported or not
- * applicable
+ * commands that will reset the device and let it run, or leave
+ * the collection as-is if that operation is either unsupported
+ * or not applicable
*/
public void doReset(Collection<String> commands);
@@ -69,6 +70,20 @@ public interface IGDBJtagDevice {
public void doHalt(Collection<String> commands);
/**
+ * Device reset and immediate halt as a single command
+ *
+ * @param commands
+ * implementation should populate the collection with the
+ * single gdb command that will reset and halt the target, or
+ * leave the collection as-is if that operation is either
+ * unsupported or not applicable
+ * @since 9.3
+ */
+ default void doResetAndHalt(Collection<String> commands) {
+ /* override where supported by debugger */
+ }
+
+ /**
* Commands to connect to remote JTAG device
*
* @param ip

Back to the top