Program: 5596
Project: 5596
Buggy source:
public void setupCommands(ComponentRegistry registry,CommandHandler ch){
  this.registry=registry;
  final MSP430 cpu=(MSP430)registry.getComponent(MSP430.class);
  final GenericNode node=(GenericNode)registry.getComponent("String_Node_Str");
  if (cpu != null) {
    ch.registerCommand("String_Node_Str",new BasicAsyncCommand("String_Node_Str","String_Node_Str"){
      int address=0;
      public int executeCommand(      final CommandContext context){
        int baddr=context.getArgumentAsAddress(0);
        if (baddr < 0) {
          context.err.println("String_Node_Str" + context.getArgument(0));
          return 1;
        }
        cpu.setBreakPoint(address=baddr,new CPUMonitor(){
          public void cpuAction(          int type,          int adr,          int data){
            context.out.println("String_Node_Str" + Utils.hex16(adr));
            cpu.stop();
          }
        }
);
        context.out.println("String_Node_Str" + Utils.hex16(baddr));
        return 0;
      }
      public void stopCommand(      CommandContext context){
        cpu.clearBreakPoint(address);
      }
    }
);
    ch.registerCommand("String_Node_Str",new BasicAsyncCommand("String_Node_Str","String_Node_Str"){
      int mode=0;
      int address=0;
      public int executeCommand(      final CommandContext context){
        int baddr=context.getArgumentAsAddress(0);
        if (baddr == -1) {
          context.err.println("String_Node_Str" + context.getArgument(0));
          return -1;
        }
        if (context.getArgumentCount() > 1) {
          String modeStr=context.getArgument(1);
          if ("String_Node_Str".equals(modeStr)) {
            mode=1;
          }
 else           if ("String_Node_Str".equals(modeStr)) {
            mode=2;
          }
        }
        cpu.setBreakPoint(address=baddr,new CPUMonitor(){
          public void cpuAction(          int type,          int adr,          int data){
            if (mode == 0 || mode == 2) {
              int pc=cpu.readRegister(0);
              String adrStr=getSymOrAddr(context,adr);
              String pcStr=getSymOrAddrELF(getELF(),pc);
              String op="String_Node_Str";
              if (type == MEMORY_READ) {
                op="String_Node_Str";
              }
 else               if (type == MEMORY_WRITE) {
                op="String_Node_Str";
              }
              context.out.println("String_Node_Str" + op + "String_Node_Str"+ pcStr+ "String_Node_Str"+ adrStr+ "String_Node_Str"+ data);
              if (mode == 2) {
                cpu.stop();
              }
            }
 else {
              context.out.print((char)data);
            }
          }
        }
);
        context.out.println("String_Node_Str" + Utils.hex16(baddr));
        return 0;
      }
      public void stopCommand(      CommandContext context){
        cpu.clearBreakPoint(address);
        context.exit(0);
      }
    }
);
    ch.registerCommand("String_Node_Str",new BasicAsyncCommand("String_Node_Str","String_Node_Str"){
      int mode=0;
      int register=0;
      public int executeCommand(      final CommandContext context){
        register=context.getArgumentAsRegister(0);
        if (register < 0) {
          return -1;
        }
        if (context.getArgumentCount() > 1) {
          String modeStr=context.getArgument(1);
          if ("String_Node_Str".equals(modeStr)) {
            mode=1;
          }
 else {
            context.err.println("String_Node_Str" + modeStr);
            return -1;
          }
        }
        cpu.setRegisterWriteMonitor(register,new CPUMonitor(){
          public void cpuAction(          int type,          int adr,          int data){
            if (mode == 0) {
              int pc=cpu.readRegister(0);
              String adrStr=getRegisterName(register);
              String pcStr=getSymOrAddrELF(getELF(),pc);
              context.out.println("String_Node_Str" + pcStr + "String_Node_Str"+ adrStr+ "String_Node_Str"+ data);
            }
 else {
              context.out.println(data);
            }
          }
        }
);
        context.out.println("String_Node_Str" + getRegisterName(register));
        return 0;
      }
      public void stopCommand(      CommandContext context){
        cpu.clearBreakPoint(register);
      }
    }
);
    ch.registerCommand("String_Node_Str",new Command(){
      public int executeCommand(      final CommandContext context){
        int baddr=context.getArgumentAsAddress(0);
        cpu.setBreakPoint(baddr,null);
        return 0;
      }
      public String getArgumentHelp(      String commandName){
        return "String_Node_Str";
      }
      public String getCommandHelp(      String commandName){
        return "String_Node_Str";
      }
    }
);
    ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
      public int executeCommand(      final CommandContext context){
        String regExp=context.getArgument(0);
        MapEntry[] entries=context.getMapTable().getEntries(regExp);
        for (int i=0; i < entries.length; i++) {
          MapEntry mapEntry=entries[i];
          int address=mapEntry.getAddress();
          context.out.println("String_Node_Str" + mapEntry.getName() + "String_Node_Str"+ Utils.hex16(address)+ "String_Node_Str"+ Utils.hex8(cpu.memory[address])+ "String_Node_Str"+ Utils.hex8(cpu.memory[address + 1])+ "String_Node_Str");
        }
        return 0;
      }
    }
);
    ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
      public int executeCommand(      final CommandContext context){
        int adr=context.getArgumentAsAddress(0);
        DebugInfo di=getELF().getDebugInfo(adr);
        if (di == null) {
          di=getELF().getDebugInfo(adr + 1);
        }
        if (di != null) {
          di.getLine();
          context.out.println(di);
        }
 else {
          context.err.println("String_Node_Str" + context.getArgument(0));
        }
        return 0;
      }
    }
);
    if (node != null) {
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          node.stop();
          context.out.println("String_Node_Str" + Utils.hex16(cpu.readRegister(0)));
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          node.start();
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          int nr=context.getArgumentCount() > 0 ? context.getArgumentAsInt(0) : 1;
          long cyc=cpu.cycles;
          if (cpu.isRunning()) {
            context.err.println("String_Node_Str");
            return -1;
          }
          try {
            node.step(nr);
          }
 catch (          Exception e) {
            e.printStackTrace(context.out);
          }
          context.out.println("String_Node_Str" + Utils.hex16(cpu.readRegister(0)) + "String_Node_Str"+ (cpu.cycles - cyc)+ "String_Node_Str"+ cpu.cycles+ "String_Node_Str");
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          int nr=context.getArgumentCount() > 0 ? context.getArgumentAsInt(0) : 1;
          long cyc=cpu.cycles;
          if (cpu.isRunning()) {
            context.err.println("String_Node_Str");
            return -1;
          }
          long nxt=0;
          try {
            nxt=cpu.stepMicros(context.getArgumentAsLong(0),context.getArgumentAsLong(1));
          }
 catch (          Exception e) {
            e.printStackTrace(context.out);
          }
          context.out.println("String_Node_Str" + Utils.hex16(cpu.readRegister(0)) + "String_Node_Str"+ (cpu.cycles - cyc)+ "String_Node_Str"+ cpu.cycles+ "String_Node_Str"+ nxt);
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          int stackEnd=context.getMapTable().heapStartAddress;
          int stackStart=context.getMapTable().stackStartAddress;
          int current=cpu.readRegister(MSP430Constants.SP);
          context.out.println("String_Node_Str" + Utils.hex16(current) + "String_Node_Str"+ (stackStart - current)+ "String_Node_Str"+ (stackStart - stackEnd)+ ')');
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          int adr=context.getArgumentAsAddress(0);
          if (adr != -1) {
            try {
              context.out.println("String_Node_Str" + context.getArgument(0) + "String_Node_Str"+ Utils.hex16(cpu.read(adr,adr >= 0x100)));
            }
 catch (            Exception e) {
              e.printStackTrace(context.out);
            }
            return 0;
          }
 else {
            context.err.println("String_Node_Str" + context.getArgument(0));
            return 1;
          }
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          int register=context.getArgumentAsRegister(0);
          if (register >= 0) {
            context.out.println(context.getArgument(0) + "String_Node_Str" + Utils.hex16(cpu.readRegister(register)));
            return 0;
          }
          return -1;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          cpu.reset();
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          long time=((long)(cpu.getTimeMillis()));
          long wallDiff=System.currentTimeMillis() - lastWall;
          context.out.println("String_Node_Str" + time + "String_Node_Str"+ (time - lastCall)+ "String_Node_Str"+ "String_Node_Str"+ wallDiff+ "String_Node_Str"+ (wallDiff == 0 ? "String_Node_Str" : "String_Node_Str" + (time - lastCall) / wallDiff));
          lastCall=time;
          lastWall=System.currentTimeMillis();
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        final CommandContext context){
          int start=context.getArgumentAsAddress(0);
          int count=context.getArgumentAsInt(1);
          int mode=Utils.DEC;
          int type=Utils.UBYTE;
          boolean signed=false;
          if (context.getArgumentCount() > 2) {
            int pos=2;
            int acount=context.getArgumentCount();
            if (acount > 4)             acount=4;
            while (pos < acount) {
              String tS=context.getArgument(pos++);
              if ("String_Node_Str".equals(tS)) {
              }
 else               if ("String_Node_Str".equals(tS)) {
                type=Utils.BYTE;
              }
 else               if ("String_Node_Str".equals(tS)) {
                type=Utils.WORD;
              }
 else               if ("String_Node_Str".equals(tS)) {
                type=Utils.UWORD;
              }
 else               if ("String_Node_Str".equals(tS)) {
                mode=Utils.HEX;
              }
 else               if ("String_Node_Str".equals(tS)) {
                mode=Utils.ASCII;
                type=Utils.BYTE;
              }
            }
          }
          for (int i=0; i < count; i++) {
            int data=0;
            data=cpu.memory[start++];
            if (Utils.size(type) == 2) {
              data=data + (cpu.memory[start++] << 8);
            }
            context.out.print((mode != Utils.ASCII ? "String_Node_Str" : "String_Node_Str") + Utils.toString(data,type,mode));
          }
          context.out.println();
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        final CommandContext context){
          int count=context.getArgumentCount();
          int adr=context.getArgumentAsAddress(0);
          String arg2=context.getArgument(1);
          int type=Utils.BYTE;
          int mode=Utils.DEC;
          boolean typeRead=false;
          if (count > 2) {
            if ("String_Node_Str".equals(arg2)) {
              mode=Utils.ASCII;
              typeRead=true;
            }
            if ("String_Node_Str".equals(arg2)) {
              type=Utils.WORD;
              typeRead=true;
            }
          }
          for (int i=typeRead ? 2 : 1; i < count; i++) {
            if (mode == Utils.DEC) {
              int val=context.getArgumentAsInt(i);
              boolean word=Utils.size(type) == 2 | val > 0xff;
              try {
                cpu.write(adr,val,word);
                adr+=word ? 2 : 1;
              }
 catch (              EmulationException e) {
                e.printStackTrace(context.out);
              }
            }
 else             if (mode == Utils.ASCII) {
              String data=context.getArgument(i);
              for (int j=0; j < data.length(); j++) {
                cpu.write(adr++,data.charAt(j) & 0xff,false);
              }
            }
          }
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        final CommandContext context){
          Memory xmem=(Memory)DebugCommands.this.registry.getComponent("String_Node_Str");
          if (xmem == null) {
            context.err.println("String_Node_Str");
            return 0;
          }
          int start=context.getArgumentAsAddress(0);
          int count=context.getArgumentAsInt(1);
          int size=1;
          boolean signed=false;
          if (context.getArgumentCount() > 2) {
            String tS=context.getArgument(2);
            if ("String_Node_Str".equals(tS)) {
              signed=true;
            }
 else             if ("String_Node_Str".equals(tS)) {
              signed=true;
              size=2;
            }
 else             if ("String_Node_Str".equals(tS)) {
              size=2;
            }
          }
          for (int i=0; i < count; i++) {
            int data=0;
            data=xmem.readByte(start++);
            if (size == 2) {
              data=data + (xmem.readByte(start++) << 8);
            }
            context.out.print("String_Node_Str" + data);
          }
          context.out.println();
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        final CommandContext context){
          Memory xmem=(Memory)DebugCommands.this.registry.getComponent("String_Node_Str");
          if (xmem == null) {
            context.err.println("String_Node_Str");
            return 0;
          }
          int adr=context.getArgumentAsAddress(0);
          int val=context.getArgumentAsInt(1);
          boolean word=val > 0xff;
          if (word) {
            xmem.writeByte(adr,val >> 8);
            val=val & 0xff;
            adr++;
          }
          xmem.writeByte(adr,val & 0xff);
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        private GDBStubs stubs=null;
        public int executeCommand(        CommandContext context){
          if (stubs != null) {
            context.err.println("String_Node_Str");
          }
 else {
            int port=context.getArgumentAsInt(0);
            stubs=new GDBStubs();
            stubs.setupServer(cpu,port);
          }
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        @Override public int executeCommand(        CommandContext context){
          Chip[] chips=cpu.getChips();
          for (int i=0; i < chips.length; i++) {
            context.out.println(chips[i].getName());
          }
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicAsyncCommand("String_Node_Str","String_Node_Str"){
        Chip chip=null;
        @Override public int executeCommand(        CommandContext context){
          chip=cpu.getChip(context.getArgument(0));
          if (chip == null) {
            context.err.println("String_Node_Str" + context.getArgument(0));
          }
          chip.setLogStream(context.out);
          return 0;
        }
        public void stopCommand(        CommandContext context){
          chip.clearLogStream();
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        @Override public int executeCommand(        CommandContext context){
          if ("String_Node_Str".equals(context.getArgument(0))) {
            int size=cpu.getTraceSize();
            DisAsm disAsm=cpu.getDisAsm();
            for (int i=0; i < size; i++) {
              int pc=cpu.getBackTrace(i);
              DbgInstruction inst=disAsm.getDbgInstruction(pc,cpu);
              inst.setPos(pc);
              System.out.println(inst);
            }
          }
 else {
            cpu.setTrace(context.getArgumentAsInt(0));
          }
          return 0;
        }
      }
);
    }
  }
}

