Class FrameDescriptionEntry

java.lang.Object
ghidra.app.plugin.exceptionhandlers.gcc.GccAnalysisClass
ghidra.app.plugin.exceptionhandlers.gcc.structures.ehFrame.FrameDescriptionEntry

public class FrameDescriptionEntry extends GccAnalysisClass
A Frame Description Entry (FDE) describes the stack call frame, in particular, how to restore registers.

Taken from binutils-2.14.90.0.4/bfd/elf-bfd.h

 struct eh_cie_fde { 
                unsigned int offset; 
                unsigned int size; 
                asection *sec;
                unsigned int new_offset; 
                unsigned char fde_encoding; 
                unsigned char *lsda_encoding; 
                unsigned char lsda_offset; 
                unsigned char cie : 1; 
                unsigned char removed : 1; 
                unsigned char make_relative : 1; 
                unsigned char make_lsda_relative : 1; 
                unsigned char per_encoding_relative : 1; 
 };
 
 ACTUAL: struct eh_cie_fde { 
                dword fde.length 
                dword fde.ciePointer (Offset to this FDEs CIE) 
                dword fde.pcBegin 
                dword fde.pcRange 
                dword fde.augmentationLength 
                dword fde.augmentationData 
                dword Call Frame Instructions dword 
                !!! NO IDEA !!! 
 }
 
  • Constructor Details

    • FrameDescriptionEntry

      public FrameDescriptionEntry(TaskMonitor monitor, Program program, CieSource cieSource)
      Constructor for a frame descriptor entry.
      Note: The create(Address) method must be called after constructing a FrameDescriptionEntry to associate it with an address before any of its "get..." methods are called.
      Parameters:
      monitor - a status monitor for tracking progress and allowing cancelling when creating an FDE.
      program - the program where this will create an FDE.
      cieSource - the call frame information entry for this FDE.
  • Method Details

    • create

      Creates a Frame Description Entry (FDE) at the address specified.
      Note: This method must get called before any of the "get..." methods.
      Parameters:
      fdeBaseAddress - Address where the FDE should be created.
      Returns:
      a region descriptor which holds information about this FDE. Otherwise, null.
      Throws:
      MemoryAccessException - if memory for the FDE or its associated data can't be accessed
      ExceptionHandlerFrameException - if there is an error creating the FDE information.
    • getNextAddress

      public Address getNextAddress()
      Gets the next address in memory after this FDE record.
      Returns:
      the next address after this FDE or null if at the end of the section
    • isEndOfFrame

      public boolean isEndOfFrame()
      Determines if this FDE encountered a zero length record, which indicates the end of the frame.
      Returns:
      true if we are at end of frame due to encountering a zero length record.
    • getProtectionRange

      public AddressRange getProtectionRange()
      Get the address range that contains the program instructions.
      Returns:
      the address range
    • getAugmentationDataAddress

      public Address getAugmentationDataAddress()
      Get the address of the augmentation data in this FDE record.
      Returns:
      the augmentation data field's address
    • getAugmentationData

      public byte[] getAugmentationData()
      Gets the bytes which specify the FDE field that refers to the augmentation data.
      Returns:
      the FDE record's augmentation data.
    • getAugmentationExDataAddress

      public Address getAugmentationExDataAddress()
      Gets the start address for the call frame augmentation data.
      Returns:
      the address of the call frame augmentation data
    • setAugmentationDataExLength

      public int setAugmentationDataExLength(int len)
      Sets the value this region descriptor maintains to indicate the length of the augmentation data.
      Parameters:
      len - number of bytes that compose the augmentation data
      Returns:
      the length of the augmentation data or -1 if it has already been set.
    • getAugmentationExData

      public byte[] getAugmentationExData()
      Gets the call frame augmentation data that indicates how registers are saved and restored.
      Returns:
      the augmentation data