use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.
the class CFunctionViewsModel method setValueAt.
@Override
public final void setValueAt(final Object value, final int row, final int column) {
final INaviView view = getViews().get(row);
if (column == DESCRIPTION_COLUMN) {
try {
view.getConfiguration().setDescription((String) value);
} catch (final Exception e) {
CUtilityFunctions.logException(e);
final String innerMessage = "E00188: " + "View name could not be changed";
final String innerDescription = CUtilityFunctions.createDescription(String.format("The view name of view '%s' could not be changed.", view.getName()), new String[] { "There was a problem with the database connection." }, new String[] { "The view was not updated and the new view name is lost." });
NaviErrorDialog.show(null, innerMessage, innerDescription, e);
}
} else if (column == FUNCTIONNAME_COLUM) {
try {
view.getConfiguration().setName((String) value);
} catch (final Exception e) {
CUtilityFunctions.logException(e);
final String innerMessage = "E00189: " + "View description could not be changed";
final String innerDescription = CUtilityFunctions.createDescription(String.format("The view description of view '%s' could not be changed.", view.getName()), new String[] { "There was a problem with the database connection." }, new String[] { "The view was not updated and the new view description is lost." });
NaviErrorDialog.show(null, innerMessage, innerDescription, e);
}
}
}
use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.
the class CNativeCallgraphsViewsModel method setValueAt.
@Override
public void setValueAt(final Object value, final int row, final int column) {
if (column == DESCRIPTION_COLUMN) {
final INaviView view = m_module.getContent().getViewContainer().getNativeCallgraphView();
try {
view.getConfiguration().setDescription((String) value);
fireTableDataChanged();
} catch (final CouldntSaveDataException e) {
// TODO: Improve this
CUtilityFunctions.logException(e);
}
}
}
use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.
the class CDataflowViewCreator method create.
/**
* Creates a new dataflow view.
*
* @param container The container in which the dataflow view is created.
* @param view The normal view that provides the control-flow information.
*
* @return The created dataflow view.
*
* @throws InternalTranslationException Thrown if the input view could not be translated to REIL.
*/
public static INaviView create(final IViewContainer container, final INaviView view) throws InternalTranslationException {
Preconditions.checkNotNull(container, "IE00411: Module argument can not be null");
Preconditions.checkNotNull(view, "IE00414: View argument can not be null");
final Map<IAddress, INaviInstruction> instructions = new HashMap<IAddress, INaviInstruction>();
for (final CCodeNode codeNode : view.getBasicBlocks()) {
for (final INaviInstruction instruction : codeNode.getInstructions()) {
instructions.put(instruction.getAddress(), instruction);
}
}
final ReilFunction function = view.getContent().getReilCode();
final OperandGraph operandGraph = OperandGraph.create(function.getGraph());
final INaviView dfView = container.createView(String.format("Data flow view of '%s'", view.getName()), "");
final Map<OperandGraphNode, INaviCodeNode> nodeMap = new HashMap<OperandGraphNode, INaviCodeNode>();
final Map<INaviInstruction, CCodeNode> instructionMap = new HashMap<INaviInstruction, CCodeNode>();
for (final OperandGraphNode operandGraphNode : operandGraph) {
final ReilInstruction reilInstruction = operandGraphNode.getInstruction();
final INaviInstruction instruction = instructions.get(ReilHelpers.toNativeAddress(reilInstruction.getAddress()));
if (instructionMap.containsKey(instruction)) {
nodeMap.put(operandGraphNode, instructionMap.get(instruction));
continue;
}
final CCodeNode codeNode = dfView.getContent().createCodeNode(null, Lists.newArrayList(instruction));
codeNode.setColor(ConfigManager.instance().getColorSettings().getBasicBlocksColor());
nodeMap.put(operandGraphNode, codeNode);
instructionMap.put(instruction, codeNode);
}
for (final OperandGraphEdge edge : operandGraph.getEdges()) {
final INaviCodeNode source = nodeMap.get(edge.getSource());
final INaviCodeNode target = nodeMap.get(edge.getTarget());
if (source.equals(target)) {
continue;
}
dfView.getContent().createEdge(source, target, EdgeType.JUMP_UNCONDITIONAL);
}
return dfView;
}
use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.
the class TypeInstanceContainerBackend method loadTypeInstanceReference.
/**
* Load a single type instance reference from the database.
*
* @param typeInstanceId the id of the {@link TypeInstanceReference reference}.
* @param address The address of the {@link INaviInstruction instruction} where the
* {@link TypeInstanceReference reference} is associated.
* @param position The {@link OperandTree operand tree} position in the {@link INaviInstruction
* instruction} the {@link TypeInstanceReference reference} is associated to.
* @param expressionId The {@link OperandTreeNode operand tree node} id within the
* {@link OperandTree operand tree}.
*
* @return The {@link TypeInstanceReference} loaded from the database.
* @throws CouldntLoadDataException
*/
public TypeInstanceReference loadTypeInstanceReference(final Integer typeInstanceId, final BigInteger address, final Integer position, final Integer expressionId) throws CouldntLoadDataException {
Preconditions.checkNotNull(typeInstanceId, "Error: typeInstanceId argument can not be null");
Preconditions.checkNotNull(address, "Error: address argument can not be null");
Preconditions.checkNotNull(position, "Error: position argument can not be null");
Preconditions.checkNotNull(expressionId, "Error: expressionId argument can not be null");
final RawTypeInstanceReference rawReference = provider.loadTypeInstanceReference(module, typeInstanceId, address, position, expressionId);
final TypeInstance typeInstance = instancesById.get(rawReference.getTypeInstanceId());
final INaviView view = module.getContent().getViewContainer().getView(rawReference.getViewId());
final TypeInstanceReference reference = new TypeInstanceReference(new CAddress(address), position, Optional.<INaviOperandTreeNode>absent(), typeInstance, view);
referenceLookup.put(new InstanceReferenceLookup(new CAddress(address), position, expressionId), reference);
return reference;
}
use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.
the class CViewContainer method delete.
private void delete(final INaviView view) {
final INaviView currentStoredView = m_customViews.get(m_customViews.indexOf(view));
m_customViews.remove(currentStoredView);
viewIdView.remove(view.getConfiguration().getId());
currentStoredView.removeListener(m_viewListener);
for (final IModuleListener listener : m_listeners) {
try {
listener.deletedView(m_module, currentStoredView);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
}
Aggregations