Package ghidra.program.model.data
Class NoisyStructureBuilder
- java.lang.Object
-
- ghidra.program.model.data.NoisyStructureBuilder
-
public class NoisyStructureBuilder extends java.lang.ObjectBuild a structure from a "noisy" source of field information. Feed it field records, either via addDataType(), when we have more definitive info about the size of the field, or via addReference() when we have a pointer reference to the field with possibly less info about the field size. As records come in, overlaps and conflicts in specific field data-types are resolved. In a conflict, less specific data-types are replaced. After all information is collected a final Structure can be built by iterating over the final field entries.
-
-
Constructor Summary
Constructors Constructor Description NoisyStructureBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDataType(long offset, DataType dt)Add data-type information about a specific fieldvoidaddReference(long offset, DataType dt)Adds information for a field given a pointer reference.longgetSize()java.util.Iterator<java.util.Map.Entry<java.lang.Long,DataType>>iterator()voidpopulateOriginalStructure(Structure dt)Populate this builder with fields from a preexisting Structure.voidsetMinimumSize(long size)We may have partial information about the size of the structure.
-
-
-
Method Detail
-
getSize
public long getSize()
- Returns:
- the size of the structure in bytes (given current information)
-
addDataType
public void addDataType(long offset, DataType dt)Add data-type information about a specific field- Parameters:
offset- of the field within the structuredt- is the data-type of field if known (null otherwise)
-
addReference
public void addReference(long offset, DataType dt)Adds information for a field given a pointer reference. The data-type information is not used unless it is a pointer.- Parameters:
offset- is the offset of the field within the structuredt- is the data-type of the pointer to the field (or null)
-
setMinimumSize
public void setMinimumSize(long size)
We may have partial information about the size of the structure. This method feeds it to the builder as a minimum size for the structure.- Parameters:
size- is the minimum size in bytes
-
iterator
public java.util.Iterator<java.util.Map.Entry<java.lang.Long,DataType>> iterator()
- Returns:
- an iterator to the current field entries
-
populateOriginalStructure
public void populateOriginalStructure(Structure dt)
Populate this builder with fields from a preexisting Structure. The builder presumes it is rebuilding this Structure so it can check for pathological containment issues.- Parameters:
dt- is the preexisting Structure
-
-