do not show file name when no file information is available

This commit is contained in:
Niclas Finne 2012-05-15 00:49:40 +02:00
parent 45dc922144
commit 70b8a275ac
2 changed files with 8 additions and 4 deletions

View File

@ -64,7 +64,7 @@ public class DebugCommands implements CommandBundle {
public void setupCommands(ComponentRegistry registry, CommandHandler ch) { public void setupCommands(ComponentRegistry registry, CommandHandler ch) {
this.registry = registry; this.registry = registry;
final MSP430 cpu = registry.getComponent(MSP430.class); final MSP430 cpu = registry.getComponent(MSP430.class);
final GenericNode node = (GenericNode) registry.getComponent("node"); final GenericNode node = registry.getComponent(GenericNode.class, "node");
if (cpu != null) { if (cpu != null) {
ch.registerCommand("break", new BasicAsyncCommand("add a breakpoint to a given address or symbol", ch.registerCommand("break", new BasicAsyncCommand("add a breakpoint to a given address or symbol",
"<address or symbol>") { "<address or symbol>") {
@ -245,11 +245,15 @@ public class DebugCommands implements CommandBundle {
} else { } else {
for (MapEntry mapEntry : entries) { for (MapEntry mapEntry : entries) {
int address = mapEntry.getAddress(); int address = mapEntry.getAddress();
String file = mapEntry.getFile();
if (file == null) {
file = "(unspecified)";
}
context.out.println(" " + mapEntry.getName() + " at $" context.out.println(" " + mapEntry.getName() + " at $"
+ cpu.getAddressAsString(address) + " ($" + cpu.getAddressAsString(address) + " ($"
+ Utils.hex8(cpu.getMemory().get(address, AccessMode.BYTE)) + Utils.hex8(cpu.getMemory().get(address, AccessMode.BYTE))
+ ' ' + Utils.hex8(cpu.getMemory().get(address + 1, AccessMode.BYTE)) + ") " + ' ' + Utils.hex8(cpu.getMemory().get(address + 1, AccessMode.BYTE)) + ") "
+ mapEntry.getType() + " in file " + mapEntry.getFile()); + mapEntry.getType() + " in file " + file);
} }
} }
return 0; return 0;
@ -374,7 +378,7 @@ public class DebugCommands implements CommandBundle {
public int executeCommand(CommandContext context) { public int executeCommand(CommandContext context) {
int register = context.getArgumentAsRegister(0); int register = context.getArgumentAsRegister(0);
if (register >= 0) { if (register >= 0) {
context.out.println(context.getArgument(0) + " = $" + Utils.hex16(cpu.getRegister(register))); context.out.println(context.getArgument(0) + " = $" + Utils.hex(cpu.getRegister(register), 4));
return 0; return 0;
} }
return -1; return -1;

View File

@ -388,7 +388,7 @@ public class ELF {
int len = symTable.size; int len = symTable.size;
int count = len / symTable.getEntrySize(); int count = len / symTable.getEntrySize();
int addr = symTable.getOffset(); int addr = symTable.getOffset();
String currentFile = ""; String currentFile = null;
if (DEBUG) { if (DEBUG) {
System.out.println("Number of symbols:" + count); System.out.println("Number of symbols:" + count);
} }