Search in sources :

Example 71 with CAddress

use of com.google.security.zynamics.zylib.disassembly.CAddress 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 72 with CAddress

use of com.google.security.zynamics.zylib.disassembly.CAddress 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 73 with CAddress

use of com.google.security.zynamics.zylib.disassembly.CAddress 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 74 with CAddress

use of com.google.security.zynamics.zylib.disassembly.CAddress in project binnavi by google.

the class FunctionNodeTest method testConstructor.

@Test
public void testConstructor() {
    final Database database = new Database(new MockDatabase());
    final TagManager nodeTagManager = new TagManager(new MockTagManager(com.google.security.zynamics.binnavi.Tagging.TagType.NODE_TAG));
    final TagManager viewTagManager = new TagManager(new MockTagManager(com.google.security.zynamics.binnavi.Tagging.TagType.VIEW_TAG));
    final MockSqlProvider provider = new MockSqlProvider();
    final CModule internalModule = new CModule(1, "", "", new Date(), new Date(), "00000000000000000000000000000000", "0000000000000000000000000000000000000000", 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, provider);
    final Module module = new Module(database, internalModule, nodeTagManager, viewTagManager);
    final MockView mockView = new MockView();
    final View view = new View(module, mockView, nodeTagManager, viewTagManager);
    final CFunction internalFunction = new CFunction(internalModule, new MockView(), new CAddress(0x123), "Mock Function", "Mock Function", "Mock Description", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, provider);
    final CFunctionNode internalFunctionNode = new CFunctionNode(0, internalFunction, 0, 0, 0, 0, Color.RED, false, false, null, new HashSet<CTag>(), provider);
    final CFunction parentFunction = new CFunction(internalModule, new MockView(), new CAddress(0x123), "Mock Function", "Mock Function", "Mock Description", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, provider);
    final Function function = new Function(module, parentFunction);
    final FunctionNode node = new FunctionNode(view, internalFunctionNode, function, viewTagManager);
    assertEquals(function, node.getFunction());
    assertEquals("Function Node ['Mock Function']", node.toString());
}
Also used : CFunctionNode(com.google.security.zynamics.binnavi.disassembly.CFunctionNode) MockView(com.google.security.zynamics.binnavi.disassembly.MockView) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) CFunctionNode(com.google.security.zynamics.binnavi.disassembly.CFunctionNode) CFunction(com.google.security.zynamics.binnavi.disassembly.CFunction) MockTagManager(com.google.security.zynamics.binnavi.Tagging.MockTagManager) CView(com.google.security.zynamics.binnavi.disassembly.views.CView) MockView(com.google.security.zynamics.binnavi.disassembly.MockView) Date(java.util.Date) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) CFunction(com.google.security.zynamics.binnavi.disassembly.CFunction) MockTagManager(com.google.security.zynamics.binnavi.Tagging.MockTagManager) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule) Test(org.junit.Test)

Example 75 with CAddress

use of com.google.security.zynamics.zylib.disassembly.CAddress in project binnavi by google.

the class FunctionTest method setUp.

@Before
public void setUp() {
    m_provider = new MockSqlProvider();
    final CModule internalModule = new CModule(123, "Name", "Comment", new Date(), new Date(), "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, m_provider), null, Integer.MAX_VALUE, false, m_provider);
    m_internalFunction = new CFunction(internalModule, MockView.getFullView(m_provider, com.google.security.zynamics.zylib.disassembly.ViewType.Native, null), new CAddress(0x123), "Mock Function", "Mock Function", "Mock Description", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, m_provider);
    m_internalFunction2 = new CFunction(internalModule, MockView.getFullView(m_provider, com.google.security.zynamics.zylib.disassembly.ViewType.Native, null), new CAddress(0x124), "Mock Function 2", "Mock Function 2", "Mock Description 2", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, m_provider);
}
Also used : DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) CFunction(com.google.security.zynamics.binnavi.disassembly.CFunction) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule) Date(java.util.Date) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Before(org.junit.Before)

Aggregations

CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)315 Test (org.junit.Test)221 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)60 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)55 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)51 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)48 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)47 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)47 ArrayList (java.util.ArrayList)46 Date (java.util.Date)46 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)45 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)40 MemorySection (com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection)32 MemoryMap (com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap)29 MockView (com.google.security.zynamics.binnavi.disassembly.MockView)28 TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)27 RelocatedAddress (com.google.security.zynamics.binnavi.disassembly.RelocatedAddress)27 CFunction (com.google.security.zynamics.binnavi.disassembly.CFunction)26 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)24 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)24