Search in sources :

Example 16 with FilledList

use of com.google.security.zynamics.zylib.types.lists.FilledList in project binnavi by google.

the class CDebugBottomPanel method getPanels.

/**
   * Creates the panels that are shown in the panel.
   *
   * @param model Provides the data needed by the components in the panel.
   * @param debugPerspectiveModel Describes the debug perspective.
   *
   * @return The created panels.
   */
private static IFilledList<IResultsPanel> getPanels(final CGraphModel model, final CDebugPerspectiveModel debugPerspectiveModel) {
    final IFilledList<IResultsPanel> debugPanels = new FilledList<IResultsPanel>();
    debugPanels.add(new CCombinedMemoryPanel(model.getParent(), debugPerspectiveModel));
    debugPanels.add(new CModulesPanel(debugPerspectiveModel));
    debugPanels.add(new CThreadInformationPanel(debugPerspectiveModel));
    debugPanels.add(new CBreakpointPanel(model.getParent(), model.getDebuggerProvider(), model.getGraph(), model.getViewContainer()));
    debugPanels.add(new CTracesPanel(debugPerspectiveModel, model.getGraph(), model.getViewContainer().getTraceProvider(), model.getGraphPanel()));
    debugPanels.add(new CBookmarkPanel(model.getDebuggerProvider()));
    debugPanels.add(new CDebuggerHistoryPanel(debugPerspectiveModel));
    return debugPanels;
}
Also used : IResultsPanel(com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.IResultsPanel) CModulesPanel(com.google.security.zynamics.binnavi.Gui.Debug.ModulesPanel.CModulesPanel) CThreadInformationPanel(com.google.security.zynamics.binnavi.Gui.Debug.ThreadInformationPanel.CThreadInformationPanel) CDebuggerHistoryPanel(com.google.security.zynamics.binnavi.Gui.Debug.History.CDebuggerHistoryPanel) CTracesPanel(com.google.security.zynamics.binnavi.Gui.Debug.EventLists.CTracesPanel) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) CCombinedMemoryPanel(com.google.security.zynamics.binnavi.Gui.Debug.CombinedMemoryPanel.CCombinedMemoryPanel) CBookmarkPanel(com.google.security.zynamics.binnavi.Gui.Debug.Bookmarks.CBookmarkPanel) CBreakpointPanel(com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.CBreakpointPanel)

Example 17 with FilledList

use of com.google.security.zynamics.zylib.types.lists.FilledList in project binnavi by google.

the class CProject method load.

@Override
public void load() throws CouldntLoadDataException, LoadCancelledException {
    synchronized (m_loadReporter) {
        if (isLoaded()) {
            return;
        }
        m_isLoading = true;
        try {
            if (!m_loadReporter.report(ProjectLoadEvents.Starting)) {
                throw new LoadCancelledException();
            }
            if (!m_loadReporter.report(ProjectLoadEvents.LoadingAddressSpaces)) {
                throw new LoadCancelledException();
            }
            final List<CAddressSpace> addressSpaces = m_provider.loadAddressSpaces(this);
            for (final CAddressSpace space : addressSpaces) {
                space.load();
            }
            if (!m_loadReporter.report(ProjectLoadEvents.LoadingCallgraphViews)) {
                throw new LoadCancelledException();
            }
            final List<ICallgraphView> userCallgraphs = m_provider.loadCallgraphViews(this);
            if (!m_loadReporter.report(ProjectLoadEvents.LoadingFlowgraphViews)) {
                throw new LoadCancelledException();
            }
            final List<IFlowgraphView> userFlowgraphs = m_provider.loadFlowgraphs(this);
            if (!m_loadReporter.report(ProjectLoadEvents.LoadingMixedgraphViews)) {
                throw new LoadCancelledException();
            }
            final List<INaviView> userMixedgraphs = m_provider.loadMixedgraphs(this);
            if (!m_loadReporter.report(ProjectLoadEvents.LoadingTraces)) {
                throw new LoadCancelledException();
            }
            final List<TraceList> traces = m_provider.loadTraces(this);
            final ArrayList<INaviView> views = new ArrayList<INaviView>(userCallgraphs);
            views.addAll(userFlowgraphs);
            views.addAll(userMixedgraphs);
            m_content = new CProjectContent(this, m_listeners, m_provider, addressSpaces, views, new FilledList<TraceList>(traces));
        } catch (CouldntLoadDataException | LoadCancelledException e) {
            m_isLoading = false;
            throw e;
        } finally {
            m_loadReporter.report(ProjectLoadEvents.Finished);
        }
        for (final IProjectListener listener : m_listeners) {
            try {
                listener.loadedProject(this);
            } catch (final Exception exception) {
                CUtilityFunctions.logException(exception);
            }
        }
        m_isLoading = false;
    }
}
Also used : FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) CouldntLoadDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException) ArrayList(java.util.ArrayList) LoadCancelledException(com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) CouldntLoadDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) LoadCancelledException(com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException) CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace)

