use of com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode in project binnavi by google.
the class PostgreSQLEdgeLoader method initializeGlobalComment.
/**
* Initializes the global comment for an edge.
*
* @param edge The edge whose global comment is initialized.
* @param globalComments The global comment to set.
*/
private static void initializeGlobalComment(final CNaviViewEdge edge, final ArrayList<IComment> globalComments, final SQLProvider provider) {
final INaviViewNode source = edge.getSource();
final INaviViewNode target = edge.getTarget();
if ((source instanceof INaviCodeNode) && (target instanceof IAddressNode)) {
CommentManager.get(provider).initializeGlobalEdgeComment(edge, globalComments);
} else if ((source instanceof INaviFunctionNode) && (target instanceof IAddressNode)) {
CommentManager.get(provider).initializeGlobalEdgeComment(edge, globalComments);
}
}
use of com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode in project binnavi by google.
the class CViewContent method updateGraphType.
/**
* Calculates the new graph type of the view from the current state of the view graph.
*/
private void updateGraphType() {
boolean hasCodeNode = false;
boolean hasFunctionNode = false;
for (final INaviViewNode node : graph.getNodes()) {
if (node instanceof INaviFunctionNode) {
hasFunctionNode = true;
if (hasCodeNode) {
setGraphType(GraphType.MIXED_GRAPH);
return;
}
} else if (node instanceof INaviCodeNode) {
hasCodeNode = true;
if (hasFunctionNode) {
setGraphType(GraphType.MIXED_GRAPH);
return;
}
}
}
if (hasCodeNode) {
setGraphType(GraphType.FLOWGRAPH);
} else if (hasFunctionNode) {
setGraphType(GraphType.CALLGRAPH);
} else {
setGraphType(GraphType.MIXED_GRAPH);
}
}
use of com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode in project binnavi by google.
the class CViewInserter method createNodes.
/**
* Clones a node of the source view and inserts it into the target view.
*
* @param target The target view where the cloned view is inserted.
* @param sourceNode The source node that is cloned and inserted into the target view.
* @param nodeMap Maps nodes of the source view to their cloned counterparts.
*/
private static void createNodes(final INaviView target, final INaviViewNode sourceNode, final Map<INaviViewNode, INaviViewNode> nodeMap) {
final INaviViewNode newNode = CNodeTypeSwitcher.switchNode(sourceNode, new INodeTypeCallback<INaviViewNode>() {
@Override
public INaviViewNode handle(final INaviCodeNode node) {
return insertCodeNode(target, node);
}
@Override
public INaviViewNode handle(final INaviFunctionNode node) {
return insertFunctionNode(target, node);
}
@Override
public INaviViewNode handle(final INaviGroupNode node) {
// Skip now, create later
return null;
}
@Override
public INaviViewNode handle(final INaviTextNode node) {
return insertTextNode(target, node);
}
});
if (newNode != null) {
newNode.setBorderColor(sourceNode.getBorderColor());
newNode.setColor(sourceNode.getColor());
newNode.setHeight(sourceNode.getHeight());
newNode.setSelected(sourceNode.isSelected());
newNode.setVisible(sourceNode.isVisible());
newNode.setWidth(sourceNode.getWidth());
newNode.setX(sourceNode.getX());
newNode.setY(sourceNode.getY());
nodeMap.put(sourceNode, newNode);
}
}
use of com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode 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;
}
use of com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode 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;
}
Aggregations