use of com.google.security.zynamics.binnavi.disassembly.types.BaseType in project binnavi by google.
the class PointerTypePanel method createOrUpdatePointer.
private void createOrUpdatePointer() throws CouldntSaveDataException {
// Note: the pointer level of an existing type can not actually change since pointer types
// with lower levels already exist and higher levels are simply created.
final int pointerLevel = getPointerLevel();
BaseType childBaseType = getSelectedType();
final int existingLevel = childBaseType.getPointerLevel();
for (int i = existingLevel + 1; i <= pointerLevel; ++i) {
final BaseType parentType = typeManager.createPointerType(childBaseType);
childBaseType = parentType;
}
}
use of com.google.security.zynamics.binnavi.disassembly.types.BaseType 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.BaseType in project binnavi by google.
the class AppendMemberAction method actionPerformed.
@Override
public void actionPerformed(final ActionEvent e) {
final MemberDialog dlg = MemberDialog.createBuildNewMemberDialog(owner, typeManager);
GuiHelper.centerChildToParent(owner, dlg, true);
dlg.setVisible(true);
if (!dlg.wasCanceled()) {
final String name = dlg.getMemberName();
final BaseType baseType = dlg.getBaseType();
try {
final TypeMember member = typeManager.appendMember(selectedType, baseType, name);
if (member == null) {
CMessageBox.showInformation(owner, "Unable to append member since that would create a recursive type definition.");
}
} catch (final CouldntSaveDataException exception) {
CUtilityFunctions.logException(exception);
}
}
}
use of com.google.security.zynamics.binnavi.disassembly.types.BaseType in project binnavi by google.
the class PostgreSQLTypeInstanceFunctionsTests method createTypeInstance6.
@Test
public void createTypeInstance6() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
final String typeInstanceName = " TYPE INSTANCE NAME ";
module.load();
final Section section = module.getContent().getSections().getSections().get(0);
final BaseType type = module.getTypeManager().getTypes().get(0);
final int typeInstanceId = provider.createTypeInstance(module.getConfiguration().getId(), typeInstanceName, null, type.getId(), section.getId(), 0);
module.close();
module.load();
final TypeInstance typeInstance = module.getContent().getTypeInstanceContainer().getTypeInstanceById(typeInstanceId);
Assert.assertEquals(typeInstanceId, typeInstance.getId());
Assert.assertEquals(typeInstanceName, typeInstance.getName());
Assert.assertEquals(module, typeInstance.getModule());
Assert.assertEquals(section.getId(), typeInstance.getSection().getId());
}
use of com.google.security.zynamics.binnavi.disassembly.types.BaseType in project binnavi by google.
the class ViewReferencesTableModel method addTypeInstancesToTree.
/**
* Adds the list of {@link TypeInstanceReference type instance references} for the given
* {@link INaviInstruction instruction} to the tree.
*
* @param typeInstanceReferences A List of {@link TypeInstanceReference type instance references}.
* @param instruction The {@link INaviInstruction instruction} to which the list of references
* belongs.
*/
private void addTypeInstancesToTree(final List<TypeInstanceReference> typeInstanceReferences, final INaviInstruction instruction) {
for (TypeInstanceReference typeInstanceReference : typeInstanceReferences) {
final BaseType baseType = typeInstanceReference.getTypeInstance().getBaseType();
addBaseType(baseType);
insertNodeInto(multiIndex.putTypeReference(typeInstanceReference, instruction), baseTypeToTreeNode.get(baseType), baseTypeToTreeNode.get(baseType).getChildCount());
}
}
Aggregations