use of com.google.security.zynamics.binnavi.disassembly.INaviFunction in project binnavi by google.
the class CCrossReferencesPanel method processRemovedNode.
/**
* Processes a removed node and updates the references list accordingly.
*
* @param node The node to remove.
*
* @return True, if the removed node was the last node with its parent function in the graph.
*/
private boolean processRemovedNode(final INaviViewNode node) {
if (node instanceof INaviCodeNode) {
final INaviCodeNode cnode = (INaviCodeNode) node;
try {
final INaviFunction targetFunction = cnode.getParentFunction();
if (m_nodeCounter.containsKey(targetFunction)) {
final int newCounter = m_nodeCounter.get(targetFunction) - 1;
if (newCounter == 0) {
m_nodeCounter.remove(targetFunction);
final Set<CCrossReference> toDelete = new HashSet<CCrossReference>();
for (final CCrossReference reference : m_crossReferences) {
if (reference.getCalledFunction() == targetFunction) {
toDelete.add(reference);
}
}
m_crossReferences.removeAll(toDelete);
return true;
} else {
m_nodeCounter.put(targetFunction, newCounter);
}
}
// else
// {
// TODO: How is this even possible?
// }
} catch (final MaybeNullException exception) {
// Code nodes that do not have a parent function can obviously not be called.
}
}
return false;
}
use of com.google.security.zynamics.binnavi.disassembly.INaviFunction in project binnavi by google.
the class CViewsTableRenderer method getTableCellRendererComponent.
@Override
public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) {
final INaviView view = this.table.getUnsortedView(row);
if (view == null) {
return new JLabel("No cross references");
}
final INaviFunction function = container.getFunction(view);
if ((column == 0) && (function != null)) {
final IDebugger debugger = container.getDebuggerProvider().getDebugger(function.getModule());
if (debugger != null) {
return new CAddressLabel(table, view, debugger, function, getBackgroundColor(this.table, isSelected, function.getType(), view.getGraphType()), null);
}
}
return new ViewLabel(value, isSelected, row, column, null);
}
use of com.google.security.zynamics.binnavi.disassembly.INaviFunction in project binnavi by google.
the class CFunctionViewsModel method getValueAt.
@Override
public final Object getValueAt(final int row, final int col) {
final List<INaviView> views = m_cachedValues == null ? getViews() : m_cachedValues;
final INaviView view = views.get(row);
final INaviFunction function = m_module.getContent().getViewContainer().getFunction(view);
Preconditions.checkNotNull(function, "IE01189: View without known function");
switch(col) {
case ADDRESS_COLUM:
return function.getAddress().toHexString();
case FUNCTIONNAME_COLUM:
return new CFunctionNameTypePair(view.getName(), function.getType());
case DESCRIPTION_COLUMN:
return view.getConfiguration().getDescription();
case MODULE_COLUMN:
return function.getOriginalModulename();
case FORWARDER_COLUMN:
return getForwarderColumnText(function);
case BASICBLOCK_COUNT_COLUMN:
return getNodeCount(view, function);
case EDGE_COUNT_COLUMN:
return getEdgeCount(view, function);
case INCOMING_CALLS_COUNT_COLUMN:
return function.getIndegree();
case OUTGOING_CALLS_COUNT_COLUMN:
return function.getOutdegree();
default:
throw new IllegalStateException("IE02245: Unknown column");
}
}
use of com.google.security.zynamics.binnavi.disassembly.INaviFunction in project binnavi by google.
the class CFunctionViewsModel method delete.
@Override
public void delete() {
m_module.removeListener(m_moduleListener);
if (m_activeDebugger != null) {
final BreakpointManager manager = m_activeDebugger.getBreakpointManager();
manager.removeListener(m_breakpointManagerListener);
}
if (m_module.isLoaded()) {
for (final IFlowgraphView view : m_module.getContent().getViewContainer().getNativeFlowgraphViews()) {
view.removeListener(m_viewListener);
}
for (final INaviFunction function : m_module.getContent().getFunctionContainer().getFunctions()) {
function.removeListener(m_viewListener);
}
}
}
use of com.google.security.zynamics.binnavi.disassembly.INaviFunction in project binnavi by google.
the class CFunctionViewsModel method getForwarderColumnText.
/**
* Calculates the content of the forwarder column for a given function.
*
* @param function The function to check.
*
* @return The text shown in the table for the forwarder column of the given function.
*/
private String getForwarderColumnText(final INaviFunction function) {
final IAddress address = function.getForwardedFunctionAddress();
if (address == null) {
return "-";
}
final int moduleId = function.getForwardedFunctionModuleId();
final INaviModule forwardedModule = m_database.getContent().getModule(moduleId);
if (forwardedModule == null) {
return "INVALID";
} else if (!forwardedModule.isLoaded()) {
return String.format("%s:%s", forwardedModule.getConfiguration().getName(), address.toHexString());
}
final INaviFunction forwardedFunction = forwardedModule.getContent().getFunctionContainer().getFunction(address);
if (forwardedFunction == null) {
return "INVALID";
} else {
return String.format("%s:%s", forwardedModule.getConfiguration().getName(), forwardedFunction.getName());
}
}
Aggregations