Search in sources :

Example 16 with Address

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

the class BookmarkManagerTest method testAddBookmark.

@Test
public void testAddBookmark() {
    m_apiManager.addListener(m_mockListener);
    try {
        m_apiManager.addBookmark(null, "Fark");
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        m_apiManager.addBookmark(new Address(0x123), null);
        fail();
    } catch (final NullPointerException exception) {
    }
    m_apiManager.addBookmark(new Address(0x123), "Fark");
    try {
        m_apiManager.addBookmark(new Address(0x123), "Fark");
        fail();
    } catch (final IllegalArgumentException exception) {
    }
    assertEquals(1, m_nativeManager.getNumberOfBookmarks());
    assertEquals(0x123, m_nativeManager.getBookmark(0).getAddress().toLong());
    assertEquals("Fark", m_nativeManager.getBookmark(0).getDescription());
    assertEquals(1, m_apiManager.getNumberOfBookmarks());
    assertEquals(0x123, m_apiManager.getBookmark(0).getAddress().toLong());
    assertEquals("Fark", m_apiManager.getBookmark(0).getDescription());
    assertEquals("addedBookmark/123;", m_mockListener.events);
    m_apiManager.removeListener(m_mockListener);
}
Also used : Address(com.google.security.zynamics.binnavi.API.disassembly.Address) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 17 with Address

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

the class BookmarkManagerTest method testRemoveBookmark.

@Test
public void testRemoveBookmark() {
    try {
        m_apiManager.removeBookmark(null);
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        m_apiManager.removeBookmark(new Address(0x123));
        fail();
    } catch (final NullPointerException exception) {
    }
    m_apiManager.addBookmark(new Address(0x123), "Fark");
    m_apiManager.addListener(m_mockListener);
    m_apiManager.removeBookmark(new Address(0x123));
    assertEquals(0, m_nativeManager.getNumberOfBookmarks());
    assertEquals(0, m_apiManager.getNumberOfBookmarks());
    assertEquals("removedBookmark/123;", m_mockListener.events);
    m_apiManager.removeListener(m_mockListener);
}
Also used : Address(com.google.security.zynamics.binnavi.API.disassembly.Address) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 18 with Address

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

the class BreakpointHelpersTest method testGetBreakpointsView.

@Test
public void testGetBreakpointsView() {
    assertTrue(BreakpointHelpers.getBreakpoints(m_debugger, m_view).isEmpty());
    m_debugger.getBreakpointManager().getNative().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x1234)))));
    m_debugger.getBreakpointManager().getNative().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x123)))));
    final List<Address> breakpoints = BreakpointHelpers.getBreakpoints(m_debugger, m_view);
    assertEquals(2, breakpoints.size());
    assertEquals(0x1234, breakpoints.get(0).toLong());
    assertEquals(0x123, breakpoints.get(1).toLong());
    try {
        BreakpointHelpers.getBreakpoints(null, m_view);
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        BreakpointHelpers.getBreakpoints(m_debugger, (View) 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 19 with Address

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

the class BreakpointHelpersTest method testGetEchoBreakpointsView.

@Test
public void testGetEchoBreakpointsView() {
    assertTrue(BreakpointHelpers.getEchoBreakpoints(m_debugger, m_view).isEmpty());
    m_debugger.getBreakpointManager().getNative().addBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x1234)))));
    m_debugger.getBreakpointManager().getNative().addBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x123)))));
    final List<Address> breakpoints = BreakpointHelpers.getEchoBreakpoints(m_debugger, m_view);
    assertEquals(2, breakpoints.size());
    assertEquals(0x1234, breakpoints.get(0).toLong());
    assertEquals(0x123, breakpoints.get(1).toLong());
    try {
        BreakpointHelpers.getEchoBreakpoints(null, m_view);
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        BreakpointHelpers.getEchoBreakpoints(m_debugger, (View) 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 20 with Address

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

the class BreakpointHelpersTest method testGetBreakpointsNode.

@Test
public void testGetBreakpointsNode() {
    assertTrue(BreakpointHelpers.getBreakpoints(m_debugger, m_node).isEmpty());
    m_debugger.getBreakpointManager().getNative().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x1234)))));
    final List<Address> breakpoints = BreakpointHelpers.getBreakpoints(m_debugger, m_node);
    assertEquals(1, breakpoints.size());
    assertEquals(0x1234, breakpoints.get(0).toLong());
    try {
        BreakpointHelpers.getBreakpoints(null, m_node);
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        BreakpointHelpers.getBreakpoints(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)

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