use of com.google.security.zynamics.zylib.types.lists.IFilledList in project binnavi by google.
the class CBreakpointFunctionsTest method test7setBreakpoints.
@Test
public void test7setBreakpoints() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
final MockFunction mockFunction = new MockFunction();
final INaviModule mockModule = mockFunction.getModule();
CFunctionContainerHelper.addFunction(mockModule.getContent().getFunctionContainer(), mockFunction);
final DebugTargetSettings target = new ModuleTargetSettings(mockModule);
final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(mockModule));
debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x1234)))));
@SuppressWarnings("unused") final Breakpoint breakPoint = debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x1234))));
// CBreakpointAddress address = new CBreakpointAddress(mockModule, new CUnrelocatedAddress(new
// CAddress(0x2c9)));
debuggerProvider.addDebugger(debugger);
final CBreakpointTableModel tableModel = new CBreakpointTableModel(debuggerProvider);
assertEquals(1, tableModel.getRowCount());
final IFilledList<Pair<IDebugger, INaviFunction>> targets = new FilledList<Pair<IDebugger, INaviFunction>>();
final Pair<IDebugger, INaviFunction> targetPair = new Pair<IDebugger, INaviFunction>(debugger, mockFunction);
targets.add(targetPair);
CBreakpointRemoveFunctions.removeBreakpoints(targets);
assertEquals(0, tableModel.getRowCount());
CBreakpointSetFunctions.setBreakpoints(targets);
assertEquals(1, tableModel.getRowCount());
}
use of com.google.security.zynamics.zylib.types.lists.IFilledList in project binnavi by google.
the class CBreakpointFunctionsTest method test6removeFunctions.
@Test
public void test6removeFunctions() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
final MockFunction mockFunction = new MockFunction();
final INaviModule mockModule = mockFunction.getModule();
CFunctionContainerHelper.addFunction(mockModule.getContent().getFunctionContainer(), mockFunction);
final DebugTargetSettings target = new ModuleTargetSettings(mockModule);
final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(mockModule));
debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x1234)))));
@SuppressWarnings("unused") final Breakpoint breakPoint = debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x1234))));
debuggerProvider.addDebugger(debugger);
final CBreakpointTableModel tableModel = new CBreakpointTableModel(debuggerProvider);
assertEquals(1, tableModel.getRowCount());
final IFilledList<Pair<IDebugger, INaviFunction>> targets = new FilledList<Pair<IDebugger, INaviFunction>>();
final Pair<IDebugger, INaviFunction> targetPair = new Pair<IDebugger, INaviFunction>(debugger, mockFunction);
targets.add(targetPair);
assertEquals(1, targets.size());
CBreakpointRemoveFunctions.removeBreakpoints(targets);
@SuppressWarnings("unused") final BreakpointManager manager = debugger.getBreakpointManager();
assertEquals(0, tableModel.getRowCount());
}
use of com.google.security.zynamics.zylib.types.lists.IFilledList in project binnavi by google.
the class CDebuggerSynchronizerTest method testMemmap.
@Test
public void testMemmap() {
final IFilledList<MemorySection> sections = new FilledList<MemorySection>();
sections.add(new MemorySection(new CAddress(100), new CAddress(200)));
sections.add(new MemorySection(new CAddress(300), new CAddress(400)));
debuggerSynchronizer.receivedEvent(new MemoryMapReply(0, 0, new MemoryMap(sections)));
assertEquals(0, listener.exception);
assertEquals(2, mockDebugger.getProcessManager().getMemoryMap().getNumberOfSections());
}
use of com.google.security.zynamics.zylib.types.lists.IFilledList in project binnavi by google.
the class CProjectContainerTest method testGetViewsWithAddresses.
@Test
public void testGetViewsWithAddresses() throws CouldntLoadDataException {
final CProjectContainer container = new CProjectContainer(m_database, m_project);
@SuppressWarnings("unused") final INaviView view = container.createView("view1", "information");
final UnrelocatedAddress address = new UnrelocatedAddress(new MockAddress());
final IFilledList<UnrelocatedAddress> addresses = new FilledList<UnrelocatedAddress>();
addresses.add(address);
try {
container.getViewsWithAddresses(null, true);
fail();
} catch (final NullPointerException e) {
}
// assertNull(container.getViewsWithAddresses(addresses, true));
}
use of com.google.security.zynamics.zylib.types.lists.IFilledList 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());
}
Aggregations