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, byte[] hash)
      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
      hash - build-id hash digest found in ".note.gnu.build-id" section, or null if not present
  • 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
    • hasFilename

      public boolean hasFilename()
      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.
    • getHash

      public byte[] getHash()
      Return the build-id hash digest.
      Returns:
      byte array containing the build-id hash (usually 20 bytes)
    • toString

      public String toString()
      Overrides:
      toString in class Object