use of com.google.security.zynamics.binnavi.disassembly.types.TypeSubstitution in project binnavi by google.
the class TypeSubstitutionDialog method createOrUpdateSubstitution.
private void createOrUpdateSubstitution(final TypeSelectionPath path) throws CouldntSaveDataException {
final int offset = path.determineTotalMemberOffset();
final BaseType baseType = path.getRootType();
final int position = selectedNode.getOperandPosition();
final IAddress address = selectedNode.getInstructionAddress();
final TypeSubstitution substitution = selectedNode.getTypeSubstitution();
final List<TypeMember> memberPath = path.getMembers();
if (substitution == null) {
typeManager.createTypeSubstitution(selectedNode, baseType, memberPath, position, offset, address);
} else {
typeManager.updateTypeSubstitution(selectedNode, substitution, baseType, path.getMembers(), offset);
}
}
use of com.google.security.zynamics.binnavi.disassembly.types.TypeSubstitution in project binnavi by google.
the class BaseTypeTransferHandlerTest method testImportData_SubstitutionUpdated.
@Test
public void testImportData_SubstitutionUpdated() throws CouldntSaveDataException {
initSubstitutionStubs();
final TypeSubstitution substitution = mock(TypeSubstitution.class);
when(node.getTypeSubstitution()).thenReturn(substitution);
final BaseTypeTransferHandler handler = new BaseTypeTransferHandler(manager, wrapper);
handler.importData(null);
verify(manager).updateTypeSubstitution(node, substitution, baseType, new ArrayList<TypeMember>(), OFFSET);
}
use of com.google.security.zynamics.binnavi.disassembly.types.TypeSubstitution in project binnavi by google.
the class TypeSubstitutionsUpdater method rebuild.
/**
* Rebuilds all affected nodes for the given {@link TypeSubstitution type substitutions}.
*
* @param typeSubstitutions A set of {@link TypeSubstitution type substitutions} from a listener
* event.
*/
private void rebuild(Set<TypeSubstitution> typeSubstitutions) {
final IAddress startAddress = codeNode.getAddress();
final IAddress endAddress = codeNode.getLastInstruction().getAddress();
for (final TypeSubstitution substitution : typeSubstitutions) {
if (substitution.getAddress().toLong() >= startAddress.toLong() && substitution.getAddress().toLong() <= endAddress.toLong()) {
naviNode.getRealizer().regenerate();
naviNode.getRealizer().repaint();
return;
}
}
}
use of com.google.security.zynamics.binnavi.disassembly.types.TypeSubstitution in project binnavi by google.
the class ViewReferencesTableModel method addTypeSubstitutionToTree.
/**
* Adds a {@link TypeSubstitution type substitution} for the given {@link INaviInstruction
* instruction} to the tree.
*
* @param operandNode The {@link INaviOperandTreeNode operand node} which holds the
* {@link TypeSubstitution type substitution}.
* @param instruction The {@link INaviInstruction instruction} which holds the
* {@link INaviOperandTreeNode operand node}.
*/
private void addTypeSubstitutionToTree(final INaviOperandTreeNode operandNode, final INaviInstruction instruction) {
final TypeSubstitution typeSubstitution = operandNode.getTypeSubstitution();
final BaseTypeCategory category = typeSubstitution.getBaseType().getCategory();
if (category == BaseTypeCategory.STRUCT || category == BaseTypeCategory.ARRAY || category == BaseTypeCategory.UNION) {
addCompoundTypeSubstitutionToTree(operandNode, instruction, typeSubstitution);
} else {
addBaseType(typeSubstitution.getBaseType());
BaseTypeTreeNode currentNode = baseTypeToTreeNode.get(typeSubstitution.getBaseType());
insertNodeInto(multiIndex.putTypeSubstitution(typeSubstitution, instruction), currentNode, currentNode.getChildCount());
}
}
Aggregations