use of com.google.security.zynamics.binnavi.disassembly.types.BaseTypeHelpers.WalkResult in project binnavi by google.
the class ViewReferencesTableModel method addCompoundTypeSubstitutionToTree.
/**
* Adds a {@link TypeSubstitution type substitution} for the given {@link INaviInstruction
* instruction} to the tree. The types passed to this function need to be compund types.
*
* @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}.
* @param typeSubstitution A {@link TypeSubstitution type substitution} which is a compound type.
* Must be of a compound {@link BaseTypeCategory base type category}.
*/
private void addCompoundTypeSubstitutionToTree(final INaviOperandTreeNode operandNode, final INaviInstruction instruction, final TypeSubstitution typeSubstitution) {
final long completeOffset = operandNode.hasAddendSibling() ? (operandNode.determineAddendValue() * 8 + typeSubstitution.getOffset()) : typeSubstitution.getOffset();
final WalkResult walkResult = BaseTypeHelpers.findMember(typeSubstitution.getBaseType(), completeOffset);
if (!walkResult.isValid()) {
return;
}
addBaseType(typeSubstitution.getBaseType());
DefaultMutableTreeNode currentNode = baseTypeToTreeNode.get(typeSubstitution.getBaseType());
for (TypeMember typeMember : walkResult.getPath()) {
TypeMemberTreeNode nextNode = checkTypeMemberNodeExists(typeMember, currentNode);
if (nextNode == null) {
nextNode = new TypeMemberTreeNode(typeMember);
typeMemberToTreeNode.put(typeMember, nextNode);
insertNodeInto(nextNode, currentNode, currentNode.getChildCount());
}
currentNode = nextNode;
}
insertNodeInto(multiIndex.putTypeSubstitution(typeSubstitution, instruction), currentNode, currentNode.getChildCount());
}
use of com.google.security.zynamics.binnavi.disassembly.types.BaseTypeHelpers.WalkResult in project binnavi by google.
the class BaseTypeHelpersTests method testFindMemberStructType4.
@Test
public void testFindMemberStructType4() {
final WalkResult result = BaseTypeHelpers.findMember(typeSystem.simpleStruct, 96);
assertNotNull(result);
assertTrue(result.isValid());
assertEquals(typeSystem.ssArrayMember, result.getMember());
assertEquals(Lists.newArrayList(typeSystem.ssArrayMember), result.getPath());
assertEquals("SimpleStruct.ss_array_member[1]", result.getPathString());
}
use of com.google.security.zynamics.binnavi.disassembly.types.BaseTypeHelpers.WalkResult in project binnavi by google.
the class BaseTypeHelpersTests method testFindMemberNestedStructType3.
@Test
public void testFindMemberNestedStructType3() {
final WalkResult result = BaseTypeHelpers.findMember(typeSystem.doubleNestedStruct, 64);
assertNotNull(result);
assertTrue(result.isValid());
assertEquals(typeSystem.ssUintMember, result.getMember());
assertEquals("DoubleNestedStruct.dns_nested_struct_member.ns_simple_struct_member.ss_uint_member", result.getPathString());
}
use of com.google.security.zynamics.binnavi.disassembly.types.BaseTypeHelpers.WalkResult in project binnavi by google.
the class BaseTypeHelpersTests method testFindMemberArguments2.
@Test
public void testFindMemberArguments2() {
WalkResult result = BaseTypeHelpers.findMember(typeSystem.uintType, -1);
assertEquals("", result.getPathString());
assertFalse(result.isValid());
assertNull(result.getPath());
assertNull(result.getMember());
}
use of com.google.security.zynamics.binnavi.disassembly.types.BaseTypeHelpers.WalkResult in project binnavi by google.
the class BaseTypeHelpersTests method testFindMemberStructType3.
@Test
public void testFindMemberStructType3() {
final WalkResult result = BaseTypeHelpers.findMember(typeSystem.simpleStruct, 64);
assertNotNull(result);
assertTrue(result.isValid());
assertEquals(typeSystem.ssArrayMember, result.getMember());
assertEquals(Lists.newArrayList(typeSystem.ssArrayMember), result.getPath());
assertEquals("SimpleStruct.ss_array_member[0]", result.getPathString());
}
Aggregations