use of com.google.security.zynamics.zylib.types.lists.FilledList 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.FilledList in project binnavi by google.
the class CMemorySelectionFunctions method askMemoryRange.
/**
* Asks the user for a memory range and displays it afterwards.
*
* @param dlg Dialog where the user can select a range.
* @param debugPerspectiveModel Describes the debug GUI perspective where the refresh action takes
* place.
*/
public static void askMemoryRange(final CMemoryRangeDialog dlg, final CDebugPerspectiveModel debugPerspectiveModel) {
final IDebugger debugger = debugPerspectiveModel.getCurrentSelectedDebugger();
if (debugger == null) {
return;
}
dlg.setVisible(true);
final IAddress start = dlg.getStart();
final IAddress numberOfBytes = dlg.getBytes();
if (start != null && numberOfBytes != null) {
debugPerspectiveModel.setActiveMemoryAddress(start, true);
final ProcessManager pmanager = debugger.getProcessManager();
pmanager.setMemoryMap(new MemoryMap(new FilledList<MemorySection>()));
pmanager.getMemory().clear();
final ArrayList<MemorySection> sections = new ArrayList<MemorySection>();
sections.add(new MemorySection(start, new CAddress(start.toBigInteger().add(numberOfBytes.toBigInteger()).subtract(BigInteger.ONE))));
final MemoryMap map = new MemoryMap(sections);
pmanager.setMemoryMap(map);
}
}
use of com.google.security.zynamics.zylib.types.lists.FilledList 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.FilledList 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);
}
}));
}
};
}
use of com.google.security.zynamics.zylib.types.lists.FilledList 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;
}
Aggregations