Class AlignedStructurePacker

java.lang.Object
ghidra.program.model.data.AlignedStructurePacker
Direct Known Subclasses:
AlignedStructureInspector

public class AlignedStructurePacker extends Object
AlignedStructurePacker provides support for performing aligned packing of Structure components.

NOTE: We currently have no way of conveying or supporting explicit bitfield component pragmas supported by some compilers (e.g., bit_field_size, bit_field_align, bit_packing).

  • Constructor Details

    • AlignedStructurePacker

      protected AlignedStructurePacker(StructureInternal structure, List<? extends InternalDataTypeComponent> components)
      Constructor.
      Parameters:
      structure - structure whose components need to be packed and updated during packing (ordinal, offset, length and bit-field datatypes may be modified)
      components - list of mutable component
  • Method Details

    • pack

      Perform packing on the structure components.
      Returns:
      pack result data
    • packComponents

      public static AlignedStructurePacker.StructurePackResult packComponents(StructureInternal structure, List<? extends InternalDataTypeComponent> components)
      Perform structure component packing. Specified components may be updated to reflect packing (ordinal, offset, length and bit-field datatypes may be modified). The caller is responsible for updating structure length and component count based upon returned result. Component count is should only change if component list includes DEFAULT members which will be ignored.
      Parameters:
      structure - structure whose members are to be aligned/packed.
      components - structure components.
      Returns:
      aligned packing result