1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 361881: Test for undefined reset/delay/halt command

Change-Id: I55c7edf41fa8b1d1cef73254d98e596b04c30b51
Signed-off-by: John Dallaway <john@dallaway.org.uk>
This commit is contained in:
John Dallaway 2017-11-01 21:36:21 +00:00
parent 89cb1076e4
commit ebbe75d37f
3 changed files with 33 additions and 7 deletions

View file

@ -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.1.0.qualifier
Bundle-Version: 9.1.1.qualifier
Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.core.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,

View file

@ -16,6 +16,7 @@
* William Riley (Renesas) - Memory viewing broken (Bug 413483)
* 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)
*******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.core;
@ -341,7 +342,11 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
if (CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET)) {
List<String> commands = new ArrayList<String>();
fGdbJtagDevice.doReset(commands);
queueCommands(commands, rm);
if (commands.isEmpty()) {
setError(String.format(Messages.getString("GDBJtagDebugger.reset_not_defined"), getGDBJtagDeviceName()), rm); //$NON-NLS-1$
} else {
queueCommands(commands, rm);
}
} else {
rm.done();
}
@ -357,8 +362,13 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
if (CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DO_RESET, IGDBJtagConstants.DEFAULT_DO_RESET)) {
int defaultDelay = fGdbJtagDevice.getDefaultDelay();
List<String> commands = new ArrayList<String>();
fGdbJtagDevice.doDelay(CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DELAY, defaultDelay), commands);
queueCommands(commands, rm);
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()), rm); //$NON-NLS-1$
} else {
queueCommands(commands, rm);
}
} else {
rm.done();
}
@ -373,7 +383,11 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
if (CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_DO_HALT, IGDBJtagConstants.DEFAULT_DO_HALT)) {
List<String> commands = new ArrayList<String>();
fGdbJtagDevice.doHalt(commands);
queueCommands(commands, rm);
if (commands.isEmpty()) {
setError(String.format(Messages.getString("GDBJtagDebugger.halt_not_defined"), getGDBJtagDeviceName()), rm); //$NON-NLS-1$
} else {
queueCommands(commands, rm);
}
} else {
rm.done();
}
@ -611,9 +625,17 @@ public class GDBJtagDSFFinalLaunchSequence extends FinalLaunchSequence {
}
}
private void setError(String message, RequestMonitor rm) {
rm.done(new Status(IStatus.ERROR, Activator.PLUGIN_ID, message));
}
private String getGDBJtagDeviceName() {
return CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_JTAG_DEVICE, IGDBJtagConstants.DEFAULT_JTAG_DEVICE);
}
private IGDBJtagDevice getGDBJtagDevice () {
IGDBJtagDevice gdbJtagDevice = null;
String jtagDeviceName = CDebugUtils.getAttribute(getAttributes(), IGDBJtagConstants.ATTR_JTAG_DEVICE, IGDBJtagConstants.DEFAULT_JTAG_DEVICE);
String jtagDeviceName = getGDBJtagDeviceName();
GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance().getGDBJtagDeviceContribution();
for (GDBJtagDeviceContribution availableDevice : availableDevices) {
if (jtagDeviceName.equals(availableDevice.getDeviceName())) {

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2008 - 2010 QNX Software Systems and others.
# Copyright (c) 2008 - 2017 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
@ -7,6 +7,7 @@
#
# Contributors:
# QNX Software Systems - initial API and implementation
# John Dallaway - Test for reset/delay/halt command not defined (Bug 361881)
###############################################################################
GDBJtagDebugger.0=Starting debug session
GDBJtagDebugger.1=Error getting debug target
@ -21,3 +22,6 @@ src.common.No_answer=No answer
GDBJtagDebugger.err_no_sym_file=Symbolics loading was requested but file was not specified or not found.
GDBJtagDebugger.err_no_img_file=Image loading was requested but file was not specified or not found.
GDBJtagDebugger.delay_not_defined=Delay command not defined for device '%s'
GDBJtagDebugger.halt_not_defined=Halt command not defined for device '%s'
GDBJtagDebugger.reset_not_defined=Reset command not defined for device '%s'