Search in sources :

Example 51 with UnrelocatedAddress

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

the class PostgreSQLProviderTest method testCModuleFunctionsgetViewsWithAddresses1.

@Test
public void testCModuleFunctionsgetViewsWithAddresses1() throws CouldntLoadDataException, LoadCancelledException {
    final INaviModule module = getProvider().loadModules().get(0);
    module.load();
    final IFilledList<UnrelocatedAddress> addresses = new FilledList<UnrelocatedAddress>();
    List<INaviView> views = PostgreSQLModuleFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), module, addresses, true);
    assertEquals(0, views.size());
    addresses.add(new UnrelocatedAddress(new CAddress(0x10033DCL)));
    views = PostgreSQLModuleFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), module, addresses, true);
    assertEquals(1, views.size());
    addresses.add(new UnrelocatedAddress(new CAddress(0x1003429)));
    views = PostgreSQLModuleFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), module, addresses, true);
    assertEquals(0, views.size());
    views = PostgreSQLModuleFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), module, addresses, false);
    assertEquals(2, views.size());
}
Also used : AbstractSQLProvider(com.google.security.zynamics.binnavi.Database.AbstractSQLProvider) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 52 with UnrelocatedAddress

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

the class PostgreSQLProviderTest method testCProjectFunctionsgetViewsWithAddresses1.

@Test
public void testCProjectFunctionsgetViewsWithAddresses1() throws CouldntLoadDataException, LoadCancelledException {
    final INaviProject project = getProvider().loadProjects().get(0);
    project.load();
    final IFilledList<UnrelocatedAddress> addresses = new FilledList<UnrelocatedAddress>();
    List<INaviView> views = PostgreSQLProjectFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), project, addresses, true);
    assertEquals(0, views.size());
    addresses.add(new UnrelocatedAddress(new CAddress(0x10033DCL)));
    views = PostgreSQLProjectFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), project, addresses, true);
    assertEquals(0, views.size());
    addresses.add(new UnrelocatedAddress(new CAddress(0x1003429)));
    views = PostgreSQLProjectFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), project, addresses, true);
    assertEquals(0, views.size());
    views = PostgreSQLProjectFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), project, addresses, false);
    assertEquals(0, views.size());
}
Also used : AbstractSQLProvider(com.google.security.zynamics.binnavi.Database.AbstractSQLProvider) INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 53 with UnrelocatedAddress

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

the class PostgreSQLProviderTest method testGetViewsWithAddress_Project1.

@Test
public void testGetViewsWithAddress_Project1() throws CouldntLoadDataException, LoadCancelledException {
    final INaviProject project = getProvider().loadProjects().get(0);
    project.load();
    assertEquals(0, getProvider().getViewsWithAddress(project, Lists.newArrayList(new UnrelocatedAddress(new CAddress(0x01002B69))), true).size());
}
Also used : INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 54 with UnrelocatedAddress

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

the class CEventValueTableModelTest method foo.

@Test
public void foo() {
    final CEventValueTableModel model = new CEventValueTableModel();
    final INaviModule mockModule = new MockModule();
    final TraceEvent event = new TraceEvent(77, new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x123))), TraceEventType.REGULAR_BREAKPOINT, Lists.newArrayList(new TraceRegister("eax", new CAddress(0x123), new byte[] { 05, 06, 07 })));
    assertEquals(0, model.getRowCount());
    model.setEvent(event);
    assertEquals(1, model.getRowCount());
    assertEquals("eax", model.getValueAt(0, 0));
    assertEquals("00000123", model.getValueAt(0, 1));
    assertEquals("05 06 07", model.getValueAt(0, 2));
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) TraceRegister(com.google.security.zynamics.binnavi.debug.models.trace.TraceRegister) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) CEventValueTableModel(com.google.security.zynamics.binnavi.Gui.Debug.EventLists.CEventValueTableModel) TraceEvent(com.google.security.zynamics.binnavi.debug.models.trace.TraceEvent) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 55 with UnrelocatedAddress

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

the class CBreakpointManagerTest method testRemoveRegularBreakpoint.

@Test
public void testRemoveRegularBreakpoint() {
    // Error condition: Null argument
    try {
        m_manager.removeBreakpoints(BreakpointType.REGULAR, null);
        fail("Exception not raised");
    } catch (final NullPointerException ex) {
    }
    assertEquals(3, m_manager.getNumberOfBreakpoints(BreakpointType.REGULAR));
    m_manager.removeBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x123)))));
    assertEquals(2, m_manager.getNumberOfBreakpoints(BreakpointType.REGULAR));
    m_manager.removeBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x456)))));
    assertEquals(1, m_manager.getNumberOfBreakpoints(BreakpointType.REGULAR));
    m_manager.removeBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x789)))));
    assertEquals(0, m_manager.getNumberOfBreakpoints(BreakpointType.REGULAR));
}
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) Test(org.junit.Test)

Aggregations

UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)81 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)60 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)60 Test (org.junit.Test)49 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)28 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)15 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)15 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)13 Address (com.google.security.zynamics.binnavi.API.disassembly.Address)12 ArrayList (java.util.ArrayList)11 TraceList (com.google.security.zynamics.binnavi.debug.models.trace.TraceList)10 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)9 HashSet (java.util.HashSet)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 Breakpoint (com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint)8 FilledList (com.google.security.zynamics.zylib.types.lists.FilledList)8 CBreakpointTableModel (com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.CBreakpointTableModel)7 TraceLogger (com.google.security.zynamics.binnavi.debug.models.trace.TraceLogger)7