Search in sources :

Example 1 with INaviModule

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

the class CTraceFilterExpression method evaluate.

@Override
public boolean evaluate(final CTraceEventWrapper element) {
    final ITraceEvent event = element.unwrap();
    final INaviModule currentModule = event.getOffset().getModule();
    String functionName = "";
    String moduleName = "";
    if (currentModule != null) {
        final INaviFunction function = currentModule.isLoaded() ? currentModule.getContent().getFunctionContainer().getFunction(event.getOffset().getAddress().getAddress()) : null;
        if (function != null) {
            functionName = function.getName();
        }
        moduleName = currentModule.getConfiguration().getName();
    }
    return String.valueOf(event.getThreadId()).contains(m_text) || event.getOffset().getAddress().getAddress().toHexString().contains(m_text) || moduleName.contains(m_text) || functionName.contains(m_text);
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) ITraceEvent(com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent)

Example 2 with INaviModule

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

the class CEventTableMenu method addOpenFunction.

/**
   * Adds a menu item to open the selected trace.
   *
   * @param parent Parent window of the menu.
   * @param traces The selected traces.
   */
private void addOpenFunction(final Window parent, final List<ITraceEvent> traces) {
    if (traces.size() == 1) {
        final ITraceEvent trace = traces.get(0);
        final INaviModule module = trace.getOffset().getModule();
        if (module.isLoaded()) {
            final INaviFunction function = module.getContent().getFunctionContainer().getFunction(trace.getOffset().getAddress().getAddress());
            if (function != null) {
                final IViewContainer container = graphModel.getViewContainer();
                final INaviView view = container.getView(function);
                if (view != null) {
                    add(new JMenuItem(CActionProxy.proxy(new COpenInLastWindowAction(parent, container, new INaviView[] { view }))));
                    addSeparator();
                }
            }
        }
    }
}
Also used : IViewContainer(com.google.security.zynamics.binnavi.disassembly.views.IViewContainer) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) COpenInLastWindowAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Views.Component.Actions.COpenInLastWindowAction) JMenuItem(javax.swing.JMenuItem) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) ITraceEvent(com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent)

Example 3 with INaviModule

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

the class CViewGraphSynchronizer method addModuleListener.

/**
   * Adds a new listener to a module if the given node requires it.
   *
   * @param node The node to check.
   */
private void addModuleListener(final INaviFunctionNode node) {
    final INaviModule module = node.getFunction().getModule();
    if (!m_cachedModuleListeners.containsKey(module)) {
        m_cachedModuleListeners.put(module, 0);
        module.addListener(m_internalModuleListener);
    }
    m_cachedModuleListeners.put(module, m_cachedModuleListeners.get(module) + 1);
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule)

Example 4 with INaviModule

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

the class CNameListGenerators method getNameList.

/**
   * Generates a name list from the names of the given modules.
   * 
   * @param modules The modules that provide the names.
   * 
   * @return The generated name list.
   */
public static String getNameList(final INaviModule[] modules) {
    int count = 0;
    final StringBuilder list = new StringBuilder();
    for (final INaviModule module : modules) {
        list.append("- ");
        list.append(module.getConfiguration().getName());
        list.append('\n');
        count++;
        if ((count == MAX_LIST_LENGTH) && (modules.length != MAX_LIST_LENGTH)) {
            list.append("\n... ");
            list.append(String.format("%d others ...", modules.length - count));
            break;
        }
    }
    return list.toString();
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule)

Example 5 with INaviModule

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

the class ProjectTest method testCreateAddressSpace.

@Test
public void testCreateAddressSpace() throws CouldntLoadDataException, CouldntSaveDataException {
    final MockProjectListener listener = new MockProjectListener();
    m_project.load();
    m_project.addListener(listener);
    final AddressSpace space = m_project.createAddressSpace("Hannes Space");
    space.load();
    final INaviModule nativeModule = new MockModule(provider);
    internalDatabase.getContent().addModule(nativeModule);
    final Module module = ModuleFactory.get(nativeModule, provider);
    module.load();
    space.addModule(module);
    assertEquals(space, m_project.getAddressSpaces().get(1));
    assertEquals("Hannes Space", m_internalProject.getContent().getAddressSpaces().get(1).getConfiguration().getName());
    assertEquals("addedAddressSpace;changedModificationDate;", listener.events);
    assertEquals(0, m_project.getFunctions().size());
    m_project.removeListener(listener);
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule) 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