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);
}
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();
}
}
}
}
}
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);
}
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();
}
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);
}
Aggregations