Search in sources :

Example 11 with Address

use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.

the class BreakpointManagerTest method testAddMultipleNative.

@Test
public void testAddMultipleNative() {
    internalManager.addBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(CommonTestObjects.MODULE, new UnrelocatedAddress(new CAddress(0x124)))));
    assertTrue(apiManager.hasEchoBreakpoint(module, new Address(0x124)));
    internalManager.clearBreakpointsPassive(BreakpointType.ECHO);
}
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) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 12 with Address

use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.

the class BreakpointManagerTest method testGetBreakpoint.

@Test
public void testGetBreakpoint() {
    try {
        apiManager.getBreakpoint(null, null);
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        apiManager.getBreakpoint(null, new Address(0x123));
        fail();
    } catch (final NullPointerException exception) {
    }
    apiManager.setBreakpoint(module, new Address(0x123));
    final Breakpoint breakpoint = apiManager.getBreakpoint(module, new Address(0x123));
    assertEquals(0x123, breakpoint.getAddress().toLong());
    final Module module = ModuleFactory.get();
    apiManager.setBreakpoint(module, new Address(0x123));
    assertTrue(apiManager.hasBreakpoint(module, new Address(0x123)));
    final Breakpoint breakpoint2 = apiManager.getBreakpoint(module, new Address(0x123));
    assertEquals(0x123, breakpoint2.getAddress().toLong());
    apiManager.removeBreakpoint(module, new Address(0x123));
}
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) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) Test(org.junit.Test)

Example 13 with Address

use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.

the class BreakpointManagerTest method testHasBreakpoint.

@Test
public void testHasBreakpoint() {
    try {
        apiManager.hasBreakpoint(null, null);
        fail();
    } catch (final NullPointerException exception) {
    }
    assertFalse(apiManager.hasBreakpoint(module, new Address(0x123)));
    apiManager.setBreakpoint(module, new Address(0x123));
    assertTrue(apiManager.hasBreakpoint(module, new Address(0x123)));
}
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) Test(org.junit.Test)

Example 14 with Address

use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.

the class BreakpointManagerTest method testRemoveBreakpoint.

@Test
public void testRemoveBreakpoint() {
    try {
        apiManager.removeBreakpoint(null, null);
        fail();
    } catch (final NullPointerException exception) {
    }
    apiManager.setBreakpoint(module, new Address(0x123));
    apiManager.setBreakpoint(module, new Address(0x124));
    apiManager.addListener(mockListener);
    apiManager.removeBreakpoint(module, new Address(0x123));
    internalManager.removeBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(CommonTestObjects.MODULE, new UnrelocatedAddress(new CAddress(0x124)))));
    assertEquals("removedBreakpoint/124;", mockListener.events);
    assertEquals(1, apiManager.getBreakpoints().size());
    apiManager.removeListener(mockListener);
}
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) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 15 with Address

use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.

the class BreakpointManagerTest method testGetEchoBreakpoints.

@Test
public void testGetEchoBreakpoints() {
    apiManager.setEchoBreakpoint(module, new Address(0x123));
    final List<Breakpoint> breakpoints = apiManager.getEchoBreakpoints();
    assertEquals(0x123, breakpoints.get(0).getAddress().toLong());
}
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) Test(org.junit.Test)

Aggregations

Address (com.google.security.zynamics.binnavi.API.disassembly.Address)44 Test (org.junit.Test)32 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)30 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)19 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)17 Module (com.google.security.zynamics.binnavi.API.disassembly.Module)7 Trace (com.google.security.zynamics.binnavi.API.disassembly.Trace)5 RelocatedAddress (com.google.security.zynamics.binnavi.disassembly.RelocatedAddress)5 Function (com.google.security.zynamics.binnavi.API.disassembly.Function)4 TracePoint (com.google.security.zynamics.binnavi.API.disassembly.TracePoint)4 ArrayList (java.util.ArrayList)4 MemoryModule (com.google.security.zynamics.binnavi.API.debug.MemoryModule)3 ReilInstruction (com.google.security.zynamics.binnavi.API.reil.ReilInstruction)2 InstructionGraph (com.google.security.zynamics.binnavi.API.reil.mono.InstructionGraph)2 InstructionGraphEdge (com.google.security.zynamics.binnavi.API.reil.mono.InstructionGraphEdge)2 InstructionGraphNode (com.google.security.zynamics.binnavi.API.reil.mono.InstructionGraphNode)2 EchoBreakpointHitReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointHitReply)2 RegisterValue (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValue)2 RegisterValues (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues)2 ThreadRegisters (com.google.security.zynamics.binnavi.debug.models.targetinformation.ThreadRegisters)2