mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
Merge remote-tracking branch 'origin/GP-5408_ghizard_Rework_hierarchical_class_layout_and_vxt_understanding--SQUASHED'
This commit is contained in:
commit
802586c6fb
13 changed files with 2171 additions and 1372 deletions
|
@ -1,35 +0,0 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package ghidra.app.util;
|
||||
|
||||
import ghidra.program.model.data.PointerDataType;
|
||||
|
||||
public class ClassUtils {
|
||||
|
||||
// Prototype values for now. Need to come to agreement on what these should be
|
||||
public static final String VBPTR = "{vbptr}";
|
||||
public static final String VFPTR = "{vfptr}";
|
||||
|
||||
/**
|
||||
* Type used for {@link #VBPTR} and {@link #VFPTR} fields in a class
|
||||
*/
|
||||
public static final PointerDataType VXPTR_TYPE = new PointerDataType();
|
||||
|
||||
private ClassUtils() {
|
||||
// no instances
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package ghidra.app.util.pdb.classtype;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import ghidra.app.util.bin.format.pdb2.pdbreader.PdbException;
|
||||
|
||||
/**
|
||||
* Virtual Base Table without a program
|
||||
*/
|
||||
public class PlaceholderVirtualBaseTable extends VirtualBaseTable {
|
||||
|
||||
private int entrySize;
|
||||
|
||||
private int maxIndexSeen = -1;
|
||||
private Map<Integer, VBTableEntry> entriesByIndex = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param owner the class that owns the table
|
||||
* @param parentage the parentage of the base class(es) of the table
|
||||
* @param entrySize the size of the index field for each table entry as it would be in memory
|
||||
*/
|
||||
public PlaceholderVirtualBaseTable(ClassID owner, List<ClassID> parentage, int entrySize) {
|
||||
super(owner, parentage);
|
||||
if (entrySize != 4 && entrySize != 8) {
|
||||
throw new IllegalArgumentException("Invalid size (" + entrySize + "): must be 4 or 8.");
|
||||
}
|
||||
this.entrySize = entrySize;
|
||||
}
|
||||
|
||||
/*
|
||||
* For the next method below... once we determine the number of virtual bases (virtual and
|
||||
* indirect virtual) for each class (from PDB or other), we can determine the number of
|
||||
* entries in each VBT. For a VBT for the main class, the number is equal... if for some
|
||||
* parentage, then the number can reflect the number of the parent.
|
||||
* TODO: can VBT overlay/extend one from parent????????????????????????????????????????????
|
||||
*/
|
||||
/**
|
||||
* TBD: need to determine table size to do this. Might want to place a symbol (diff method?).
|
||||
*/
|
||||
void createTableDataType(int numEntries) {
|
||||
|
||||
}
|
||||
|
||||
int getMaxIndex() {
|
||||
return maxIndexSeen;
|
||||
}
|
||||
|
||||
public void setBaseClassOffsetAndId(int index, Long offset, ClassID baseId) {
|
||||
VBTableEntry entry = entriesByIndex.get(index);
|
||||
if (entry == null) {
|
||||
entry = new VirtualBaseTableEntry(offset, baseId);
|
||||
entriesByIndex.put(index, entry);
|
||||
}
|
||||
else {
|
||||
entry.setOffset(offset);
|
||||
entry.setClassId(baseId);
|
||||
}
|
||||
maxIndexSeen = Integer.max(maxIndexSeen, index);
|
||||
}
|
||||
|
||||
public void setBaseClassId(int index, ClassID baseId) {
|
||||
VBTableEntry entry = entriesByIndex.get(index);
|
||||
if (entry == null) {
|
||||
entry = new VirtualBaseTableEntry(baseId);
|
||||
entriesByIndex.put(index, entry);
|
||||
}
|
||||
else {
|
||||
entry.setClassId(baseId);
|
||||
}
|
||||
maxIndexSeen = Integer.max(maxIndexSeen, index);
|
||||
}
|
||||
|
||||
public void setBaseOffset(int index, Long offset) {
|
||||
VBTableEntry entry = entriesByIndex.get(index);
|
||||
if (entry == null) {
|
||||
entry = new VirtualBaseTableEntry(offset);
|
||||
entriesByIndex.put(index, entry);
|
||||
}
|
||||
else {
|
||||
entry.setOffset(offset);
|
||||
}
|
||||
maxIndexSeen = Integer.max(maxIndexSeen, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getBaseOffset(int index) throws PdbException {
|
||||
VBTableEntry entry = entriesByIndex.get(index);
|
||||
Long offset = (entry == null) ? null : entry.getOffset();
|
||||
maxIndexSeen = Integer.max(maxIndexSeen, index);
|
||||
return offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassID getBaseClassId(int index) {
|
||||
VBTableEntry entry = entriesByIndex.get(index);
|
||||
ClassID id = (entry == null) ? null : entry.getClassId();
|
||||
maxIndexSeen = Integer.max(maxIndexSeen, index);
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VBTableEntry getBase(int index) throws PdbException {
|
||||
VBTableEntry entry = entriesByIndex.get(index);
|
||||
if (entry != null) {
|
||||
maxIndexSeen = Integer.max(maxIndexSeen, index);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
}
|
|
@ -36,8 +36,6 @@ public class ProgramVirtualBaseTable extends VirtualBaseTable {
|
|||
private Boolean createdFromMemory = null;
|
||||
private Boolean createdFromCompiled = null;
|
||||
|
||||
private int numEntries = 0;
|
||||
|
||||
private int maxIndexSeen = -1;
|
||||
private Map<Integer, VBTableEntry> entriesByIndex = new HashMap<>();
|
||||
|
||||
|
@ -47,7 +45,7 @@ public class ProgramVirtualBaseTable extends VirtualBaseTable {
|
|||
* @param parentage the parentage of the base class(es) of the table
|
||||
* @param program the program
|
||||
* @param address the address of the table
|
||||
* @param entrySize the size for each table entry
|
||||
* @param entrySize the size of the index field for each table entry in memory
|
||||
* @param ctm the class type manager
|
||||
* @param mangledName the mangled name of the table
|
||||
*/
|
||||
|
@ -76,7 +74,7 @@ public class ProgramVirtualBaseTable extends VirtualBaseTable {
|
|||
* Returns the mangled name
|
||||
* @return the mangled name
|
||||
*/
|
||||
String getMangledName() {
|
||||
public String getMangledName() {
|
||||
return mangledName;
|
||||
}
|
||||
|
||||
|
@ -136,16 +134,16 @@ public class ProgramVirtualBaseTable extends VirtualBaseTable {
|
|||
return entry;
|
||||
}
|
||||
|
||||
// Need to decide if we want to allow this to overwrite existing entry.
|
||||
public void setBaseClassId(int index, ClassID baseId) throws PdbException {
|
||||
public void setBaseClassId(int index, ClassID baseId) {
|
||||
VBTableEntry entry = entriesByIndex.get(index);
|
||||
if (entry != null) {
|
||||
throw new PdbException(
|
||||
"Entry already exists in Virtual Base Table for index: " + index);
|
||||
if (entry == null) {
|
||||
entry = new VirtualBaseTableEntry(baseId);
|
||||
entriesByIndex.put(index, entry);
|
||||
}
|
||||
entry = new VirtualBaseTableEntry(baseId);
|
||||
entriesByIndex.put(index, entry);
|
||||
maxIndexSeen = Integer.max(maxIndexSeen, index); // do we want this here with a "set" method?
|
||||
else {
|
||||
entry.setClassId(baseId);
|
||||
}
|
||||
maxIndexSeen = Integer.max(maxIndexSeen, index);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ProgramVirtualFunctionTable extends VirtualFunctionTable {
|
|||
* Returns the mangled name
|
||||
* @return the mangled name
|
||||
*/
|
||||
String getMangledName() {
|
||||
public String getMangledName() {
|
||||
return mangledName;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public interface VBTableEntry {
|
|||
* Sets the entry offset value
|
||||
* @param offset the offset
|
||||
*/
|
||||
public void setOffset(long offset);
|
||||
public void setOffset(Long offset);
|
||||
|
||||
/**
|
||||
* Gets the entry offset value
|
||||
|
|
|
@ -24,8 +24,18 @@ import ghidra.app.util.bin.format.pdb2.pdbreader.PdbException;
|
|||
* Abstract class for virtual base tables
|
||||
*/
|
||||
public abstract class VirtualBaseTable implements VBTable {
|
||||
|
||||
protected ClassID owner; // Does this belong here in this abstract class?
|
||||
protected List<ClassID> parentage; // Not sure this belongs in this abstract class
|
||||
/**
|
||||
* The number of entries in the table
|
||||
*/
|
||||
protected Integer numEntries;
|
||||
/**
|
||||
* This is the offset within the class where we expect to find the pointer that can point to
|
||||
* this table
|
||||
*/
|
||||
protected Long ptrOffsetInClass;
|
||||
|
||||
/**
|
||||
* Virtual Base Table for a base (parent) class within an owner class. The owner and parent
|
||||
|
@ -83,6 +93,22 @@ public abstract class VirtualBaseTable implements VBTable {
|
|||
return parentage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of entries in the table
|
||||
* @return the number of entries; {@code null} if not initialized
|
||||
*/
|
||||
public Integer getNumEntries() {
|
||||
return numEntries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the offset within the class for the pointer that can point to this table
|
||||
* @return the offset; {@code null} if not initialized
|
||||
*/
|
||||
public Long getPtrOffsetInClass() {
|
||||
return ptrOffsetInClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the owner of the table
|
||||
* @param ownerArg the class to set as owner
|
||||
|
@ -99,6 +125,22 @@ public abstract class VirtualBaseTable implements VBTable {
|
|||
this.parentage = parentage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of entries for the table
|
||||
* @param numEntriesArg the number of entries
|
||||
*/
|
||||
public void setNumEntries(Integer numEntriesArg) {
|
||||
numEntries = numEntriesArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the offset within the class for the pointer that can point to this table
|
||||
* @param offset the offset
|
||||
*/
|
||||
public void setPtrOffsetInClass(Long offset) {
|
||||
ptrOffsetInClass = offset;
|
||||
}
|
||||
|
||||
void emit(StringBuilder builder) {
|
||||
builder.append("VBT for the following parentage within: " + owner);
|
||||
builder.append("\n");
|
||||
|
|
|
@ -24,21 +24,21 @@ public class VirtualBaseTableEntry implements VBTableEntry {
|
|||
|
||||
// Re-evaluate which constructors and setters we need
|
||||
|
||||
VirtualBaseTableEntry(long offset) {
|
||||
public VirtualBaseTableEntry(Long offset) {
|
||||
this(offset, null);
|
||||
}
|
||||
|
||||
VirtualBaseTableEntry(ClassID baseId) {
|
||||
public VirtualBaseTableEntry(ClassID baseId) {
|
||||
this(null, baseId);
|
||||
}
|
||||
|
||||
VirtualBaseTableEntry(Long offset, ClassID baseId) {
|
||||
public VirtualBaseTableEntry(Long offset, ClassID baseId) {
|
||||
this.offset = offset;
|
||||
this.baseId = baseId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOffset(long offset) {
|
||||
public void setOffset(Long offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,15 @@ public abstract class VirtualFunctionTable implements VFTable {
|
|||
|
||||
protected ClassID owner;
|
||||
protected List<ClassID> parentage;
|
||||
/**
|
||||
* The number of entries in the table
|
||||
*/
|
||||
protected int numEntries;
|
||||
/**
|
||||
* This is the offset within the class where we expect to find the pointer that can point to
|
||||
* this table
|
||||
*/
|
||||
protected int ptrOffsetInClass;
|
||||
|
||||
/**
|
||||
* Virtual Function Table for a base (parent) class within an owner class. The owner and parent
|
||||
|
@ -37,6 +46,7 @@ public abstract class VirtualFunctionTable implements VFTable {
|
|||
VirtualFunctionTable(ClassID owner, List<ClassID> parentage) {
|
||||
this.owner = owner;
|
||||
this.parentage = new ArrayList<>(parentage);
|
||||
numEntries = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,6 +81,22 @@ public abstract class VirtualFunctionTable implements VFTable {
|
|||
return parentage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of entries in the table
|
||||
* @return the number of entries
|
||||
*/
|
||||
public int getNumEntries() {
|
||||
return numEntries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the offset within the class for the pointer that can point to this table
|
||||
* @return the offset
|
||||
*/
|
||||
public int getPtrOffsetInClass() {
|
||||
return ptrOffsetInClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the owner of the table
|
||||
* @param ownerArg the class to set as owner
|
||||
|
@ -87,6 +113,22 @@ public abstract class VirtualFunctionTable implements VFTable {
|
|||
this.parentage = parentage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of entries for the table
|
||||
* @param numEntriesArg the number of entries
|
||||
*/
|
||||
public void setNumEntries(int numEntriesArg) {
|
||||
numEntries = numEntriesArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the offset within the class for the pointer that can point to this table
|
||||
* @param offset the offset
|
||||
*/
|
||||
public void setPtrOffsetInClass(int offset) {
|
||||
ptrOffsetInClass = offset;
|
||||
}
|
||||
|
||||
void emit(StringBuilder builder) {
|
||||
builder.append("VBT for the following classes within: " + owner);
|
||||
builder.append("\n");
|
||||
|
|
|
@ -137,6 +137,7 @@ public class CompositeTypeApplier extends AbstractComplexTypeApplier {
|
|||
}
|
||||
else {
|
||||
applyCpp(combo, type, lists);
|
||||
applicator.markFilledInForBase(type.getRecordNumber());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -182,6 +183,15 @@ public class CompositeTypeApplier extends AbstractComplexTypeApplier {
|
|||
}
|
||||
List<DefaultPdbUniversalMember> myMembers = new ArrayList<>();
|
||||
addClassTypeBaseClasses(composite, classType, lists.bases(), type);
|
||||
// Note: I've seen the situation where there is no vftptr for a class where I expected one.
|
||||
// Situation is where a parent has a vftptr with a vtshape with one entry. The child
|
||||
// class defines an additional virtual method, and there is an actual table in memory with
|
||||
// with the appropriate mangled label for this class that has two entries, but the list
|
||||
// here does not have the vftptr, and I believe it was due to the fact that new new method
|
||||
// was never called in the code. Thus... do not count on getting a vtshape in this
|
||||
// situation. Note that a record of a an appropriate two-entry vtshape was found right
|
||||
// before the class definition, but no pointer to it was created or referred to in the
|
||||
// field list.
|
||||
addVftPtrs(composite, classType, lists.vftPtrs(), type, myMembers);
|
||||
addMembers(composite, classType, lists.nonstaticMembers(), type, myMembers);
|
||||
|
||||
|
@ -262,20 +272,31 @@ public class CompositeTypeApplier extends AbstractComplexTypeApplier {
|
|||
|
||||
private void applyDirectBaseClass(AbstractBaseClassMsType base, CppCompositeType myClassType,
|
||||
Access defaultAccess) throws PdbException {
|
||||
CppCompositeType underlyingClassType =
|
||||
getUnderlyingClassType(base.getBaseClassRecordNumber());
|
||||
RecordNumber recordNumber = base.getBaseClassRecordNumber();
|
||||
DataType dt = applicator.getDataType(recordNumber);
|
||||
if (!(dt instanceof Composite comp)) {
|
||||
Msg.warn(this, "Composite not found for base class: " + dt);
|
||||
return;
|
||||
}
|
||||
CppCompositeType underlyingClassType = getUnderlyingClassType(recordNumber);
|
||||
if (underlyingClassType == null) {
|
||||
return;
|
||||
}
|
||||
ClassFieldMsAttributes atts = base.getAttributes();
|
||||
int offset = applicator.bigIntegerToInt(base.getOffset());
|
||||
myClassType.addDirectBaseClass(underlyingClassType,
|
||||
myClassType.addDirectBaseClass(comp, underlyingClassType,
|
||||
ClassFieldAttributes.convert(atts, defaultAccess), offset);
|
||||
}
|
||||
|
||||
private void applyDirectVirtualBaseClass(AbstractVirtualBaseClassMsType base,
|
||||
CppCompositeType myClassType, Access defaultAccess) throws PdbException {
|
||||
CppCompositeType underlyingCt = getUnderlyingClassType(base.getBaseClassRecordNumber());
|
||||
RecordNumber recordNumber = base.getBaseClassRecordNumber();
|
||||
DataType dt = applicator.getDataType(recordNumber);
|
||||
if (!(dt instanceof Composite comp)) {
|
||||
Msg.warn(this, "Composite not found for base class: " + dt);
|
||||
return;
|
||||
}
|
||||
CppCompositeType underlyingCt = getUnderlyingClassType(recordNumber);
|
||||
if (underlyingCt == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -284,14 +305,20 @@ public class CompositeTypeApplier extends AbstractComplexTypeApplier {
|
|||
ClassFieldMsAttributes atts = base.getAttributes();
|
||||
int basePointerOffset = applicator.bigIntegerToInt(base.getBasePointerOffset());
|
||||
int offsetFromVbt = applicator.bigIntegerToInt(base.getBaseOffsetFromVbt());
|
||||
myClassType.addDirectVirtualBaseClass(underlyingCt,
|
||||
myClassType.addDirectVirtualBaseClass(comp, underlyingCt,
|
||||
ClassFieldAttributes.convert(atts, defaultAccess), basePointerOffset, vbtptr,
|
||||
offsetFromVbt);
|
||||
}
|
||||
|
||||
private void applyIndirectVirtualBaseClass(AbstractIndirectVirtualBaseClassMsType base,
|
||||
CppCompositeType myClassType, Access defaultAccess) throws PdbException {
|
||||
CppCompositeType underlyingCt = getUnderlyingClassType(base.getBaseClassRecordNumber());
|
||||
RecordNumber recordNumber = base.getBaseClassRecordNumber();
|
||||
DataType dt = applicator.getDataType(recordNumber);
|
||||
if (!(dt instanceof Composite comp)) {
|
||||
Msg.warn(this, "Composite not found for base class: " + dt);
|
||||
return;
|
||||
}
|
||||
CppCompositeType underlyingCt = getUnderlyingClassType(recordNumber);
|
||||
if (underlyingCt == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -300,7 +327,7 @@ public class CompositeTypeApplier extends AbstractComplexTypeApplier {
|
|||
ClassFieldMsAttributes atts = base.getAttributes();
|
||||
int basePointerOffset = applicator.bigIntegerToInt(base.getBasePointerOffset());
|
||||
int offsetFromVbt = applicator.bigIntegerToInt(base.getBaseOffsetFromVbt());
|
||||
myClassType.addIndirectVirtualBaseClass(underlyingCt,
|
||||
myClassType.addIndirectVirtualBaseClass(comp, underlyingCt,
|
||||
ClassFieldAttributes.convert(atts, defaultAccess), basePointerOffset, vbtptr,
|
||||
offsetFromVbt);
|
||||
}
|
||||
|
@ -390,7 +417,7 @@ public class CompositeTypeApplier extends AbstractComplexTypeApplier {
|
|||
applicator.checkCancelled();
|
||||
if (base instanceof AbstractBaseClassMsType bc) {
|
||||
RecordNumber recordNumber = bc.getBaseClassRecordNumber();
|
||||
DataType dt = applicator.getDataTypeOrSchedule(recordNumber);
|
||||
DataType dt = applicator.getBaseClassDataTypeOrSchedule(recordNumber);
|
||||
if (dt == null) {
|
||||
done = false;
|
||||
}
|
||||
|
@ -402,7 +429,7 @@ public class CompositeTypeApplier extends AbstractComplexTypeApplier {
|
|||
done = false;
|
||||
}
|
||||
recordNumber = vbc.getBaseClassRecordNumber();
|
||||
dt = applicator.getDataTypeOrSchedule(recordNumber);
|
||||
dt = applicator.getBaseClassDataTypeOrSchedule(recordNumber);
|
||||
if (dt == null) {
|
||||
done = false;
|
||||
}
|
||||
|
@ -414,7 +441,7 @@ public class CompositeTypeApplier extends AbstractComplexTypeApplier {
|
|||
done = false;
|
||||
}
|
||||
recordNumber = ivbc.getBaseClassRecordNumber();
|
||||
dt = applicator.getDataTypeOrSchedule(recordNumber);
|
||||
dt = applicator.getBaseClassDataTypeOrSchedule(recordNumber);
|
||||
if (dt == null) {
|
||||
done = false;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -220,6 +220,7 @@ public class DefaultPdbApplicator implements PdbApplicator {
|
|||
// a second PDB analyzer to do the "deferred" processing of functions. Then a mandatory
|
||||
// second PDB analyzer would, at a minimum, remove the map from the analysis state.
|
||||
private Map<RecordNumber, DataType> dataTypeByMsTypeNum;
|
||||
private Set<RecordNumber> filledInStructure;
|
||||
private Map<RecordNumber, CppCompositeType> classTypeByMsTypeNum;
|
||||
private ComplexTypeMapper complexTypeMapper;
|
||||
/**
|
||||
|
@ -267,7 +268,7 @@ public class DefaultPdbApplicator implements PdbApplicator {
|
|||
|
||||
Objects.requireNonNull(pdb, "pdb cannot be null");
|
||||
this.pdb = pdb;
|
||||
this.monitor = (monitor != null) ? monitor : TaskMonitor.DUMMY;
|
||||
this.monitor = TaskMonitor.dummyIfNull(monitor);
|
||||
|
||||
// FIXME: should not support use of DataTypeManager-only since it will not have the correct
|
||||
// data organization if it corresponds to a data type archive. Need to evaluate archive
|
||||
|
@ -592,6 +593,10 @@ public class DefaultPdbApplicator implements PdbApplicator {
|
|||
|
||||
multiphaseResolver = new MultiphaseDataTypeResolver(this);
|
||||
|
||||
// Following should not need to be part of analysis state because types are filled in
|
||||
// during first round of processing
|
||||
filledInStructure = new HashSet<>();
|
||||
|
||||
classTypeManager = new ClassTypeManager(dataTypeManager);
|
||||
|
||||
pdbPrimitiveTypeApplicator = new PdbPrimitiveTypeApplicator(dataTypeManager);
|
||||
|
@ -1054,6 +1059,17 @@ public class DefaultPdbApplicator implements PdbApplicator {
|
|||
dataTypeByMsTypeNum.put(mappedNumber, dataType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores whether the structure referenced by the record number has been filled in such that
|
||||
* it can be used as a base class
|
||||
* @param recordNumber record number of type record
|
||||
* @param dataType the data type to store
|
||||
*/
|
||||
void markFilledInForBase(RecordNumber recordNumber) {
|
||||
RecordNumber mappedNumber = getMappedRecordNumber(recordNumber);
|
||||
filledInStructure.add(mappedNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Ghidra data type associated with the PDB data type.
|
||||
* This method is intended to be used by appliers that work on this specific type, not by
|
||||
|
@ -1097,6 +1113,26 @@ public class DefaultPdbApplicator implements PdbApplicator {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Ghidra data type associated with the PDB record number for the base class
|
||||
* of another class. In this case, we require the base class structure to be completed
|
||||
* in order for the child class to be constructed
|
||||
* This method is intended to be used by appliers that work on this specific type, not by
|
||||
* appliers that need the data type
|
||||
* @param recordNumber the PDB type record number
|
||||
* @return the Ghidra DB data type of the base class
|
||||
*/
|
||||
DataType getBaseClassDataTypeOrSchedule(RecordNumber recordNumber) {
|
||||
RecordNumber mappedNumber = getMappedRecordNumber(recordNumber);
|
||||
boolean filledIn = filledInStructure.contains(mappedNumber);
|
||||
DataType dt = dataTypeByMsTypeNum.get(mappedNumber);
|
||||
if (dt != null && filledIn) {
|
||||
return dt;
|
||||
}
|
||||
multiphaseResolver.scheduleTodo(mappedNumber);
|
||||
return null;
|
||||
}
|
||||
|
||||
//==============================================================================================
|
||||
/**
|
||||
* Stores the Ghidra class type associated with the PDB data type.
|
||||
|
|
|
@ -1064,7 +1064,7 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
static CppCompositeType createD_struct32(VxtManager vxtManager, CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType D_struct = createStruct32("D", 8);
|
||||
D_struct.addDirectBaseClass(C_struct, 0);
|
||||
D_struct.addDirectBaseClass(C_struct.getComposite(), C_struct, 0);
|
||||
D_struct.addMember("d1", u4, false, 4);
|
||||
return D_struct;
|
||||
}
|
||||
|
@ -1078,7 +1078,7 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
static CppCompositeType createD_struct64(VxtManager vxtManager, CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType D_struct = createStruct64("D", 8);
|
||||
D_struct.addDirectBaseClass(C_struct, 0);
|
||||
D_struct.addDirectBaseClass(C_struct.getComposite(), C_struct, 0);
|
||||
D_struct.addMember("d1", u4, false, 4);
|
||||
return D_struct;
|
||||
}
|
||||
|
@ -1279,8 +1279,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType E_struct) {
|
||||
try {
|
||||
CppCompositeType F_struct = createStruct32("F", 12);
|
||||
F_struct.addDirectBaseClass(C_struct, 0);
|
||||
F_struct.addDirectBaseClass(E_struct, 4);
|
||||
F_struct.addDirectBaseClass(C_struct.getComposite(), C_struct, 0);
|
||||
F_struct.addDirectBaseClass(E_struct.getComposite(), E_struct, 4);
|
||||
F_struct.addMember("f1", u4, false, 8);
|
||||
return F_struct;
|
||||
}
|
||||
|
@ -1295,8 +1295,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType E_struct) {
|
||||
try {
|
||||
CppCompositeType F_struct = createStruct64("F", 12);
|
||||
F_struct.addDirectBaseClass(C_struct, 0);
|
||||
F_struct.addDirectBaseClass(E_struct, 4);
|
||||
F_struct.addDirectBaseClass(C_struct.getComposite(), C_struct, 0);
|
||||
F_struct.addDirectBaseClass(E_struct.getComposite(), E_struct, 4);
|
||||
F_struct.addMember("f1", u4, false, 8);
|
||||
return F_struct;
|
||||
}
|
||||
|
@ -1427,7 +1427,7 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
if (C_struct == null) {
|
||||
C_struct = createC_struct32(vxtManager);
|
||||
}
|
||||
G_struct.addVirtualSyntacticBaseClass(C_struct);
|
||||
G_struct.addVirtualSyntacticBaseClass(C_struct.getComposite(), C_struct);
|
||||
G_struct.addMember("g1", u4, false, 0);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -1447,7 +1447,7 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
static CppCompositeType createG_struct32(VxtManager vxtManager, CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType G_struct = createStruct32("G", 12);
|
||||
G_struct.addDirectVirtualBaseClass(C_struct, 0, vbtptr32, 1);
|
||||
G_struct.addDirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32, 1);
|
||||
G_struct.addMember("g1", u4, false, 4);
|
||||
return G_struct;
|
||||
}
|
||||
|
@ -1461,7 +1461,7 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
static CppCompositeType createG_struct64(VxtManager vxtManager, CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType G_struct = createStruct64("G", 20);
|
||||
G_struct.addDirectVirtualBaseClass(C_struct, 0, vbtptr64, 1);
|
||||
G_struct.addDirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr64, 1);
|
||||
G_struct.addMember("g1", u4, false, 8);
|
||||
return G_struct;
|
||||
}
|
||||
|
@ -1601,7 +1601,7 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
if (C_struct == null) {
|
||||
C_struct = createC_struct32(vxtManager);
|
||||
}
|
||||
H_struct.addVirtualSyntacticBaseClass(C_struct);
|
||||
H_struct.addVirtualSyntacticBaseClass(C_struct.getComposite(), C_struct);
|
||||
H_struct.addMember("h1", u4, false, 0);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -1621,7 +1621,7 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
static CppCompositeType createH_struct32(VxtManager vxtManager, CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType H_struct = createStruct32("H", 12);
|
||||
H_struct.addDirectVirtualBaseClass(C_struct, 0, vbtptr32, 1);
|
||||
H_struct.addDirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32, 1);
|
||||
H_struct.addMember("h1", u4, false, 4);
|
||||
return H_struct;
|
||||
}
|
||||
|
@ -1635,7 +1635,7 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
static CppCompositeType createH_struct64(VxtManager vxtManager, CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType H_struct = createStruct64("H", 20);
|
||||
H_struct.addDirectVirtualBaseClass(C_struct, 0, vbtptr64, 1);
|
||||
H_struct.addDirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr64, 1);
|
||||
H_struct.addMember("h1", u4, false, 8);
|
||||
return H_struct;
|
||||
}
|
||||
|
@ -1778,8 +1778,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
if (E_struct == null) {
|
||||
E_struct = createE_struct32(vxtManager);
|
||||
}
|
||||
G1_struct.addVirtualSyntacticBaseClass(C_struct);
|
||||
G1_struct.addVirtualSyntacticBaseClass(E_struct);
|
||||
G1_struct.addVirtualSyntacticBaseClass(C_struct.getComposite(), C_struct);
|
||||
G1_struct.addVirtualSyntacticBaseClass(E_struct.getComposite(), E_struct);
|
||||
G1_struct.addMember("g11", u4, false, 0);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -1800,8 +1800,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType E_struct) {
|
||||
try {
|
||||
CppCompositeType G1_struct = createStruct32("G1", 16);
|
||||
G1_struct.addDirectVirtualBaseClass(C_struct, 0, vbtptr32, 1);
|
||||
G1_struct.addDirectVirtualBaseClass(E_struct, 0, vbtptr32, 2);
|
||||
G1_struct.addDirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32, 1);
|
||||
G1_struct.addDirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr32, 2);
|
||||
G1_struct.addMember("g11", u4, false, 4);
|
||||
return G1_struct;
|
||||
}
|
||||
|
@ -1816,8 +1816,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType E_struct) {
|
||||
try {
|
||||
CppCompositeType G1_struct = createStruct64("G1", 24);
|
||||
G1_struct.addDirectVirtualBaseClass(C_struct, 0, vbtptr64, 1);
|
||||
G1_struct.addDirectVirtualBaseClass(E_struct, 0, vbtptr64, 2);
|
||||
G1_struct.addDirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr64, 1);
|
||||
G1_struct.addDirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr64, 2);
|
||||
G1_struct.addMember("g11", u4, false, 8);
|
||||
return G1_struct;
|
||||
}
|
||||
|
@ -1984,8 +1984,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
if (C_struct == null) {
|
||||
C_struct = createC_struct32(vxtManager);
|
||||
}
|
||||
H1_struct.addVirtualSyntacticBaseClass(E_struct);
|
||||
H1_struct.addVirtualSyntacticBaseClass(C_struct);
|
||||
H1_struct.addVirtualSyntacticBaseClass(E_struct.getComposite(), E_struct);
|
||||
H1_struct.addVirtualSyntacticBaseClass(C_struct.getComposite(), C_struct);
|
||||
H1_struct.addMember("h11", u4, false, 0);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -2006,8 +2006,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType H1_struct = createStruct32("H1", 16);
|
||||
H1_struct.addDirectVirtualBaseClass(E_struct, 0, vbtptr32, 1);
|
||||
H1_struct.addDirectVirtualBaseClass(C_struct, 0, vbtptr32, 2);
|
||||
H1_struct.addDirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr32, 1);
|
||||
H1_struct.addDirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32, 2);
|
||||
H1_struct.addMember("h11", u4, false, 4);
|
||||
return H1_struct;
|
||||
}
|
||||
|
@ -2022,8 +2022,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType H1_struct = createStruct64("H1", 24);
|
||||
H1_struct.addDirectVirtualBaseClass(E_struct, 0, vbtptr64, 1);
|
||||
H1_struct.addDirectVirtualBaseClass(C_struct, 0, vbtptr64, 2);
|
||||
H1_struct.addDirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr64, 1);
|
||||
H1_struct.addDirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr64, 2);
|
||||
H1_struct.addMember("h11", u4, false, 8);
|
||||
return H1_struct;
|
||||
}
|
||||
|
@ -2187,7 +2187,7 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
if (CC1_struct == null) {
|
||||
CC1_struct = createCC1_struct32(vxtManager);
|
||||
}
|
||||
GG1_struct.addVirtualSyntacticBaseClass(CC1_struct);
|
||||
GG1_struct.addVirtualSyntacticBaseClass(CC1_struct.getComposite(), CC1_struct);
|
||||
GG1_struct.addMember("gg11", u4, false, 0);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -2207,7 +2207,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
static CppCompositeType createGG1_struct32(VxtManager vxtManager, CppCompositeType CC1_struct) {
|
||||
try {
|
||||
CppCompositeType GG1_struct = createStruct32("GG1", 12);
|
||||
GG1_struct.addDirectVirtualBaseClass(CC1_struct, 0, vbtptr32, 1);
|
||||
GG1_struct.addDirectVirtualBaseClass(CC1_struct.getComposite(), CC1_struct, 0, vbtptr32,
|
||||
1);
|
||||
GG1_struct.addMember("gg11", u4, false, 4);
|
||||
return GG1_struct;
|
||||
}
|
||||
|
@ -2221,7 +2222,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
static CppCompositeType createGG1_struct64(VxtManager vxtManager, CppCompositeType CC1_struct) {
|
||||
try {
|
||||
CppCompositeType GG1_struct = createStruct64("GG1", 20);
|
||||
GG1_struct.addDirectVirtualBaseClass(CC1_struct, 0, vbtptr64, 1);
|
||||
GG1_struct.addDirectVirtualBaseClass(CC1_struct.getComposite(), CC1_struct, 0, vbtptr64,
|
||||
1);
|
||||
GG1_struct.addMember("gg11", u4, false, 8);
|
||||
return GG1_struct;
|
||||
}
|
||||
|
@ -2361,7 +2363,7 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
if (CC2_struct == null) {
|
||||
CC2_struct = createCC2_struct32(vxtManager);
|
||||
}
|
||||
GG2_struct.addVirtualSyntacticBaseClass(CC2_struct);
|
||||
GG2_struct.addVirtualSyntacticBaseClass(CC2_struct.getComposite(), CC2_struct);
|
||||
GG2_struct.addMember("gg21", u4, false, 0);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -2381,7 +2383,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
static CppCompositeType createGG2_struct32(VxtManager vxtManager, CppCompositeType CC2_struct) {
|
||||
try {
|
||||
CppCompositeType GG2_struct = createStruct32("GG2", 12);
|
||||
GG2_struct.addDirectVirtualBaseClass(CC2_struct, 0, vbtptr32, 1);
|
||||
GG2_struct.addDirectVirtualBaseClass(CC2_struct.getComposite(), CC2_struct, 0, vbtptr32,
|
||||
1);
|
||||
GG2_struct.addMember("gg21", u4, false, 4);
|
||||
return GG2_struct;
|
||||
}
|
||||
|
@ -2395,7 +2398,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
static CppCompositeType createGG2_struct64(VxtManager vxtManager, CppCompositeType CC2_struct) {
|
||||
try {
|
||||
CppCompositeType GG2_struct = createStruct64("GG2", 20);
|
||||
GG2_struct.addDirectVirtualBaseClass(CC2_struct, 0, vbtptr64, 1);
|
||||
GG2_struct.addDirectVirtualBaseClass(CC2_struct.getComposite(), CC2_struct, 0, vbtptr64,
|
||||
1);
|
||||
GG2_struct.addMember("gg21", u4, false, 8);
|
||||
return GG2_struct;
|
||||
}
|
||||
|
@ -2535,7 +2539,7 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
if (CC2_struct == null) {
|
||||
CC2_struct = createCC2_struct32(vxtManager);
|
||||
}
|
||||
GG3_struct.addVirtualSyntacticBaseClass(CC2_struct);
|
||||
GG3_struct.addVirtualSyntacticBaseClass(CC2_struct.getComposite(), CC2_struct);
|
||||
GG3_struct.addMember("gg31", u4, false, 0);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -2555,7 +2559,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
static CppCompositeType createGG3_struct32(VxtManager vxtManager, CppCompositeType CC2_struct) {
|
||||
try {
|
||||
CppCompositeType GG3_struct = createStruct32("GG3", 12);
|
||||
GG3_struct.addDirectVirtualBaseClass(CC2_struct, 0, vbtptr32, 1);
|
||||
GG3_struct.addDirectVirtualBaseClass(CC2_struct.getComposite(), CC2_struct, 0, vbtptr32,
|
||||
1);
|
||||
GG3_struct.addMember("gg31", u4, false, 4);
|
||||
return GG3_struct;
|
||||
}
|
||||
|
@ -2569,7 +2574,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
static CppCompositeType createGG3_struct64(VxtManager vxtManager, CppCompositeType CC2_struct) {
|
||||
try {
|
||||
CppCompositeType GG3_struct = createStruct64("GG3", 20);
|
||||
GG3_struct.addDirectVirtualBaseClass(CC2_struct, 0, vbtptr64, 1);
|
||||
GG3_struct.addDirectVirtualBaseClass(CC2_struct.getComposite(), CC2_struct, 0, vbtptr64,
|
||||
1);
|
||||
GG3_struct.addMember("gg31", u4, false, 8);
|
||||
return GG3_struct;
|
||||
}
|
||||
|
@ -2707,7 +2713,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
static CppCompositeType createGG4_struct32(VxtManager vxtManager, CppCompositeType CC3_struct) {
|
||||
try {
|
||||
CppCompositeType GG4_struct = createStruct32("GG4", 8);
|
||||
GG4_struct.addDirectVirtualBaseClass(CC3_struct, 0, vbtptr32, 1);
|
||||
GG4_struct.addDirectVirtualBaseClass(CC3_struct.getComposite(), CC3_struct, 0, vbtptr32,
|
||||
1);
|
||||
GG4_struct.addMember("gg41", u4, false, 4);
|
||||
return GG4_struct;
|
||||
}
|
||||
|
@ -2721,7 +2728,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
static CppCompositeType createGG4_struct64(VxtManager vxtManager, CppCompositeType CC3_struct) {
|
||||
try {
|
||||
CppCompositeType GG4_struct = createStruct64("GG4", 16);
|
||||
GG4_struct.addDirectVirtualBaseClass(CC3_struct, 0, vbtptr64, 1);
|
||||
GG4_struct.addDirectVirtualBaseClass(CC3_struct.getComposite(), CC3_struct, 0, vbtptr64,
|
||||
1);
|
||||
GG4_struct.addMember("gg41", u4, false, 8);
|
||||
return GG4_struct;
|
||||
}
|
||||
|
@ -2860,8 +2868,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
if (H_struct == null) {
|
||||
H_struct = createH_struct32(vxtManager, C_struct);
|
||||
}
|
||||
I_struct.addDirectSyntacticBaseClass(G_struct);
|
||||
I_struct.addDirectSyntacticBaseClass(H_struct);
|
||||
I_struct.addDirectSyntacticBaseClass(G_struct.getComposite(), G_struct);
|
||||
I_struct.addDirectSyntacticBaseClass(H_struct.getComposite(), H_struct);
|
||||
I_struct.addMember("i1", u4, false, 0);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -2882,9 +2890,9 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType H_struct, CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType I_struct = createStruct32("I", 24);
|
||||
I_struct.addDirectBaseClass(G_struct, 0);
|
||||
I_struct.addDirectBaseClass(H_struct, 8);
|
||||
I_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr32, 1);
|
||||
I_struct.addDirectBaseClass(G_struct.getComposite(), G_struct, 0);
|
||||
I_struct.addDirectBaseClass(H_struct.getComposite(), H_struct, 8);
|
||||
I_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32, 1);
|
||||
I_struct.addMember("i1", u4, false, 16);
|
||||
return I_struct;
|
||||
}
|
||||
|
@ -2899,9 +2907,9 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType H_struct, CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType I_struct = createStruct64("I", 44);
|
||||
I_struct.addDirectBaseClass(G_struct, 0);
|
||||
I_struct.addDirectBaseClass(H_struct, 16);
|
||||
I_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr64, 1);
|
||||
I_struct.addDirectBaseClass(G_struct.getComposite(), G_struct, 0);
|
||||
I_struct.addDirectBaseClass(H_struct.getComposite(), H_struct, 16);
|
||||
I_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr64, 1);
|
||||
I_struct.addMember("i1", u4, false, 32);
|
||||
return I_struct;
|
||||
}
|
||||
|
@ -3097,10 +3105,12 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType H_struct, CppCompositeType C_struct, CppCompositeType E_struct) {
|
||||
try {
|
||||
CppCompositeType I1_struct = createStruct32("I1", 28);
|
||||
I1_struct.addDirectBaseClass(G1_struct, 0);
|
||||
I1_struct.addDirectBaseClass(H_struct, 8);
|
||||
I1_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr32, 1);
|
||||
I1_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr32, 2);
|
||||
I1_struct.addDirectBaseClass(G1_struct.getComposite(), G1_struct, 0);
|
||||
I1_struct.addDirectBaseClass(H_struct.getComposite(), H_struct, 8);
|
||||
I1_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32,
|
||||
1);
|
||||
I1_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr32,
|
||||
2);
|
||||
I1_struct.addMember("i11", u4, false, 16);
|
||||
return I1_struct;
|
||||
}
|
||||
|
@ -3115,10 +3125,12 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType H_struct, CppCompositeType C_struct, CppCompositeType E_struct) {
|
||||
try {
|
||||
CppCompositeType I1_struct = createStruct64("I1", 48);
|
||||
I1_struct.addDirectBaseClass(G1_struct, 0);
|
||||
I1_struct.addDirectBaseClass(H_struct, 16);
|
||||
I1_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr64, 1);
|
||||
I1_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr64, 2);
|
||||
I1_struct.addDirectBaseClass(G1_struct.getComposite(), G1_struct, 0);
|
||||
I1_struct.addDirectBaseClass(H_struct.getComposite(), H_struct, 16);
|
||||
I1_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr64,
|
||||
1);
|
||||
I1_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr64,
|
||||
2);
|
||||
I1_struct.addMember("i11", u4, false, 32);
|
||||
return I1_struct;
|
||||
}
|
||||
|
@ -3337,10 +3349,12 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType H1_struct, CppCompositeType C_struct, CppCompositeType E_struct) {
|
||||
try {
|
||||
CppCompositeType I2_struct = createStruct32("I2", 28);
|
||||
I2_struct.addDirectBaseClass(G_struct, 0);
|
||||
I2_struct.addDirectBaseClass(H1_struct, 8);
|
||||
I2_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr32, 1);
|
||||
I2_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr32, 2);
|
||||
I2_struct.addDirectBaseClass(G_struct.getComposite(), G_struct, 0);
|
||||
I2_struct.addDirectBaseClass(H1_struct.getComposite(), H1_struct, 8);
|
||||
I2_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32,
|
||||
1);
|
||||
I2_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr32,
|
||||
2);
|
||||
I2_struct.addMember("i21", u4, false, 16);
|
||||
return I2_struct;
|
||||
}
|
||||
|
@ -3355,10 +3369,12 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType H1_struct, CppCompositeType C_struct, CppCompositeType E_struct) {
|
||||
try {
|
||||
CppCompositeType I2_struct = createStruct64("I2", 48);
|
||||
I2_struct.addDirectBaseClass(G_struct, 0);
|
||||
I2_struct.addDirectBaseClass(H1_struct, 16);
|
||||
I2_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr64, 1);
|
||||
I2_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr64, 2);
|
||||
I2_struct.addDirectBaseClass(G_struct.getComposite(), G_struct, 0);
|
||||
I2_struct.addDirectBaseClass(H1_struct.getComposite(), H1_struct, 16);
|
||||
I2_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr64,
|
||||
1);
|
||||
I2_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr64,
|
||||
2);
|
||||
I2_struct.addMember("i21", u4, false, 32);
|
||||
return I2_struct;
|
||||
}
|
||||
|
@ -3589,8 +3605,8 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
if (H1_struct == null) {
|
||||
H1_struct = createH1_struct32(vxtManager, E_struct, C_struct);
|
||||
}
|
||||
I3_struct.addDirectSyntacticBaseClass(G1_struct);
|
||||
I3_struct.addDirectSyntacticBaseClass(H1_struct);
|
||||
I3_struct.addDirectSyntacticBaseClass(G1_struct.getComposite(), G1_struct);
|
||||
I3_struct.addDirectSyntacticBaseClass(H1_struct.getComposite(), H1_struct);
|
||||
I3_struct.addMember("i31", u4, false, 0);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -3612,10 +3628,12 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType H1_struct, CppCompositeType E_struct, CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType I3_struct = createStruct32("I3", 28);
|
||||
I3_struct.addDirectBaseClass(G1_struct, 0);
|
||||
I3_struct.addDirectBaseClass(H1_struct, 8);
|
||||
I3_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr32, 1);
|
||||
I3_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr32, 2);
|
||||
I3_struct.addDirectBaseClass(G1_struct.getComposite(), G1_struct, 0);
|
||||
I3_struct.addDirectBaseClass(H1_struct.getComposite(), H1_struct, 8);
|
||||
I3_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32,
|
||||
1);
|
||||
I3_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr32,
|
||||
2);
|
||||
I3_struct.addMember("i31", u4, false, 16);
|
||||
return I3_struct;
|
||||
}
|
||||
|
@ -3630,10 +3648,12 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType H1_struct, CppCompositeType E_struct, CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType I3_struct = createStruct64("I3", 48);
|
||||
I3_struct.addDirectBaseClass(G1_struct, 0);
|
||||
I3_struct.addDirectBaseClass(H1_struct, 16);
|
||||
I3_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr64, 1);
|
||||
I3_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr64, 2);
|
||||
I3_struct.addDirectBaseClass(G1_struct.getComposite(), G1_struct, 0);
|
||||
I3_struct.addDirectBaseClass(H1_struct.getComposite(), H1_struct, 16);
|
||||
I3_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr64,
|
||||
1);
|
||||
I3_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr64,
|
||||
2);
|
||||
I3_struct.addMember("i31", u4, false, 32);
|
||||
return I3_struct;
|
||||
}
|
||||
|
@ -3852,9 +3872,9 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType E_struct, CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType I4_struct = createStruct32("I4", 20);
|
||||
I4_struct.addDirectBaseClass(G1_struct, 0);
|
||||
I4_struct.addDirectVirtualBaseClass(E_struct, 0, vbtptr32, 2);
|
||||
I4_struct.addDirectVirtualBaseClass(C_struct, 0, vbtptr32, 1);
|
||||
I4_struct.addDirectBaseClass(G1_struct.getComposite(), G1_struct, 0);
|
||||
I4_struct.addDirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr32, 2);
|
||||
I4_struct.addDirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32, 1);
|
||||
I4_struct.addMember("i41", u4, false, 8);
|
||||
return I4_struct;
|
||||
}
|
||||
|
@ -3869,9 +3889,9 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType E_struct, CppCompositeType C_struct) {
|
||||
CppCompositeType I4_struct = createStruct64("I4", 32);
|
||||
try {
|
||||
I4_struct.addDirectBaseClass(G1_struct, 0);
|
||||
I4_struct.addDirectVirtualBaseClass(E_struct, 0, vbtptr64, 2);
|
||||
I4_struct.addDirectVirtualBaseClass(C_struct, 0, vbtptr64, 1);
|
||||
I4_struct.addDirectBaseClass(G1_struct.getComposite(), G1_struct, 0);
|
||||
I4_struct.addDirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr64, 2);
|
||||
I4_struct.addDirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr64, 1);
|
||||
I4_struct.addMember("i41", u4, false, 16);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -4054,9 +4074,11 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType E_struct, CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType I5_struct = createStruct32("I5", 20);
|
||||
I5_struct.addDirectBaseClass(G1_struct, 0);
|
||||
I5_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr32, 2); // check this and I4...TODO
|
||||
I5_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr32, 1);
|
||||
I5_struct.addDirectBaseClass(G1_struct.getComposite(), G1_struct, 0);
|
||||
I5_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr32,
|
||||
2); // check this and I4...TODO
|
||||
I5_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32,
|
||||
1);
|
||||
I5_struct.addMember("i51", u4, false, 8);
|
||||
return I5_struct;
|
||||
}
|
||||
|
@ -4071,9 +4093,11 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType E_struct, CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType I5_struct = createStruct64("I5", 32);
|
||||
I5_struct.addDirectBaseClass(G1_struct, 0);
|
||||
I5_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr64, 2); // check this and I4...TODO
|
||||
I5_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr64, 1);
|
||||
I5_struct.addDirectBaseClass(G1_struct.getComposite(), G1_struct, 0);
|
||||
I5_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr64,
|
||||
2); // check this and I4...TODO
|
||||
I5_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr64,
|
||||
1);
|
||||
I5_struct.addMember("i51", u4, false, 16);
|
||||
return I5_struct;
|
||||
}
|
||||
|
@ -4358,10 +4382,12 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType I2_struct, CppCompositeType E_struct, CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType J1_struct = createStruct32("J1", 52);
|
||||
J1_struct.addDirectBaseClass(I1_struct, 0);
|
||||
J1_struct.addDirectBaseClass(I2_struct, 20);
|
||||
J1_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr32, 1);
|
||||
J1_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr32, 2);
|
||||
J1_struct.addDirectBaseClass(I1_struct.getComposite(), I1_struct, 0);
|
||||
J1_struct.addDirectBaseClass(I2_struct.getComposite(), I2_struct, 20);
|
||||
J1_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32,
|
||||
1);
|
||||
J1_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr32,
|
||||
2);
|
||||
J1_struct.addMember("j11", u4, false, 40);
|
||||
return J1_struct;
|
||||
}
|
||||
|
@ -4376,10 +4402,12 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType I2_struct, CppCompositeType E_struct, CppCompositeType C_struct) {
|
||||
try {
|
||||
CppCompositeType J1_struct = createStruct64("J1", 96);
|
||||
J1_struct.addDirectBaseClass(I1_struct, 0);
|
||||
J1_struct.addDirectBaseClass(I2_struct, 40);
|
||||
J1_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr64, 1);
|
||||
J1_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr64, 2);
|
||||
J1_struct.addDirectBaseClass(I1_struct.getComposite(), I1_struct, 0);
|
||||
J1_struct.addDirectBaseClass(I2_struct.getComposite(), I2_struct, 40);
|
||||
J1_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr64,
|
||||
1);
|
||||
J1_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr64,
|
||||
2);
|
||||
J1_struct.addMember("j11", u4, false, 80);
|
||||
return J1_struct;
|
||||
}
|
||||
|
@ -4711,10 +4739,12 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType I1_struct, CppCompositeType C_struct, CppCompositeType E_struct) {
|
||||
try {
|
||||
CppCompositeType J2_struct = createStruct32("J2", 52);
|
||||
J2_struct.addDirectBaseClass(I2_struct, 0);
|
||||
J2_struct.addDirectBaseClass(I1_struct, 20);
|
||||
J2_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr32, 1);
|
||||
J2_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr32, 2);
|
||||
J2_struct.addDirectBaseClass(I2_struct.getComposite(), I2_struct, 0);
|
||||
J2_struct.addDirectBaseClass(I1_struct.getComposite(), I1_struct, 20);
|
||||
J2_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32,
|
||||
1);
|
||||
J2_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr32,
|
||||
2);
|
||||
J2_struct.addMember("j21", u4, false, 40);
|
||||
return J2_struct;
|
||||
}
|
||||
|
@ -4729,10 +4759,12 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType I1_struct, CppCompositeType C_struct, CppCompositeType E_struct) {
|
||||
try {
|
||||
CppCompositeType J2_struct = createStruct64("J2", 96);
|
||||
J2_struct.addDirectBaseClass(I2_struct, 0);
|
||||
J2_struct.addDirectBaseClass(I1_struct, 40);
|
||||
J2_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr64, 1);
|
||||
J2_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr64, 2);
|
||||
J2_struct.addDirectBaseClass(I2_struct.getComposite(), I2_struct, 0);
|
||||
J2_struct.addDirectBaseClass(I1_struct.getComposite(), I1_struct, 40);
|
||||
J2_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr64,
|
||||
1);
|
||||
J2_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr64,
|
||||
2);
|
||||
J2_struct.addMember("j21", u4, false, 80);
|
||||
return J2_struct;
|
||||
}
|
||||
|
@ -5066,11 +5098,13 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType E_struct) {
|
||||
try {
|
||||
CppCompositeType J3_struct = createStruct32("J3", 60);
|
||||
J3_struct.addDirectBaseClass(I2_struct, 0);
|
||||
J3_struct.addDirectBaseClass(I1_struct, 20);
|
||||
J3_struct.addDirectBaseClass(A_struct, 40);
|
||||
J3_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr32, 1);
|
||||
J3_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr32, 2);
|
||||
J3_struct.addDirectBaseClass(I2_struct.getComposite(), I2_struct, 0);
|
||||
J3_struct.addDirectBaseClass(I1_struct.getComposite(), I1_struct, 20);
|
||||
J3_struct.addDirectBaseClass(A_struct.getComposite(), A_struct, 40);
|
||||
J3_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32,
|
||||
1);
|
||||
J3_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr32,
|
||||
2);
|
||||
J3_struct.addMember("j31", u4, false, 48);
|
||||
return J3_struct;
|
||||
}
|
||||
|
@ -5086,11 +5120,13 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType E_struct) {
|
||||
try {
|
||||
CppCompositeType J3_struct = createStruct64("J3", 104);
|
||||
J3_struct.addDirectBaseClass(I2_struct, 0);
|
||||
J3_struct.addDirectBaseClass(I1_struct, 40);
|
||||
J3_struct.addDirectBaseClass(A_struct, 80);
|
||||
J3_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr64, 1);
|
||||
J3_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr64, 2);
|
||||
J3_struct.addDirectBaseClass(I2_struct.getComposite(), I2_struct, 0);
|
||||
J3_struct.addDirectBaseClass(I1_struct.getComposite(), I1_struct, 40);
|
||||
J3_struct.addDirectBaseClass(A_struct.getComposite(), A_struct, 80);
|
||||
J3_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr64,
|
||||
1);
|
||||
J3_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr64,
|
||||
2);
|
||||
J3_struct.addMember("j31", u4, false, 88);
|
||||
return J3_struct;
|
||||
}
|
||||
|
@ -5455,16 +5491,22 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType E_struct, CppCompositeType CC1_struct, CppCompositeType CC2_struct) {
|
||||
try {
|
||||
CppCompositeType J4_struct = createStruct32("J4", 92);
|
||||
J4_struct.addDirectBaseClass(I3_struct, 0);
|
||||
J4_struct.addDirectBaseClass(GG1_struct, 20);
|
||||
J4_struct.addDirectBaseClass(I_struct, 28);
|
||||
J4_struct.addDirectBaseClass(A_struct, 48);
|
||||
J4_struct.addDirectVirtualBaseClass(GG2_struct, 0, vbtptr32, 5);
|
||||
J4_struct.addDirectVirtualBaseClass(GG3_struct, 0, vbtptr32, 6);
|
||||
J4_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr32, 1);
|
||||
J4_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr32, 2);
|
||||
J4_struct.addIndirectVirtualBaseClass(CC1_struct, 0, vbtptr32, 3);
|
||||
J4_struct.addIndirectVirtualBaseClass(CC2_struct, 0, vbtptr32, 4);
|
||||
J4_struct.addDirectBaseClass(I3_struct.getComposite(), I3_struct, 0);
|
||||
J4_struct.addDirectBaseClass(GG1_struct.getComposite(), GG1_struct, 20);
|
||||
J4_struct.addDirectBaseClass(I_struct.getComposite(), I_struct, 28);
|
||||
J4_struct.addDirectBaseClass(A_struct.getComposite(), A_struct, 48);
|
||||
J4_struct.addDirectVirtualBaseClass(GG2_struct.getComposite(), GG2_struct, 0, vbtptr32,
|
||||
5);
|
||||
J4_struct.addDirectVirtualBaseClass(GG3_struct.getComposite(), GG3_struct, 0, vbtptr32,
|
||||
6);
|
||||
J4_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32,
|
||||
1);
|
||||
J4_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr32,
|
||||
2);
|
||||
J4_struct.addIndirectVirtualBaseClass(CC1_struct.getComposite(), CC1_struct, 0,
|
||||
vbtptr32, 3);
|
||||
J4_struct.addIndirectVirtualBaseClass(CC2_struct.getComposite(), CC2_struct, 0,
|
||||
vbtptr32, 4);
|
||||
J4_struct.addMember("j41", u4, false, 56);
|
||||
return J4_struct;
|
||||
}
|
||||
|
@ -5481,16 +5523,22 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType E_struct, CppCompositeType CC1_struct, CppCompositeType CC2_struct) {
|
||||
try {
|
||||
CppCompositeType J4_struct = createStruct64("J4", 160);
|
||||
J4_struct.addDirectBaseClass(I3_struct, 0);
|
||||
J4_struct.addDirectBaseClass(GG1_struct, 40);
|
||||
J4_struct.addDirectBaseClass(I_struct, 56);
|
||||
J4_struct.addDirectBaseClass(A_struct, 96);
|
||||
J4_struct.addDirectVirtualBaseClass(GG2_struct, 0, vbtptr64, 5);
|
||||
J4_struct.addDirectVirtualBaseClass(GG3_struct, 0, vbtptr64, 6);
|
||||
J4_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr64, 1);
|
||||
J4_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr64, 2);
|
||||
J4_struct.addIndirectVirtualBaseClass(CC1_struct, 0, vbtptr64, 3);
|
||||
J4_struct.addIndirectVirtualBaseClass(CC2_struct, 0, vbtptr64, 4);
|
||||
J4_struct.addDirectBaseClass(I3_struct.getComposite(), I3_struct, 0);
|
||||
J4_struct.addDirectBaseClass(GG1_struct.getComposite(), GG1_struct, 40);
|
||||
J4_struct.addDirectBaseClass(I_struct.getComposite(), I_struct, 56);
|
||||
J4_struct.addDirectBaseClass(A_struct.getComposite(), A_struct, 96);
|
||||
J4_struct.addDirectVirtualBaseClass(GG2_struct.getComposite(), GG2_struct, 0, vbtptr64,
|
||||
5);
|
||||
J4_struct.addDirectVirtualBaseClass(GG3_struct.getComposite(), GG3_struct, 0, vbtptr64,
|
||||
6);
|
||||
J4_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr64,
|
||||
1);
|
||||
J4_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr64,
|
||||
2);
|
||||
J4_struct.addIndirectVirtualBaseClass(CC1_struct.getComposite(), CC1_struct, 0,
|
||||
vbtptr64, 3);
|
||||
J4_struct.addIndirectVirtualBaseClass(CC2_struct.getComposite(), CC2_struct, 0,
|
||||
vbtptr64, 4);
|
||||
J4_struct.addMember("j41", u4, false, 104);
|
||||
return J4_struct;
|
||||
}
|
||||
|
@ -6043,12 +6091,12 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
if (GG3_struct == null) {
|
||||
GG3_struct = createGG3_syntactic_struct32(vxtManager, CC2_struct);
|
||||
}
|
||||
J5_struct.addVirtualSyntacticBaseClass(GG2_struct);
|
||||
J5_struct.addVirtualSyntacticBaseClass(GG3_struct);
|
||||
J5_struct.addDirectSyntacticBaseClass(I3_struct);
|
||||
J5_struct.addDirectSyntacticBaseClass(GG1_struct);
|
||||
J5_struct.addDirectSyntacticBaseClass(I_struct);
|
||||
J5_struct.addDirectSyntacticBaseClass(A_struct);
|
||||
J5_struct.addVirtualSyntacticBaseClass(GG2_struct.getComposite(), GG2_struct);
|
||||
J5_struct.addVirtualSyntacticBaseClass(GG3_struct.getComposite(), GG3_struct);
|
||||
J5_struct.addDirectSyntacticBaseClass(I3_struct.getComposite(), I3_struct);
|
||||
J5_struct.addDirectSyntacticBaseClass(GG1_struct.getComposite(), GG1_struct);
|
||||
J5_struct.addDirectSyntacticBaseClass(I_struct.getComposite(), I_struct);
|
||||
J5_struct.addDirectSyntacticBaseClass(A_struct.getComposite(), A_struct);
|
||||
J5_struct.addMember("j51", u4, false, 0); // TODO nned syntactic without index
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -6077,16 +6125,22 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType E_struct, CppCompositeType CC1_struct, CppCompositeType CC2_struct) {
|
||||
try {
|
||||
CppCompositeType J5_struct = createStruct32("J5", 92);
|
||||
J5_struct.addDirectBaseClass(I3_struct, 0);
|
||||
J5_struct.addDirectBaseClass(GG1_struct, 20);
|
||||
J5_struct.addDirectBaseClass(I_struct, 28);
|
||||
J5_struct.addDirectBaseClass(A_struct, 48);
|
||||
J5_struct.addDirectVirtualBaseClass(GG2_struct, 0, vbtptr32, 4);
|
||||
J5_struct.addDirectVirtualBaseClass(GG3_struct, 0, vbtptr32, 5);
|
||||
J5_struct.addIndirectVirtualBaseClass(CC2_struct, 0, vbtptr32, 3);
|
||||
J5_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr32, 1);
|
||||
J5_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr32, 2);
|
||||
J5_struct.addIndirectVirtualBaseClass(CC1_struct, 0, vbtptr32, 6);
|
||||
J5_struct.addDirectBaseClass(I3_struct.getComposite(), I3_struct, 0);
|
||||
J5_struct.addDirectBaseClass(GG1_struct.getComposite(), GG1_struct, 20);
|
||||
J5_struct.addDirectBaseClass(I_struct.getComposite(), I_struct, 28);
|
||||
J5_struct.addDirectBaseClass(A_struct.getComposite(), A_struct, 48);
|
||||
J5_struct.addDirectVirtualBaseClass(GG2_struct.getComposite(), GG2_struct, 0, vbtptr32,
|
||||
4);
|
||||
J5_struct.addDirectVirtualBaseClass(GG3_struct.getComposite(), GG3_struct, 0, vbtptr32,
|
||||
5);
|
||||
J5_struct.addIndirectVirtualBaseClass(CC2_struct.getComposite(), CC2_struct, 0,
|
||||
vbtptr32, 3);
|
||||
J5_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32,
|
||||
1);
|
||||
J5_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr32,
|
||||
2);
|
||||
J5_struct.addIndirectVirtualBaseClass(CC1_struct.getComposite(), CC1_struct, 0,
|
||||
vbtptr32, 6);
|
||||
J5_struct.addMember("j51", u4, false, 56);
|
||||
return J5_struct;
|
||||
}
|
||||
|
@ -6103,16 +6157,22 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType E_struct, CppCompositeType CC1_struct, CppCompositeType CC2_struct) {
|
||||
try {
|
||||
CppCompositeType J5_struct = createStruct64("J5", 164);
|
||||
J5_struct.addDirectBaseClass(I3_struct, 0);
|
||||
J5_struct.addDirectBaseClass(GG1_struct, 40);
|
||||
J5_struct.addDirectBaseClass(I_struct, 56);
|
||||
J5_struct.addDirectBaseClass(A_struct, 96);
|
||||
J5_struct.addDirectVirtualBaseClass(GG2_struct, 0, vbtptr32, 4);
|
||||
J5_struct.addDirectVirtualBaseClass(GG3_struct, 0, vbtptr32, 5);
|
||||
J5_struct.addIndirectVirtualBaseClass(CC2_struct, 0, vbtptr32, 3);
|
||||
J5_struct.addIndirectVirtualBaseClass(C_struct, 0, vbtptr32, 1);
|
||||
J5_struct.addIndirectVirtualBaseClass(E_struct, 0, vbtptr32, 2);
|
||||
J5_struct.addIndirectVirtualBaseClass(CC1_struct, 0, vbtptr32, 6);
|
||||
J5_struct.addDirectBaseClass(I3_struct.getComposite(), I3_struct, 0);
|
||||
J5_struct.addDirectBaseClass(GG1_struct.getComposite(), GG1_struct, 40);
|
||||
J5_struct.addDirectBaseClass(I_struct.getComposite(), I_struct, 56);
|
||||
J5_struct.addDirectBaseClass(A_struct.getComposite(), A_struct, 96);
|
||||
J5_struct.addDirectVirtualBaseClass(GG2_struct.getComposite(), GG2_struct, 0, vbtptr32,
|
||||
4);
|
||||
J5_struct.addDirectVirtualBaseClass(GG3_struct.getComposite(), GG3_struct, 0, vbtptr32,
|
||||
5);
|
||||
J5_struct.addIndirectVirtualBaseClass(CC2_struct.getComposite(), CC2_struct, 0,
|
||||
vbtptr32, 3);
|
||||
J5_struct.addIndirectVirtualBaseClass(C_struct.getComposite(), C_struct, 0, vbtptr32,
|
||||
1);
|
||||
J5_struct.addIndirectVirtualBaseClass(E_struct.getComposite(), E_struct, 0, vbtptr32,
|
||||
2);
|
||||
J5_struct.addIndirectVirtualBaseClass(CC1_struct.getComposite(), CC1_struct, 0,
|
||||
vbtptr32, 6);
|
||||
J5_struct.addMember("j51", u4, false, 104);
|
||||
return J5_struct;
|
||||
}
|
||||
|
@ -6645,11 +6705,15 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType CC3_struct) {
|
||||
try {
|
||||
CppCompositeType J6_struct = createStruct32("J6", 36);
|
||||
J6_struct.addDirectBaseClass(A_struct, 0);
|
||||
J6_struct.addDirectVirtualBaseClass(GG4_struct, 8, vbtptr32, 2);
|
||||
J6_struct.addDirectVirtualBaseClass(GG3_struct, 8, vbtptr32, 4);
|
||||
J6_struct.addIndirectVirtualBaseClass(CC3_struct, 8, vbtptr32, 1);
|
||||
J6_struct.addIndirectVirtualBaseClass(CC2_struct, 8, vbtptr32, 3);
|
||||
J6_struct.addDirectBaseClass(A_struct.getComposite(), A_struct, 0);
|
||||
J6_struct.addDirectVirtualBaseClass(GG4_struct.getComposite(), GG4_struct, 8, vbtptr32,
|
||||
2);
|
||||
J6_struct.addDirectVirtualBaseClass(GG3_struct.getComposite(), GG3_struct, 8, vbtptr32,
|
||||
4);
|
||||
J6_struct.addIndirectVirtualBaseClass(CC3_struct.getComposite(), CC3_struct, 8,
|
||||
vbtptr32, 1);
|
||||
J6_struct.addIndirectVirtualBaseClass(CC2_struct.getComposite(), CC2_struct, 8,
|
||||
vbtptr32, 3);
|
||||
J6_struct.addMember("j61", u4, false, 12);
|
||||
return J6_struct;
|
||||
}
|
||||
|
@ -6665,11 +6729,15 @@ public class CppCompositeTypeTest extends AbstractGenericTest {
|
|||
CppCompositeType CC3_struct) {
|
||||
try {
|
||||
CppCompositeType J6_struct = createStruct64("J6", 64);
|
||||
J6_struct.addDirectBaseClass(A_struct, 0);
|
||||
J6_struct.addDirectVirtualBaseClass(GG4_struct, 8, vbtptr64, 2);
|
||||
J6_struct.addDirectVirtualBaseClass(GG3_struct, 8, vbtptr64, 4);
|
||||
J6_struct.addIndirectVirtualBaseClass(CC3_struct, 8, vbtptr64, 1);
|
||||
J6_struct.addIndirectVirtualBaseClass(CC2_struct, 8, vbtptr64, 3);
|
||||
J6_struct.addDirectBaseClass(A_struct.getComposite(), A_struct, 0);
|
||||
J6_struct.addDirectVirtualBaseClass(GG4_struct.getComposite(), GG4_struct, 8, vbtptr64,
|
||||
2);
|
||||
J6_struct.addDirectVirtualBaseClass(GG3_struct.getComposite(), GG3_struct, 8, vbtptr64,
|
||||
4);
|
||||
J6_struct.addIndirectVirtualBaseClass(CC3_struct.getComposite(), CC3_struct, 8,
|
||||
vbtptr64, 1);
|
||||
J6_struct.addIndirectVirtualBaseClass(CC2_struct.getComposite(), CC2_struct, 8,
|
||||
vbtptr64, 3);
|
||||
J6_struct.addMember("j61", u4, false, 16);
|
||||
return J6_struct;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package ghidra.program.model.gclass;
|
||||
|
||||
import ghidra.program.model.data.*;
|
||||
|
||||
/**
|
||||
* Utility class for Class-related software modeling.
|
||||
*/
|
||||
public class ClassUtils {
|
||||
|
||||
// Prototype values for now. Need to come to agreement on what these should be. Might want
|
||||
// a separate one for a generic virtual table (not "base" or "function") for gcc/Itanium
|
||||
// standard
|
||||
/**
|
||||
* Standard field name for a virtual base table pointer found within a class
|
||||
*/
|
||||
public static final String VBPTR = "{vbptr}";
|
||||
|
||||
/**
|
||||
* Standard field name for a virtual function table pointer found within a class
|
||||
*/
|
||||
public static final String VFPTR = "{vfptr}";
|
||||
|
||||
/**
|
||||
* Type used for {@link #VBPTR} and {@link #VFPTR} fields in a class
|
||||
*/
|
||||
public static final PointerDataType VXPTR_TYPE = new PointerDataType();
|
||||
|
||||
/**
|
||||
* private constructor -- no instances
|
||||
*/
|
||||
private ClassUtils() {
|
||||
// no instances
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the category for class internals
|
||||
* @param composite the class composite
|
||||
* @return the category path
|
||||
*/
|
||||
public static CategoryPath getClassInternalsPath(Composite composite) {
|
||||
DataTypePath dtp = composite.getDataTypePath();
|
||||
return new CategoryPath(new CategoryPath(dtp.getCategoryPath(), dtp.getDataTypeName()),
|
||||
"!internal");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the data type path for a suitable base class
|
||||
* @param composite the class composite
|
||||
* @return the base class data type path
|
||||
*/
|
||||
public static DataTypePath getBaseClassDataTypePath(Composite composite) {
|
||||
return new DataTypePath(getClassInternalsPath(composite), composite.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the "self-base" composite for the specified class composite. This could be
|
||||
* the composite argument itself of could be a component of it
|
||||
* @param composite the main class type
|
||||
* @return the self-base composite
|
||||
*/
|
||||
public static Composite getSelfBaseType(Composite composite) {
|
||||
DataTypeManager dtm = composite.getDataTypeManager();
|
||||
DataTypePath dtp = ClassUtils.getBaseClassDataTypePath(composite);
|
||||
DataType dt = dtm.getDataType(dtp);
|
||||
if (dt instanceof Composite base) {
|
||||
return base;
|
||||
}
|
||||
if (composite.getNumComponents() > 0) {
|
||||
DataTypeComponent component = composite.getComponent(0);
|
||||
DataType componentType = component.getDataType();
|
||||
if (componentType instanceof Structure struct) {
|
||||
if (struct.getDataTypePath().equals(dtp)) {
|
||||
return struct;
|
||||
}
|
||||
}
|
||||
}
|
||||
return composite;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue