Search in sources :

Example 6 with Address

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

the class BreakpointHelpersTest method testGetEchoBreakpointsNode.

@Test
public void testGetEchoBreakpointsNode() {
    assertTrue(BreakpointHelpers.getEchoBreakpoints(m_debugger, m_node).isEmpty());
    m_debugger.getBreakpointManager().getNative().addBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x1234)))));
    final List<Address> breakpoints = BreakpointHelpers.getEchoBreakpoints(m_debugger, m_node);
    assertEquals(1, breakpoints.size());
    assertEquals(0x1234, breakpoints.get(0).toLong());
    try {
        BreakpointHelpers.getEchoBreakpoints(null, m_node);
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        BreakpointHelpers.getEchoBreakpoints(m_debugger, (CodeNode) null);
        fail();
    } catch (final NullPointerException exception) {
    }
}
Also used : BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Address(com.google.security.zynamics.binnavi.API.disassembly.Address) 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 7 with Address

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

the class TraceLoggerTest method testHitsProject.

@Test
public void testHitsProject() throws CouldntSaveDataException, DebugExceptionWrapper {
    m_mockDebugger.connect();
    final Trace trace = m_projectLogger.start("Name", "Description", Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100))));
    m_mockDebugger.connection.m_synchronizer.receivedEvent(new EchoBreakpointHitReply(0, 0, 0, new RegisterValues(Lists.<ThreadRegisters>newArrayList(new ThreadRegisters(0, Lists.newArrayList(new RegisterValue("esp", BigInteger.valueOf(0x1100), new byte[0], true, false)))))));
    m_projectLogger.stop();
    assertEquals("Name", trace.getName());
    assertEquals("Description", trace.getDescription());
    assertEquals(1, trace.getEvents().size());
    assertEquals(0x100, trace.getEvents().get(0).getAddress().toLong());
    assertEquals("TraceLogger [Debugger 'Mock' : Mock Project]", m_projectLogger.toString());
}
Also used : Trace(com.google.security.zynamics.binnavi.API.disassembly.Trace) RegisterValue(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValue) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Address(com.google.security.zynamics.binnavi.API.disassembly.Address) EchoBreakpointHitReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointHitReply) TracePoint(com.google.security.zynamics.binnavi.API.disassembly.TracePoint) ThreadRegisters(com.google.security.zynamics.binnavi.debug.models.targetinformation.ThreadRegisters) RegisterValues(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues) Test(org.junit.Test)

Example 8 with Address

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

the class TraceLoggerTest method testHits.

@Test
public void testHits() throws CouldntSaveDataException, DebugExceptionWrapper {
    m_mockDebugger.connect();
    final Trace trace = m_logger.start("Name", "Description", Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100)), new TracePoint(m_mockModule, new Address(0x100))));
    m_mockDebugger.connection.m_synchronizer.receivedEvent(new EchoBreakpointHitReply(0, 0, 0, new RegisterValues(Lists.<ThreadRegisters>newArrayList(new ThreadRegisters(0, Lists.newArrayList(new RegisterValue("esp", BigInteger.valueOf(0x1100), new byte[0], true, false)))))));
    m_logger.stop();
    assertEquals("Name", trace.getName());
    assertEquals("Description", trace.getDescription());
    assertEquals(1, trace.getEvents().size());
    assertEquals(0x100, trace.getEvents().get(0).getAddress().toLong());
    assertEquals("TraceLogger [Debugger 'Mock' : Mock Module]", m_logger.toString());
}
Also used : Trace(com.google.security.zynamics.binnavi.API.disassembly.Trace) RegisterValue(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValue) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Address(com.google.security.zynamics.binnavi.API.disassembly.Address) EchoBreakpointHitReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.EchoBreakpointHitReply) TracePoint(com.google.security.zynamics.binnavi.API.disassembly.TracePoint) ThreadRegisters(com.google.security.zynamics.binnavi.debug.models.targetinformation.ThreadRegisters) RegisterValues(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues) Test(org.junit.Test)

Example 9 with Address

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

the class BreakpointManagerTest method testGetBreakpoints.

@Test
public void testGetBreakpoints() {
    apiManager.setBreakpoint(module, new Address(0x123));
    final List<Breakpoint> breakpoints = apiManager.getBreakpoints();
    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)

Example 10 with Address

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

the class BreakpointManagerTest method testHasEchoBreakpoint.

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

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