Fixed version (ground truth):
public void setupCommands(ComponentRegistry registry,CommandHandler ch){
  this.registry=registry;
  final MSP430 cpu=(MSP430)registry.getComponent(MSP430.class);
  final GenericNode node=(GenericNode)registry.getComponent("String_Node_Str");
  if (cpu != null) {
    ch.registerCommand("String_Node_Str",new BasicAsyncCommand("String_Node_Str","String_Node_Str"){
      int address=0;
      public int executeCommand(      final CommandContext context){
        int baddr=context.getArgumentAsAddress(0);
        if (baddr < 0) {
          context.err.println("String_Node_Str" + context.getArgument(0));
          return 1;
        }
        cpu.setBreakPoint(address=baddr,new CPUMonitor(){
          public void cpuAction(          int type,          int adr,          int data){
            context.out.println("String_Node_Str" + Utils.hex16(adr));
            cpu.stop();
          }
        }
);
        context.out.println("String_Node_Str" + Utils.hex16(baddr));
        return 0;
      }
      public void stopCommand(      CommandContext context){
        cpu.clearBreakPoint(address);
      }
    }
);
    ch.registerCommand("String_Node_Str",new BasicAsyncCommand("String_Node_Str","String_Node_Str"){
      int mode=0;
      int address=0;
      public int executeCommand(      final CommandContext context){
        int baddr=context.getArgumentAsAddress(0);
        if (baddr == -1) {
          context.err.println("String_Node_Str" + context.getArgument(0));
          return -1;
        }
        if (context.getArgumentCount() > 1) {
          String modeStr=context.getArgument(1);
          if ("String_Node_Str".equals(modeStr)) {
            mode=1;
          }
 else           if ("String_Node_Str".equals(modeStr)) {
            mode=2;
          }
        }
        cpu.setBreakPoint(address=baddr,new CPUMonitor(){
          public void cpuAction(          int type,          int adr,          int data){
            if (mode == 0 || mode == 2) {
              int pc=cpu.readRegister(0);
              String adrStr=getSymOrAddr(context,adr);
              String pcStr=getSymOrAddrELF(getELF(),pc);
              String op="String_Node_Str";
              if (type == MEMORY_READ) {
                op="String_Node_Str";
              }
 else               if (type == MEMORY_WRITE) {
                op="String_Node_Str";
              }
              context.out.println("String_Node_Str" + op + "String_Node_Str"+ pcStr+ "String_Node_Str"+ adrStr+ "String_Node_Str"+ data);
              if (mode == 2) {
                cpu.stop();
              }
            }
 else {
              context.out.print((char)data);
            }
          }
        }
);
        context.out.println("String_Node_Str" + Utils.hex16(baddr));
        return 0;
      }
      public void stopCommand(      CommandContext context){
        cpu.clearBreakPoint(address);
        context.exit(0);
      }
    }
);
    ch.registerCommand("String_Node_Str",new BasicAsyncCommand("String_Node_Str","String_Node_Str"){
      int mode=0;
      int register=0;
      public int executeCommand(      final CommandContext context){
        register=context.getArgumentAsRegister(0);
        if (register < 0) {
          return -1;
        }
        if (context.getArgumentCount() > 1) {
          String modeStr=context.getArgument(1);
          if ("String_Node_Str".equals(modeStr)) {
            mode=1;
          }
 else {
            context.err.println("String_Node_Str" + modeStr);
            return -1;
          }
        }
        cpu.setRegisterWriteMonitor(register,new CPUMonitor(){
          public void cpuAction(          int type,          int adr,          int data){
            if (mode == 0) {
              int pc=cpu.readRegister(0);
              String adrStr=getRegisterName(register);
              String pcStr=getSymOrAddrELF(getELF(),pc);
              context.out.println("String_Node_Str" + pcStr + "String_Node_Str"+ adrStr+ "String_Node_Str"+ data);
            }
 else {
              context.out.println(data);
            }
          }
        }
);
        context.out.println("String_Node_Str" + getRegisterName(register));
        return 0;
      }
      public void stopCommand(      CommandContext context){
        cpu.clearBreakPoint(register);
      }
    }
);
    ch.registerCommand("String_Node_Str",new Command(){
      public int executeCommand(      final CommandContext context){
        int baddr=context.getArgumentAsAddress(0);
        cpu.setBreakPoint(baddr,null);
        return 0;
      }
      public String getArgumentHelp(      String commandName){
        return "String_Node_Str";
      }
      public String getCommandHelp(      String commandName){
        return "String_Node_Str";
      }
    }
);
    ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
      public int executeCommand(      final CommandContext context){
        String regExp=context.getArgument(0);
        MapEntry[] entries=context.getMapTable().getEntries(regExp);
        for (int i=0; i < entries.length; i++) {
          MapEntry mapEntry=entries[i];
          int address=mapEntry.getAddress();
          context.out.println("String_Node_Str" + mapEntry.getName() + "String_Node_Str"+ Utils.hex16(address)+ "String_Node_Str"+ Utils.hex8(cpu.memory[address])+ "String_Node_Str"+ Utils.hex8(cpu.memory[address + 1])+ "String_Node_Str");
        }
        return 0;
      }
    }
);
    ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
      public int executeCommand(      final CommandContext context){
        int adr=context.getArgumentAsAddress(0);
        DebugInfo di=getELF().getDebugInfo(adr);
        if (di == null) {
          di=getELF().getDebugInfo(adr + 1);
        }
        if (di != null) {
          di.getLine();
          context.out.println(di);
        }
 else {
          context.err.println("String_Node_Str" + context.getArgument(0));
        }
        return 0;
      }
    }
);
    if (node != null) {
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          node.stop();
          context.out.println("String_Node_Str" + Utils.hex16(cpu.readRegister(0)));
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          node.start();
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          int nr=context.getArgumentCount() > 0 ? context.getArgumentAsInt(0) : 1;
          long cyc=cpu.cycles;
          if (cpu.isRunning()) {
            context.err.println("String_Node_Str");
            return -1;
          }
          try {
            node.step(nr);
          }
 catch (          Exception e) {
            e.printStackTrace(context.out);
          }
          context.out.println("String_Node_Str" + Utils.hex16(cpu.readRegister(0)) + "String_Node_Str"+ (cpu.cycles - cyc)+ "String_Node_Str"+ cpu.cycles+ "String_Node_Str");
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          int nr=context.getArgumentCount() > 0 ? context.getArgumentAsInt(0) : 1;
          long cyc=cpu.cycles;
          if (cpu.isRunning()) {
            context.err.println("String_Node_Str");
            return -1;
          }
          long nxt=0;
          try {
            nxt=cpu.stepMicros(context.getArgumentAsLong(0),context.getArgumentAsLong(1));
          }
 catch (          Exception e) {
            e.printStackTrace(context.out);
          }
          context.out.println("String_Node_Str" + Utils.hex16(cpu.readRegister(0)) + "String_Node_Str"+ (cpu.cycles - cyc)+ "String_Node_Str"+ cpu.cycles+ "String_Node_Str"+ nxt);
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          int stackEnd=context.getMapTable().heapStartAddress;
          int stackStart=context.getMapTable().stackStartAddress;
          int current=cpu.readRegister(MSP430Constants.SP);
          context.out.println("String_Node_Str" + Utils.hex16(current) + "String_Node_Str"+ (stackStart - current)+ "String_Node_Str"+ (stackStart - stackEnd)+ ')');
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          int adr=context.getArgumentAsAddress(0);
          if (adr != -1) {
            try {
              context.out.println("String_Node_Str" + context.getArgument(0) + "String_Node_Str"+ Utils.hex16(cpu.read(adr,adr >= 0x100)));
            }
 catch (            Exception e) {
              e.printStackTrace(context.out);
            }
            return 0;
          }
 else {
            context.err.println("String_Node_Str" + context.getArgument(0));
            return 1;
          }
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          int register=context.getArgumentAsRegister(0);
          if (register >= 0) {
            context.out.println(context.getArgument(0) + "String_Node_Str" + Utils.hex16(cpu.readRegister(register)));
            return 0;
          }
          return -1;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          cpu.reset();
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        CommandContext context){
          long time=((long)(cpu.getTimeMillis()));
          long wallDiff=System.currentTimeMillis() - lastWall;
          context.out.println("String_Node_Str" + time + "String_Node_Str"+ (time - lastCall)+ "String_Node_Str"+ "String_Node_Str"+ wallDiff+ "String_Node_Str"+ (wallDiff == 0 ? "String_Node_Str" : "String_Node_Str" + (time - lastCall) / wallDiff));
          lastCall=time;
          lastWall=System.currentTimeMillis();
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        final CommandContext context){
          int start=context.getArgumentAsAddress(0);
          int count=context.getArgumentAsInt(1);
          int mode=Utils.DEC;
          int type=Utils.UBYTE;
          boolean signed=false;
          if (context.getArgumentCount() > 2) {
            int pos=2;
            int acount=context.getArgumentCount();
            if (acount > 4)             acount=4;
            while (pos < acount) {
              String tS=context.getArgument(pos++);
              if ("String_Node_Str".equals(tS)) {
              }
 else               if ("String_Node_Str".equals(tS)) {
                type=Utils.BYTE;
              }
 else               if ("String_Node_Str".equals(tS)) {
                type=Utils.WORD;
              }
 else               if ("String_Node_Str".equals(tS)) {
                type=Utils.UWORD;
              }
 else               if ("String_Node_Str".equals(tS)) {
                mode=Utils.HEX;
              }
 else               if ("String_Node_Str".equals(tS)) {
                mode=Utils.ASCII;
                type=Utils.BYTE;
              }
            }
          }
          for (int i=0; i < count; i++) {
            int data=0;
            data=cpu.memory[start++];
            if (Utils.size(type) == 2) {
              data=data + (cpu.memory[start++] << 8);
            }
            context.out.print((mode != Utils.ASCII ? "String_Node_Str" : "String_Node_Str") + Utils.toString(data,type,mode));
          }
          context.out.println();
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        final CommandContext context){
          int count=context.getArgumentCount();
          int adr=context.getArgumentAsAddress(0);
          String arg2=context.getArgument(1);
          int type=Utils.BYTE;
          int mode=Utils.DEC;
          boolean typeRead=false;
          if (count > 2) {
            if ("String_Node_Str".equals(arg2)) {
              mode=Utils.ASCII;
              typeRead=true;
            }
            if ("String_Node_Str".equals(arg2)) {
              type=Utils.WORD;
              typeRead=true;
            }
          }
          for (int i=typeRead ? 2 : 1; i < count; i++) {
            if (mode == Utils.DEC) {
              int val=context.getArgumentAsInt(i);
              boolean word=Utils.size(type) == 2 | val > 0xff;
              try {
                cpu.write(adr,val,word);
                adr+=word ? 2 : 1;
              }
 catch (              EmulationException e) {
                e.printStackTrace(context.out);
              }
            }
 else             if (mode == Utils.ASCII) {
              String data=context.getArgument(i);
              for (int j=0; j < data.length(); j++) {
                cpu.write(adr++,data.charAt(j) & 0xff,false);
              }
            }
          }
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        final CommandContext context){
          Memory xmem=(Memory)DebugCommands.this.registry.getComponent("String_Node_Str");
          if (xmem == null) {
            context.err.println("String_Node_Str");
            return 0;
          }
          int start=context.getArgumentAsAddress(0);
          int count=context.getArgumentAsInt(1);
          int size=1;
          boolean signed=false;
          if (context.getArgumentCount() > 2) {
            String tS=context.getArgument(2);
            if ("String_Node_Str".equals(tS)) {
              signed=true;
            }
 else             if ("String_Node_Str".equals(tS)) {
              signed=true;
              size=2;
            }
 else             if ("String_Node_Str".equals(tS)) {
              size=2;
            }
          }
          for (int i=0; i < count; i++) {
            int data=0;
            data=xmem.readByte(start++);
            if (size == 2) {
              data=data + (xmem.readByte(start++) << 8);
            }
            context.out.print("String_Node_Str" + data);
          }
          context.out.println();
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        public int executeCommand(        final CommandContext context){
          Memory xmem=(Memory)DebugCommands.this.registry.getComponent("String_Node_Str");
          if (xmem == null) {
            context.err.println("String_Node_Str");
            return 0;
          }
          int adr=context.getArgumentAsAddress(0);
          int val=context.getArgumentAsInt(1);
          boolean word=val > 0xff;
          if (word) {
            xmem.writeByte(adr,val >> 8);
            val=val & 0xff;
            adr++;
          }
          xmem.writeByte(adr,val & 0xff);
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        private GDBStubs stubs=null;
        public int executeCommand(        CommandContext context){
          if (stubs != null) {
            context.err.println("String_Node_Str");
          }
 else {
            int port=context.getArgumentAsInt(0);
            stubs=new GDBStubs();
            stubs.setupServer(cpu,port);
          }
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        @Override public int executeCommand(        CommandContext context){
          Chip[] chips=cpu.getChips();
          for (int i=0; i < chips.length; i++) {
            context.out.println(chips[i].getName());
          }
          return 0;
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicAsyncCommand("String_Node_Str","String_Node_Str"){
        Chip chip=null;
        @Override public int executeCommand(        CommandContext context){
          chip=cpu.getChip(context.getArgument(0));
          if (chip == null) {
            context.err.println("String_Node_Str" + context.getArgument(0));
          }
          chip.setLogStream(context.out);
          return 0;
        }
        public void stopCommand(        CommandContext context){
          chip.clearLogStream();
        }
      }
);
      ch.registerCommand("String_Node_Str",new BasicCommand("String_Node_Str","String_Node_Str"){
        @Override public int executeCommand(        CommandContext context){
          if ("String_Node_Str".equals(context.getArgument(0))) {
            int size=cpu.getTraceSize();
            DisAsm disAsm=cpu.getDisAsm();
            for (int i=0; i < size; i++) {
              int pc=cpu.getBackTrace(size - 1 - i);
              DbgInstruction inst=disAsm.getDbgInstruction(pc,cpu);
              inst.setPos(pc);
              System.out.println(inst);
            }
          }
 else {
            cpu.setTrace(context.getArgumentAsInt(0));
          }
          return 0;
        }
      }
);
    }
  }
}