Пример #1
0
  protected void toggleBreakpoint(Address address) {

    Breakpoint existing = emulator.getBreakPoint(address);
    if (existing == null) {
      emulator.addBreakpoint(new Breakpoint(address));
    } else {
      emulator.deleteBreakpoint(existing);
    }
  }
Пример #2
0
  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());
          }
        });
  }
Пример #3
0
  @Override
  public void refreshDisplay() {
    if (emulator == null) {
      return;
    }

    setViewStartingAddress(emulator.getCPU().getPC());
  }
Пример #4
0
 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);
 }
Пример #5
0
  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);
  }
Пример #6
0
  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;
  }
Пример #7
0
 public void disposeHook() {
   emulator.removeEmulationListener(listener);
 }