Search in sources :

Example 31 with BreakpointAddress

use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.

the class BreakpointHelpers method getBreakpoints.

/**
   * Returns the addresses of a code node where breakpoints of a given type are set.
   *
   * @param debugger The debugger that set the breakpoints.
   * @param node The code node to check.
   * @param type The type of the breakpoints to search for.
   *
   * @return The addresses of the code node where breakpoints are set.
   */
private static List<Address> getBreakpoints(final Debugger debugger, final CodeNode node, final BreakpointType type) {
    Preconditions.checkNotNull(debugger, "Error: Debugger argument can not be null");
    Preconditions.checkNotNull(node, "Error: Node argument can not be null");
    final BreakpointManager manager = debugger.getBreakpointManager();
    final List<Address> breakpoints = new ArrayList<Address>();
    for (final Instruction instruction : node.getInstructions()) {
        final BreakpointAddress address = new BreakpointAddress(instruction.getNative().getModule(), new UnrelocatedAddress(new CAddress(instruction.getAddress().toLong())));
        if (manager.getNative().hasBreakpoint(type, address)) {
            breakpoints.add(new Address(address.getAddress().getAddress().toBigInteger()));
        }
    }
    return breakpoints;
}
Also used : CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) Address(com.google.security.zynamics.binnavi.API.disassembly.Address) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) ArrayList(java.util.ArrayList) Instruction(com.google.security.zynamics.binnavi.API.disassembly.Instruction) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress)

Example 32 with BreakpointAddress

use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.

the class BreakpointManager method getEchoBreakpoint.

// ! Returns an echo breakpoint from a given address.
/**
   * Returns the echo breakpoint at the given address.
   *
   * @param module The module the echo breakpoint belongs to.
   * @param address The address of the breakpoint to return.
   *
   * @return The breakpoint at the given address.
   */
public Breakpoint getEchoBreakpoint(final Module module, final Address address) {
    Preconditions.checkNotNull(address, "Error: Address argument can not be null");
    final com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint internalBreakpoint = breakpointManager.getBreakpoint(BreakpointType.ECHO, new BreakpointAddress(module == null ? null : module.getNative(), new UnrelocatedAddress(new CAddress(address.toLong()))));
    return echoBreakpointMap.get(internalBreakpoint);
}
Also used : UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress)

Example 33 with BreakpointAddress

use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.

the class BreakpointManager method setBreakpoint.

// ! Sets a regular breakpoint.
/**
   * Sets a regular breakpoint at the given address.
   *
   * @param module The module the breakpoint is tied to. This argument can be null.
   * @param address The address of the breakpoint.
   *
   * @return The set breakpoint. Null is returned if no breakpoint was set.
   */
public Breakpoint setBreakpoint(final Module module, final Address address) {
    Preconditions.checkNotNull(address, "Error: Address argument can not be null");
    final INaviModule realModule = module == null ? null : module.getNative();
    final BreakpointAddress breakpointAddress = new BreakpointAddress(realModule, new UnrelocatedAddress(new CAddress(address.toLong())));
    final Set<BreakpointAddress> breakpoints = Sets.newHashSet(breakpointAddress);
    breakpointManager.addBreakpoints(BreakpointType.REGULAR, breakpoints);
    return echoBreakpointMap.get(breakpointManager.getBreakpoint(BreakpointType.REGULAR, breakpointAddress));
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress)

Example 34 with BreakpointAddress

use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.

the class BreakpointManager method removeEchoBreakpoint.

// ! Removes an echo breakpoint.
/**
   * Removes an echo breakpoint from a given address.
   *
   * @param module The module the breakpoint is tied to. This argument can be null.
   * @param address The address of the breakpoint.
   */
public void removeEchoBreakpoint(final Module module, final Address address) {
    Preconditions.checkNotNull(address, "Error: Address argument can not be null");
    breakpointManager.removeBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(module == null ? null : module.getNative(), new UnrelocatedAddress(new CAddress(address.toLong())))));
}
Also used : UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress)

Example 35 with BreakpointAddress

use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.

the class BreakpointManager method setEchoBreakpoint.

// ! Sets an echo breakpoint.
/**
   * Sets an echo breakpoint at the given address.
   *
   * @param module The module the breakpoint is tied to. This argument can be null.
   * @param address The address of the breakpoint.
   *
   * @return The set breakpoint. Null is returned if no breakpoint was set.
   */
public Breakpoint setEchoBreakpoint(final Module module, final Address address) {
    Preconditions.checkNotNull(address, "Error: Address argument can not be null");
    final INaviModule realModule = module == null ? null : module.getNative();
    final BreakpointAddress breakpointAddress = new BreakpointAddress(realModule, new UnrelocatedAddress(new CAddress(address.toLong())));
    final Set<BreakpointAddress> breakpoints = Sets.newHashSet(breakpointAddress);
    breakpointManager.addBreakpoints(BreakpointType.ECHO, breakpoints);
    return echoBreakpointMap.get(breakpointManager.getBreakpoint(BreakpointType.ECHO, breakpointAddress));
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress)

Aggregations

BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)87 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)60 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)49 Test (org.junit.Test)39 HashSet (java.util.HashSet)24 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)22 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)15 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)15 Breakpoint (com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint)15 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)13 Address (com.google.security.zynamics.binnavi.API.disassembly.Address)11 BreakpointManager (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager)11 TraceList (com.google.security.zynamics.binnavi.debug.models.trace.TraceList)11 ArrayList (java.util.ArrayList)9 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)8 DebugTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings)8 DebuggerProvider (com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider)8 CBreakpointTableModel (com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.CBreakpointTableModel)7 TraceLogger (com.google.security.zynamics.binnavi.debug.models.trace.TraceLogger)7 ITraceEvent (com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent)7