mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 15:25:49 +02:00
Fixed warnings and some minor code improvements
This commit is contained in:
parent
b21706e686
commit
e4a6c71946
1 changed files with 12 additions and 14 deletions
|
@ -15,8 +15,7 @@ package org.eclipse.cdt.debug.gdbjtag.core;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.List;
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
|
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
|
@ -110,7 +109,7 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList commands = new ArrayList();
|
List<String> commands = new ArrayList<String>();
|
||||||
|
|
||||||
// hook up to remote target
|
// hook up to remote target
|
||||||
if (submonitor.isCanceled()) {
|
if (submonitor.isCanceled()) {
|
||||||
|
@ -134,7 +133,7 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
|
||||||
|
|
||||||
// Run device-specific code to reset the board
|
// Run device-specific code to reset the board
|
||||||
if (config.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, true)) {
|
if (config.getAttribute(IGDBJtagConstants.ATTR_DO_RESET, true)) {
|
||||||
commands = new ArrayList();
|
commands.clear();
|
||||||
gdbJtagDevice.doReset(commands);
|
gdbJtagDevice.doReset(commands);
|
||||||
int defaultDelay = gdbJtagDevice.getDefaultDelay();
|
int defaultDelay = gdbJtagDevice.getDefaultDelay();
|
||||||
gdbJtagDevice.doDelay(config.getAttribute(IGDBJtagConstants.ATTR_DELAY, defaultDelay), commands);
|
gdbJtagDevice.doDelay(config.getAttribute(IGDBJtagConstants.ATTR_DELAY, defaultDelay), commands);
|
||||||
|
@ -144,7 +143,7 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
|
||||||
|
|
||||||
// Run device-specific code to halt the board
|
// Run device-specific code to halt the board
|
||||||
if (config.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, true)) {
|
if (config.getAttribute(IGDBJtagConstants.ATTR_DO_HALT, true)) {
|
||||||
commands = new ArrayList();
|
commands.clear();
|
||||||
gdbJtagDevice.doHalt(commands);
|
gdbJtagDevice.doHalt(commands);
|
||||||
executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15));
|
executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15));
|
||||||
}
|
}
|
||||||
|
@ -162,7 +161,7 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
|
||||||
monitor.beginTask(Messages.getString("GDBJtagDebugger.5"), 1); //$NON-NLS-1$
|
monitor.beginTask(Messages.getString("GDBJtagDebugger.5"), 1); //$NON-NLS-1$
|
||||||
imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName).replace("\\", "\\\\");
|
imageFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(imageFileName).replace("\\", "\\\\");
|
||||||
String imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, ""); //$NON-NLS-2$ //$NON-NLS-4$
|
String imageOffset = (imageFileName.endsWith(".elf")) ? "" : "0x" + config.getAttribute(IGDBJtagConstants.ATTR_IMAGE_OFFSET, ""); //$NON-NLS-2$ //$NON-NLS-4$
|
||||||
commands = new ArrayList();
|
commands.clear();
|
||||||
gdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
|
gdbJtagDevice.doLoadImage(imageFileName, imageOffset, commands);
|
||||||
executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
|
executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
|
||||||
}
|
}
|
||||||
|
@ -176,7 +175,7 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
|
||||||
if (symbolsFileName.length() > 0) {
|
if (symbolsFileName.length() > 0) {
|
||||||
symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName).replace("\\", "\\\\");
|
symbolsFileName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(symbolsFileName).replace("\\", "\\\\");
|
||||||
String symbolsOffset = "0x" + config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, ""); //$NON-NLS-2$
|
String symbolsOffset = "0x" + config.getAttribute(IGDBJtagConstants.ATTR_SYMBOLS_OFFSET, ""); //$NON-NLS-2$
|
||||||
commands = new ArrayList();
|
commands.clear();
|
||||||
gdbJtagDevice.doLoadSymbol(symbolsFileName, symbolsOffset, commands);
|
gdbJtagDevice.doLoadSymbol(symbolsFileName, symbolsOffset, commands);
|
||||||
executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15));
|
executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(15));
|
||||||
}
|
}
|
||||||
|
@ -209,7 +208,7 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
|
||||||
throw new OperationCanceledException();
|
throw new OperationCanceledException();
|
||||||
}
|
}
|
||||||
submonitor.worked(20);
|
submonitor.worked(20);
|
||||||
ArrayList commands = new ArrayList();
|
List<String> commands = new ArrayList<String>();
|
||||||
// Set program counter
|
// Set program counter
|
||||||
boolean setPc = config.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER);
|
boolean setPc = config.getAttribute(IGDBJtagConstants.ATTR_SET_PC_REGISTER, IGDBJtagConstants.DEFAULT_SET_PC_REGISTER);
|
||||||
if (setPc) {
|
if (setPc) {
|
||||||
|
@ -224,7 +223,7 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
|
||||||
boolean setStopAt = config.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT);
|
boolean setStopAt = config.getAttribute(IGDBJtagConstants.ATTR_SET_STOP_AT, IGDBJtagConstants.DEFAULT_SET_STOP_AT);
|
||||||
if (setStopAt) {
|
if (setStopAt) {
|
||||||
String stopAt = config.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, ""); //$NON-NLS-1$
|
String stopAt = config.getAttribute(IGDBJtagConstants.ATTR_STOP_AT, ""); //$NON-NLS-1$
|
||||||
commands = new ArrayList();
|
commands.clear();
|
||||||
gdbJtagDevice.doStopAt(stopAt, commands);
|
gdbJtagDevice.doStopAt(stopAt, commands);
|
||||||
executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
|
executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
|
||||||
}
|
}
|
||||||
|
@ -232,7 +231,7 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
|
||||||
|
|
||||||
boolean setResume = config.getAttribute(IGDBJtagConstants.ATTR_SET_RESUME, IGDBJtagConstants.DEFAULT_SET_RESUME);
|
boolean setResume = config.getAttribute(IGDBJtagConstants.ATTR_SET_RESUME, IGDBJtagConstants.DEFAULT_SET_RESUME);
|
||||||
if (setResume) {
|
if (setResume) {
|
||||||
commands = new ArrayList();
|
commands.clear();
|
||||||
gdbJtagDevice.doContinue(commands);
|
gdbJtagDevice.doContinue(commands);
|
||||||
executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
|
executeGDBScript(getGDBScript(commands), miSession, submonitor.newChild(20));
|
||||||
}
|
}
|
||||||
|
@ -305,13 +304,12 @@ public class GDBJtagDebugger extends AbstractGDBCDIDebugger {
|
||||||
return gdbJtagDevice;
|
return gdbJtagDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getGDBScript(Collection commands) {
|
private String getGDBScript(List<String> commands) {
|
||||||
if (commands.isEmpty())
|
if (commands.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
Iterator it = commands.iterator();
|
for (String cmd : commands) {
|
||||||
while (it.hasNext()) {
|
sb.append(cmd);
|
||||||
sb.append(it.next());
|
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue