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());
}
use of com.google.security.zynamics.zylib.types.lists.IFilledList 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.IFilledList in project binnavi by google.
the class CTutorialLoader method readTutorials.
/**
* Loads all tutorial files from the given directory.
*
* @param directory Directory from which the tutorials are loaded.
*
* @return List of tutorials loaded from the tutorial files in the given directory.
*/
public static IFilledList<CTutorial> readTutorials(final String directory) {
final IFilledList<CTutorial> tutorials = new FilledList<CTutorial>();
DirUtils.traverse(new File(directory), new IDirectoryTraversalCallback() {
@Override
public void entering(final File directory) {
// Irrelevant
}
@Override
public void leaving(final File directory) {
// Irrelevant
}
@Override
public void nextFile(final File file) {
if (file.getAbsolutePath().endsWith("xml")) {
try {
tutorials.add(loadTutorial(file));
} catch (final ParserConfigurationException e) {
CUtilityFunctions.logException(e);
} catch (final SAXException e) {
CUtilityFunctions.logException(e);
} catch (final IOException e) {
CUtilityFunctions.logException(e);
}
}
}
});
return tutorials;
}
use of com.google.security.zynamics.zylib.types.lists.IFilledList in project binnavi by google.
the class CTracesNodeComponent method showRelevantViews.
/**
* Shows the views that belong to a trace in the table in the lower half of the component.
*
* @param trace The trace list.
*
* @throws CouldntLoadDataException
*/
private void showRelevantViews(final TraceList trace) throws CouldntLoadDataException {
final IFilledList<UnrelocatedAddress> addresses = new FilledList<UnrelocatedAddress>();
for (final ITraceEvent traceEvent : trace) {
addresses.add(traceEvent.getOffset().getAddress());
}
final List<INaviView> views = m_container.getViewsWithAddresses(addresses, false);
if (m_container instanceof CProjectContainer) {
for (final INaviModule module : m_container.getModules()) {
if (module.isLoaded()) {
views.addAll(module.getViewsWithAddresses(addresses, false));
}
}
}
m_model.setViews(views);
}
use of com.google.security.zynamics.zylib.types.lists.IFilledList in project binnavi by google.
the class CFunctionFilterComponent method createFilter.
@Override
public IFilter<INaviView> createFilter() {
return new IFilter<INaviView>() {
@Override
public boolean checkCondition(final INaviView element) {
final CFunctionTypePanel typePanel = dialog.getFunctionTypePanel();
final INaviFunction function = module.getFunction(element);
return ((typePanel.isShowAdjustorFunctions() && (function.getType() == FunctionType.ADJUSTOR_THUNK)) || (typePanel.isShowImportedFunctions() && (function.getType() == FunctionType.IMPORT)) || (typePanel.isShowLibraryFunctions() && (function.getType() == FunctionType.LIBRARY)) || (typePanel.isShowNormalFunctions() && (function.getType() == FunctionType.NORMAL)) || (typePanel.isShowThunkFunctions() && (function.getType() == FunctionType.THUNK)));
}
@Override
public IFilledList<INaviView> get(final List<INaviView> elements) {
return new FilledList<INaviView>(CollectionHelpers.filter(elements, new ICollectionFilter<INaviView>() {
@Override
public boolean qualifies(final INaviView item) {
return checkCondition(item);
}
}));
}
};
}
Aggregations