protected void toggleBreakpoint(Address address) { Breakpoint existing = emulator.getBreakPoint(address); if (existing == null) { emulator.addBreakpoint(new Breakpoint(address)); } else { emulator.deleteBreakpoint(existing); } }
private void renderDisassembly(final List<DisassembledLine> lines) { final Address pc = emulator.getCPU().getPC(); // used to mark the current PC value final StringBuilder result = new StringBuilder(); final Iterator<DisassembledLine> it = lines.iterator(); boolean first = true; while (it.hasNext()) { final DisassembledLine line = it.next(); if (first) { first = false; addressAtTopOfScreen = line.getAddress(); } if (!it.hasNext()) { addressAtBottomOfScreen = line.getAddress(); } // create disassembled line result.append(toString(pc, line)); if (it.hasNext()) { result.append("\n"); } } SwingUtilities.invokeLater( new Runnable() { @Override public void run() { textArea.setText(result.toString()); } }); }
@Override public void refreshDisplay() { if (emulator == null) { return; } setViewStartingAddress(emulator.getCPU().getPC()); }
public BreakpointView( DisassemblerView disView, SourceLevelDebugView sourceLevelDebugView, IEmulator emulator) { if (emulator == null) { throw new IllegalArgumentException("emulator must not be null"); } if (disView == null) { throw new IllegalArgumentException("disView must not be null"); } this.sourceLevelDebugView = sourceLevelDebugView; // may be NULL if we're debugging a plain object file without the // source this.disView = disView; this.emulator = emulator; emulator.addEmulationListener(listener); }
private void setEmulator(IEmulator emulator) { if (emulator == null) { throw new IllegalArgumentException("emulator must not be NULL."); } if (this.emulator == emulator) { return; } if (this.emulator != null) { this.emulator.removeEmulationListener(listener); } this.emulator = emulator; this.emulatorController = new EmulatorControllerView(perspective, emulator); emulator.addEmulationListener(listener); }
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; }
public void disposeHook() { emulator.removeEmulationListener(listener); }