Example 18 with FilledList

use of com.google.security.zynamics.zylib.types.lists.FilledList in project binnavi by google.

the class ProcessTest method testLifeCycle.

@Test
public void testLifeCycle() {
    final MockProcessListener listener = new MockProcessListener();
    final ProcessManager manager = new ProcessManager();
    final Process process = new Process(manager);
    process.addListener(listener);
    manager.setAttached(true);
    assertEquals("attached;", listener.events);
    process.removeListener(listener);
    manager.setTargetInformation(new com.google.security.zynamics.binnavi.debug.models.targetinformation.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)));
    manager.addThread(new TargetProcessThread(0, ThreadState.RUNNING));
    manager.addModule(new MemoryModule("Hannes", "C:\\Hannes.dll", new RelocatedAddress(new CAddress(0x100)), 0x100));
    manager.setMemoryMap(new com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap(Lists.newArrayList(new com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection(new CAddress(0), new CAddress(0x100)))));
    manager.getMemory().store(0, new byte[] { 0, 1, 2, 3 });
    process.addListener(listener);
    manager.setTargetInformation(new com.google.security.zynamics.binnavi.debug.models.targetinformation.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, process.getThreads().size());
    assertEquals(0, process.getModules().size());
    assertEquals(0, process.getMemoryMap().getSections().size());
    assertEquals(false, process.getMemory().hasData(0, 4));
    manager.setAttached(false);
    assertEquals("attached;changedTargetInformation;detached;", listener.events);
    assertEquals(0, process.getThreads().size());
    assertEquals(0, process.getModules().size());
    assertEquals(null, process.getTargetInformation());
    assertEquals(0, process.getMemoryMap().getSections().size());
    assertEquals(false, process.getMemory().hasData(0, 4));
    process.removeListener(listener);
}
Also used : TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) DebuggerException(com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerException) RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) DebuggerOptions(com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) ProcessManager(com.google.security.zynamics.binnavi.debug.models.processmanager.ProcessManager) Test(org.junit.Test)

Example 19 with FilledList

use of com.google.security.zynamics.zylib.types.lists.FilledList in project binnavi by google.

the class PostgreSQLProviderTest method testCModuleFunctionsgetViewsWithAddresses1.

@Test
public void testCModuleFunctionsgetViewsWithAddresses1() throws CouldntLoadDataException, LoadCancelledException {
    final INaviModule module = getProvider().loadModules().get(0);
    module.load();
    final IFilledList<UnrelocatedAddress> addresses = new FilledList<UnrelocatedAddress>();
    List<INaviView> views = PostgreSQLModuleFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), module, addresses, true);
    assertEquals(0, views.size());
    addresses.add(new UnrelocatedAddress(new CAddress(0x10033DCL)));
    views = PostgreSQLModuleFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), module, addresses, true);
    assertEquals(1, views.size());
    addresses.add(new UnrelocatedAddress(new CAddress(0x1003429)));
    views = PostgreSQLModuleFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), module, addresses, true);
    assertEquals(0, views.size());
    views = PostgreSQLModuleFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), module, addresses, false);
    assertEquals(2, views.size());
}
Also used : AbstractSQLProvider(com.google.security.zynamics.binnavi.Database.AbstractSQLProvider) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 20 with FilledList

use of com.google.security.zynamics.zylib.types.lists.FilledList 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());
}
Also used : AbstractSQLProvider(com.google.security.zynamics.binnavi.Database.AbstractSQLProvider) INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

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