Search in sources :

Example 16 with INaviModule

use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.

the class CView method save.

@Override
public void save() throws CouldntSaveDataException {
    Preconditions.checkArgument(getType() == ViewType.NonNative, "IE00314: Native views can not be saved");
    Preconditions.checkState(isLoaded(), "IE00315: View must be loaded before it can be saved");
    if (m_configuration.isStored()) {
        m_provider.save(this);
    } else {
        CView newView;
        final INaviModule naviModule = m_configuration.getModule();
        if (naviModule == null) {
            newView = m_provider.createView(m_configuration.getProject(), this, getName(), m_configuration.getDescription());
        } else {
            newView = m_provider.createView(naviModule, this, getName(), m_configuration.getDescription());
        }
        m_configuration.setId(newView.getConfiguration().getId());
    }
    final IDirectedGraph<INaviViewNode, INaviEdge> graph = m_content.getGraph();
    m_bbcount = graph.nodeCount();
    m_edgecount = graph.edgeCount();
    for (final INaviViewListener listener : m_listeners) {
        listener.savedView(this);
    }
    m_configuration.updateModificationDate();
    m_content.save();
    m_lastGraphType = m_content.getGraphType();
    // Update caches.
    NodeCache.get(m_provider).addNodes(graph.getNodes());
    EdgeCache.get(m_provider).addEdges(graph.getEdges());
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) INaviEdge(com.google.security.zynamics.binnavi.disassembly.INaviEdge)

Example 17 with INaviModule

use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.

the class BreakpointableNodeCounter method next.

@Override
public IterationMode next(final NaviNode node) {
    final INaviViewNode viewNode = node.getRawNode();
    if (viewNode instanceof INaviCodeNode) {
        final INaviCodeNode codeNode = (INaviCodeNode) viewNode;
        final INaviInstruction instruction = Iterables.getFirst(codeNode.getInstructions(), null);
        final INaviModule module = instruction.getModule();
        final BreakpointAddress address = new BreakpointAddress(module, new UnrelocatedAddress(instruction.getAddress()));
        if (EchoBreakpointCollector.isBlocked(breakpointManager, address)) {
            return IterationMode.CONTINUE;
        }
        ++breakpointAbleNodeCount;
    } else if (viewNode instanceof INaviFunctionNode) {
        final INaviFunctionNode functionNode = (INaviFunctionNode) viewNode;
        final INaviModule module = functionNode.getFunction().getModule();
        final BreakpointAddress address = new BreakpointAddress(module, new UnrelocatedAddress(functionNode.getFunction().getAddress()));
        if (EchoBreakpointCollector.isBlocked(breakpointManager, address)) {
            return IterationMode.CONTINUE;
        }
        ++breakpointAbleNodeCount;
    }
    return IterationMode.CONTINUE;
}
Also used : INaviCodeNode(com.google.security.zynamics.binnavi.disassembly.INaviCodeNode) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) INaviFunctionNode(com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction)

Example 18 with INaviModule

use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.

the class EchoBreakpointCollector method next.

@Override
public IterationMode next(final NaviNode node) {
    final INaviViewNode viewNode = node.getRawNode();
    if (viewNode instanceof INaviCodeNode) {
        final INaviCodeNode codeNode = (INaviCodeNode) viewNode;
        final INaviInstruction instruction = Iterables.getFirst(codeNode.getInstructions(), null);
        final INaviModule module = instruction.getModule();
        final BreakpointAddress address = new BreakpointAddress(module, new UnrelocatedAddress(instruction.getAddress()));
        if (isBlocked(manager, address)) {
            return IterationMode.CONTINUE;
        }
        NaviLogger.info("Adding Echo breakpoint %s to the active list", address.getAddress().getAddress().toHexString());
        // Add the echo breakpoint to the list of active echo breakpoints
        echoBreakpointAbleAddresses.add(address);
    } else if (viewNode instanceof INaviFunctionNode) {
        final INaviFunctionNode functionNode = (INaviFunctionNode) viewNode;
        final INaviModule module = functionNode.getFunction().getModule();
        final BreakpointAddress address = new BreakpointAddress(module, new UnrelocatedAddress(functionNode.getFunction().getAddress()));
        if (isBlocked(manager, address)) {
            return IterationMode.CONTINUE;
        }
        NaviLogger.info("Adding Echo breakpoint %s to the active list", address.getAddress().getAddress().toHexString());
        // Add the echo breakpoint to the list of active echo breakpoints
        echoBreakpointAbleAddresses.add(address);
    }
    return IterationMode.CONTINUE;
}
Also used : INaviCodeNode(com.google.security.zynamics.binnavi.disassembly.INaviCodeNode) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) INaviFunctionNode(com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction)

Example 19 with INaviModule

use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.

the class DebuggerTest method testRelocation5.

@Test(expected = NullPointerException.class)
public void testRelocation5() {
    final INaviModule nativeModule = new MockModule();
    final Module module = ModuleFactory.get(nativeModule);
    debugger.toFilebase(module, null);
    fail();
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) Test(org.junit.Test)

Example 20 with INaviModule

use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.

the class DebuggerTest method testRelocation3.

@Test(expected = NullPointerException.class)
public void testRelocation3() {
    final INaviModule nativeModule = new MockModule();
    final Module module = ModuleFactory.get(nativeModule);
    debugger.toImagebase(module, null);
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) Test(org.junit.Test)

Aggregations

INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)180 Test (org.junit.Test)105 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)69 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)39 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)39 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)29 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)28 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)28 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)24 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)22 ArrayList (java.util.ArrayList)19 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)18 CView (com.google.security.zynamics.binnavi.disassembly.views.CView)13 BigInteger (java.math.BigInteger)13 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)12 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)11 CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)11 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)9 CAddressSpace (com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace)9 COperandTree (com.google.security.zynamics.binnavi.disassembly.COperandTree)9