Class GoModuledata

java.lang.Object
ghidra.app.util.bin.format.golang.rtti.GoModuledata
All Implemented Interfaces:
StructureMarkup<GoModuledata>

public class GoModuledata extends Object implements StructureMarkup<GoModuledata>
Represents a golang moduledata structure, which contains a lot of valuable bootstrapping data for RTTI and function data.
  • Constructor Details

    • GoModuledata

      public GoModuledata()
  • Method Details

    • matchesPclntab

      public boolean matchesPclntab(GoPcHeader pclntab)
      Compares the data in this structure to fields in a GoPcHeader and returns true if they match.
      Parameters:
      pclntab - GoPcHeader instance
      Returns:
      boolean true if match, false if no match
    • getPcHeader

      public GoPcHeader getPcHeader() throws IOException
      Throws:
      IOException
    • getText

      public Address getText()
      Returns the address of the beginning of the text section.
      Returns:
      address of the beginning of the text section
    • getTextRange

      public AddressRange getTextRange()
    • getRoDataRange

      public AddressRange getRoDataRange()
    • getDataRange

      public AddressRange getDataRange()
    • getTypesOffset

      public long getTypesOffset()
      Returns the starting offset of type info
      Returns:
      starting offset of type info
    • getTypesEndOffset

      public long getTypesEndOffset()
      Returns the ending offset of type info
      Returns:
      ending offset of type info
    • getGofunc

      public long getGofunc()
      Return the offset of the gofunc location
      Returns:
      offset of the gofunc location
    • getFuncDataInstance

      public GoFuncData getFuncDataInstance(long offset) throws IOException
      Reads a GoFuncData structure from the pclntable.
      Parameters:
      offset - relative to the pclntable
      Returns:
      GoFuncData
      Throws:
      IOException - if error reading data
    • containsFuncDataInstance

      public boolean containsFuncDataInstance(long offset)
      Returns true if this GoModuleData is the module data that contains the specified GoFuncData structure.
      Parameters:
      offset - offset of a GoFuncData structure
      Returns:
      true if this GoModuleData is the module data that contains the specified GoFuncData structure
    • getFunctabEntriesSlice

      public GoSlice getFunctabEntriesSlice()
      Returns an artificial slice of the functab entries that are valid.
      Returns:
      artificial slice of the functab entries that are valid
    • isValid

      public boolean isValid()
      Returns true if this module data structure contains sane values.
      Returns:
      true if this module data structure contains sane values
    • getFuncnametab

      public GoSlice getFuncnametab()
      Returns a slice that contains all the function names.
      Returns:
      slice that contains all the function names
    • getAllFunctionData

      public List<GoFuncData> getAllFunctionData() throws IOException
      Returns a list of all functions contained in this module.
      Returns:
      list of all functions contained in this module
      Throws:
      IOException - if error reading data
    • getCutab

      public GoSlice getCutab()
      Returns the cutab slice.
      Returns:
      cutab slice
    • getFiletab

      public GoSlice getFiletab()
      Returns the filetab slice.
      Returns:
      filetab slice
    • getFilename

      public String getFilename(long fileoff) throws IOException
      Returns the filename at the specified offset.
      Parameters:
      fileoff - offset in the filetab of the filename
      Returns:
      filename
      Throws:
      IOException - if error reading
    • getPctab

      public GoSlice getPctab()
      Returns the pctab slice.
      Returns:
      pctab slice
    • getGoBinary

      public GoRttiMapper getGoBinary()
      Returns a reference to the controlling go binary context.
      Returns:
      reference to the controlling go binary context
    • getStructureContext

      public StructureContext<GoModuledata> getStructureContext()
      Specified by:
      getStructureContext in interface StructureMarkup<GoModuledata>
    • additionalMarkup

      public void additionalMarkup(MarkupSession session) throws IOException, CancelledException
      Description copied from interface: StructureMarkup
      Called to allow the implementor to perform custom markup of itself.
      Specified by:
      additionalMarkup in interface StructureMarkup<GoModuledata>
      Parameters:
      session - state and methods to assist marking up the program
      Throws:
      IOException - if error during markup
      CancelledException - if cancelled
    • getItabs

      public List<GoItab> getItabs() throws IOException
      Returns a list of the GoItabs present in this module.
      Returns:
      list of the GoItabs present in this module
      Throws:
      IOException - if error reading data
    • iterateTypes

      public Iterator<GoType> iterateTypes() throws IOException
      Returns an iterator that walks all the types contained in this module
      Returns:
      iterator that walks all the types contained in this module
      Throws:
      IOException - if error reading data
    • getTypeList

      public List<Address> getTypeList() throws IOException
      Returns a list of locations of the types contained in this module.
      Returns:
      list of addresses of GoType structures
      Throws:
      IOException - if error reading data