Search in sources :

Example 6 with BaseType

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;
    }
}
Also used : BaseType(com.google.security.zynamics.binnavi.disassembly.types.BaseType)

Example 7 with BaseType

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);
    }
}
Also used : TypeSubstitution(com.google.security.zynamics.binnavi.disassembly.types.TypeSubstitution) BaseType(com.google.security.zynamics.binnavi.disassembly.types.BaseType) TypeMember(com.google.security.zynamics.binnavi.disassembly.types.TypeMember) IAddress(com.google.security.zynamics.zylib.disassembly.IAddress)

Example 8 with BaseType

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);
        }
    }
}
Also used : BaseType(com.google.security.zynamics.binnavi.disassembly.types.BaseType) TypeMember(com.google.security.zynamics.binnavi.disassembly.types.TypeMember) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) MemberDialog(com.google.security.zynamics.binnavi.Gui.GraphWindows.types.MemberDialog)

Example 9 with BaseType

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());
}
Also used : BaseType(com.google.security.zynamics.binnavi.disassembly.types.BaseType) RawTypeInstance(com.google.security.zynamics.binnavi.disassembly.types.RawTypeInstance) TypeInstance(com.google.security.zynamics.binnavi.disassembly.types.TypeInstance) Section(com.google.security.zynamics.binnavi.disassembly.types.Section) Test(org.junit.Test)

Example 10 with BaseType

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());
    }
}
Also used : TypeInstanceReference(com.google.security.zynamics.binnavi.disassembly.types.TypeInstanceReference) BaseType(com.google.security.zynamics.binnavi.disassembly.types.BaseType)

Aggregations

BaseType (com.google.security.zynamics.binnavi.disassembly.types.BaseType)18 TypeMember (com.google.security.zynamics.binnavi.disassembly.types.TypeMember)6 BadLocationException (javax.swing.text.BadLocationException)3 Style (javax.swing.text.Style)3 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)2 MemberDialog (com.google.security.zynamics.binnavi.Gui.GraphWindows.types.MemberDialog)2 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)2 TreePath (javax.swing.tree.TreePath)2 Test (org.junit.Test)2 Node (y.base.Node)2 AppendMemberAction (com.google.security.zynamics.binnavi.Gui.GraphWindows.types.actions.AppendMemberAction)1 EditMemberAction (com.google.security.zynamics.binnavi.Gui.GraphWindows.types.actions.EditMemberAction)1 EditTypeAction (com.google.security.zynamics.binnavi.Gui.GraphWindows.types.actions.EditTypeAction)1 InsertMemberAction (com.google.security.zynamics.binnavi.Gui.GraphWindows.types.actions.InsertMemberAction)1 CFunction (com.google.security.zynamics.binnavi.disassembly.CFunction)1 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)1 INaviOperandTreeNode (com.google.security.zynamics.binnavi.disassembly.INaviOperandTreeNode)1 RawTypeInstance (com.google.security.zynamics.binnavi.disassembly.types.RawTypeInstance)1 Section (com.google.security.zynamics.binnavi.disassembly.types.Section)1 TypeInstance (com.google.security.zynamics.binnavi.disassembly.types.TypeInstance)1