use of com.google.security.zynamics.zylib.types.lists.FilledList in project binnavi by google.
the class CStackMemoryProviderTest method testNumberOfEntries.
@Test
public void testNumberOfEntries() throws DebugExceptionWrapper {
m_provider.setDebugger(m_debugger);
m_debugger.getProcessManager().setTargetInformation(new TargetInformation(5, new FilledList<RegisterDescription>(), new DebuggerOptions(false, false, false, false, false, false, false, false, false, false, 12, 0, new ArrayList<DebuggerException>(), false, false, false)));
assertEquals(0, m_provider.getNumberOfEntries());
m_debugger.connect();
assertEquals(0, m_provider.getNumberOfEntries());
final TargetProcessThread thread = new TargetProcessThread(0, ThreadState.SUSPENDED);
thread.setRegisterValues(Lists.newArrayList(new RegisterValue("esp", BigInteger.valueOf(0x123), new byte[0], false, true)));
m_provider.setActiveThread(thread);
assertEquals(0, m_provider.getNumberOfEntries());
m_debugger.getProcessManager().setMemoryMap(new MemoryMap(Lists.newArrayList(new MemorySection(new CAddress(0x100), new CAddress(0x180)))));
assertEquals(0x80 / 0x04, m_provider.getNumberOfEntries());
}
use of com.google.security.zynamics.zylib.types.lists.FilledList in project binnavi by google.
the class CPostgreSQLModuleContentTest method testCModuleContentConstructor.
@Test
public void testCModuleContentConstructor() throws LoadCancelledException, CouldntLoadDataException {
final CModule module = (CModule) getDatabase().getContent().getModules().get(0);
module.load();
final ListenerProvider<IModuleListener> listeners = new ListenerProvider<IModuleListener>();
final CCallgraph callgraph = module.getContent().getNativeCallgraph();
final IFilledList<INaviFunction> functions = new FilledList<INaviFunction>();
functions.add(module.getContent().getFunctionContainer().getFunctions().get(0));
final ICallgraphView nativeCallgraph = module.getContent().getViewContainer().getNativeCallgraphView();
final ImmutableList<IFlowgraphView> nativeFlowgraphs = module.getContent().getViewContainer().getNativeFlowgraphViews();
final List<INaviView> customViews = new ArrayList<INaviView>();
final ImmutableBiMap<INaviView, INaviFunction> viewFunctionMap = new ImmutableBiMap.Builder<INaviView, INaviFunction>().build();
new Pair<HashMap<INaviView, INaviFunction>, HashMap<INaviFunction, INaviView>>(null, null);
final IFilledList<TraceList> traces = new FilledList<TraceList>();
final SectionContainer sections = new SectionContainer(new SectionContainerBackend(getProvider(), module));
final TypeInstanceContainer instances = new TypeInstanceContainer(new TypeInstanceContainerBackend(getProvider(), module, module.getTypeManager(), sections), getProvider());
final CModuleContent moduleContent1 = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, viewFunctionMap, traces, sections, instances);
assertNotNull(moduleContent1);
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(null, null, null, null, null, null, null, null, null, null, sections, instances);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, null, null, null, null, null, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), null, null, null, null, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, null, null, null, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, null, null, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, null, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, viewFunctionMap, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, viewFunctionMap, traces, null, null);
fail();
} catch (final NullPointerException e) {
}
}
use of com.google.security.zynamics.zylib.types.lists.FilledList in project binnavi by google.
the class CTraceContainerTest method setUp.
@Before
public void setUp() throws CouldntLoadDataException, LoadCancelledException {
m_listener = new MockTraceContainerListener();
final CModule m_module = MockCreator.createModule(m_sql);
m_module.load();
m_content = new CTraceContainer(m_module, new FilledList<TraceList>(), m_sql);
m_content.addListener(m_listener);
}
use of com.google.security.zynamics.zylib.types.lists.FilledList in project binnavi by google.
the class CProjectContainerTest method setUp.
@Before
public void setUp() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
m_provider = new MockSqlProvider();
m_module = new MockModule(m_provider);
m_database = new MockDatabase(m_provider);
m_function = new MockFunction(m_provider);
m_project = new CProject(123, "Name", "Comment", new Date(), new Date(), 55, new FilledList<DebuggerTemplate>(), m_provider);
m_project.load();
m_space = m_project.getContent().createAddressSpace("space");
m_space.load();
m_space.getContent().addModule(m_module);
m_debugger = new DebuggerTemplate(2, "gdb", "local", 2222, m_provider);
m_space.getConfiguration().setDebuggerTemplate(m_debugger);
m_listener = new MockAddressSpaceListener();
m_space.addListener(m_listener);
m_module.load();
CFunctionContainerHelper.addFunction(m_module.getContent().getFunctionContainer(), m_function);
final CView view = m_module.getContent().getViewContainer().createView("foo", "bar");
@SuppressWarnings("unused") final MockViewContainer mockViewContainer = new MockViewContainer();
final MockViewListener listener = new MockViewListener();
view.addListener(listener);
}
use of com.google.security.zynamics.zylib.types.lists.FilledList in project binnavi by google.
the class CUnInlinerTest method testOneBlock.
@Test
public void testOneBlock() {
final List<INaviViewNode> nodes = new FilledList<INaviViewNode>();
final List<INaviEdge> edges = new FilledList<INaviEdge>();
final INaviFunction mockFunction = new MockFunction();
final CCodeNode node = new CCodeNode(0, 0, 0, 0, 0, Color.RED, Color.RED, false, true, null, mockFunction, new HashSet<CTag>(), m_provider);
nodes.add(node);
final MockView view = new MockView(nodes, edges, m_provider);
CUnInliner.unInline(view, node);
}
Aggregations