Search in sources :

Example 11 with FilledList

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());
}
Also used : MemoryMap(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap) MemorySection(com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) MemoryMapReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.MemoryMapReply) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 12 with FilledList

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);
    }
}
Also used : MemoryMap(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap) MemorySection(com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) ArrayList(java.util.ArrayList) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) IAddress(com.google.security.zynamics.zylib.disassembly.IAddress) ProcessManager(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress)

Example 13 with FilledList

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);
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) ITraceEvent(com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent)

Example 14 with FilledList

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);
                }
            }));
        }
    };
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) IFilter(com.google.security.zynamics.binnavi.Gui.FilterPanel.IFilter) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) ICollectionFilter(com.google.security.zynamics.zylib.types.common.ICollectionFilter) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) List(java.util.List) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction)

Example 15 with FilledList

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;
}
Also used : FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) IOException(java.io.IOException) File(java.io.File) IDirectoryTraversalCallback(com.google.security.zynamics.zylib.io.IDirectoryTraversalCallback) SAXException(org.xml.sax.SAXException)

Aggregations

FilledList (com.google.security.zynamics.zylib.types.lists.FilledList)31 Test (org.junit.Test)18 IFilledList (com.google.security.zynamics.zylib.types.lists.IFilledList)17 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)11 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)9 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)8 MockFunction (com.google.security.zynamics.binnavi.disassembly.MockFunction)7 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)7 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)5 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)5 CCodeNode (com.google.security.zynamics.binnavi.disassembly.CCodeNode)5 INaviEdge (com.google.security.zynamics.binnavi.disassembly.INaviEdge)5 INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)5 MockView (com.google.security.zynamics.binnavi.disassembly.MockView)5 ArrayList (java.util.ArrayList)5 MemoryMap (com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap)4 MemorySection (com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection)4 DebuggerException (com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerException)4 DebuggerOptions (com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions)4 TraceList (com.google.security.zynamics.binnavi.debug.models.trace.TraceList)4