Class ExternalDebugInfo

java.lang.Object
ghidra.app.util.bin.format.dwarf.external.ExternalDebugInfo

public class ExternalDebugInfo extends Object
Metadata needed to find an ELF/DWARF external debug file, retrieved from an ELF binary's ".gnu_debuglink" section and/or ".note.gnu.build-id" section.

The debuglink can provide a filename and crc of the external debug file, while the build-id can provide a hash that is converted to a filename that identifies the external debug file.

  • Constructor Details

    • ExternalDebugInfo

      public ExternalDebugInfo(String filename, int crc, String buildId, ObjectType objectType, String extra)
      Constructor to create an ExternalDebugInfo instance.
      Parameters:
      filename - filename of external debug file, or null
      crc - crc32 of external debug file, or 0 if no filename
      buildId - build-id hash digest found in ".note.gnu.build-id" section, or null if not present
      objectType - ObjectType specifies what kind of debug file is specified by the other info
      extra - additional information used by ObjectType.SOURCE
  • Method Details

    • fromProgram

      public static ExternalDebugInfo fromProgram(Program program)
      Create a new ExternalDebugInfo from information found in the specified program.
      Parameters:
      program - Program to query
      Returns:
      new ExternalDebugInfo or null if no external debug metadata found in program
    • forBuildId

      public static ExternalDebugInfo forBuildId(String buildId)
      Returns a new ExternalDebugInfo instance created using the specified Build-Id value.
      Parameters:
      buildId - hex string
      Returns:
      a new ExternalDebugInfo instance created using the specified Build-Id value
    • forDebugLink

      public static ExternalDebugInfo forDebugLink(String debugLinkFilename, int crc)
      Returns a new ExternalDebugInfo instance created using the specified debuglink values.
      Parameters:
      debugLinkFilename - filename from debuglink section
      crc - crc32 from debuglink section
      Returns:
      a new ExternalDebugInfo instance created using the specified debuglink values
    • hasDebugLink

      public boolean hasDebugLink()
      Return true if there is a filename
      Returns:
      boolean true if filename is available, false if not
    • getFilename

      public String getFilename()
      Return the filename of the external debug file, or null if not specified.
      Returns:
      String filename of external debug file, or null if not specified
    • getCrc

      public int getCrc()
      Return the crc of the external debug file. Not valid if filename is missing.
      Returns:
      int crc32 of external debug file.
    • getBuildId

      public String getBuildId()
      Return the build-id.
      Returns:
      build-id hash string
    • hasBuildId

      public boolean hasBuildId()
      Returns true if buildId is available, false if not.
      Returns:
      true if buildId is available, false if not
    • getObjectType

      public ObjectType getObjectType()
    • getExtra

      public String getExtra()
    • withType

      public ExternalDebugInfo withType(ObjectType newObjectType, String newExtra)
    • toString

      public String toString()
      Overrides:
      toString in class Object