private String createLinePrefix(Address pc, Address realAddress, DisassembledLine line) { /* * The prefix may contain a flag indicating that * a breakpoint is present on this line as well * as a caret for the current program counter (PC) position. * * Example: * * [B] >> 0000: SET a,1 */ final Breakpoint breakpoint = emulator.getBreakPoint(realAddress); String prefix1 = breakpoint != null ? breakpoint.isEnabled() ? "[B] " : "[_] " : " "; String prefix2 = realAddress.equals(pc) ? ">> " : " "; return prefix1 + prefix2; }
private DisassembledLine parseDisassembledLine(String text) { // [B] >> 0000: final Pattern pattern = Pattern.compile("^(\\[[B_]{1}\\]){0,1}[ ]*(>>){0,1}[ ]*([0-9a-f]+):(.*?);(.*)"); final Matcher m = pattern.matcher(text); if (!m.matches()) { throw new RuntimeException("Unparseable line '" + text + "'"); } @SuppressWarnings("unused") final String hasBreakpoint = m.group(1); @SuppressWarnings("unused") final String isAtCurrentPC = m.group(2); final Address address = Address.wordAddress(Misc.parseHexString(m.group(3))); final String disassembly = m.group(4); final String instructionWordsHexDump = m.group(5).trim(); final Size instructionSize = Size.words(instructionWordsHexDump.split(" ").length); return new DisassembledLine(address, disassembly, instructionSize); }