Class GoBuildInfo
java.lang.Object
ghidra.app.util.bin.format.golang.GoBuildInfo
- All Implemented Interfaces:
ElfInfoItem
A program section that contains Go build information strings, namely Go module package names,
Go module dependencies, and build/compiler flags, as well as the Go version itself.
-
Nested Class Summary
Nested classes/interfaces inherited from interface ghidra.app.util.bin.format.elf.info.ElfInfoItem
ElfInfoItem.ItemWithAddress<T>, ElfInfoItem.ReaderFunc<T> -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoiddecorateProgramInfo(Options props) findBuildInfo(Program program) Searches for the GoBuildInfo structure in the most common and easy locations.static longfindGoBuildInfoOffset(ByteProvider bp, int maxSearchLength) Searches for the offset of the GoBuildInfo magic string.static GoBuildInfofromFallbackInfo(Program program) static GoBuildInfofromProgram(Program program) Reads a GoBuildInfo ".go.buildinfo" section from the specified Program, if present.getBuildSetting(String key) Returns the Go Arch string for the specified program, either from previously parsed metadata value, or from a static Ghidra language to Go mapping.Returns the Go OS string ("GOOS") for the specified program, either from previously parsed metadata value, or from a static Ghidra-loader to Go mapping.getGoVer()getPath()intstatic StringgetProgramGOARCH(Program program) Returns a Go "GOARCH" string created by a mapping from the Ghidra program's language (arch).static StringgetProgramGOOS(Program program) Returns a Go "GOOS" string created by a mapping from the Ghidra program's loader type.voidmarkupProgram(Program program, Address address) Markup a program's info and memory with this item.static GoBuildInforead(BinaryReader reader, Program program) Reads a GoBuildInfo ".go.buildinfo" section from the specified stream.static voidsetFallbackVersion(Program program, String fallbackGoVerStr) toString()
-
Field Details
-
SECTION_NAME
- See Also:
-
ELF_SECTION_NAME
- See Also:
-
MACHO_SECTION_NAME
- See Also:
-
FALLBACK_GOVER_OPTION
- See Also:
-
-
Method Details
-
fromProgram
Reads a GoBuildInfo ".go.buildinfo" section from the specified Program, if present.- Parameters:
program-Programthat contains the ".go.buildinfo" section- Returns:
- new
GoBuildInfoinstance, if present, null if missing or error
-
findBuildInfo
Searches for the GoBuildInfo structure in the most common and easy locations.- Parameters:
program-Programto search- Returns:
- new
GoBuildInfoinstance, if present, null if missing or error
-
findGoBuildInfoOffset
Searches for the offset of the GoBuildInfo magic string.- Parameters:
bp-ByteProviderto searchmaxSearchLength- max number of bytes to search- Returns:
- offset of the magic string, or -1 if not found
-
read
Reads a GoBuildInfo ".go.buildinfo" section from the specified stream.- Parameters:
reader- BinaryReader that contains the ".go.buildinfo" sectionprogram- Program that contains the ".go.buildinfo" section- Returns:
- new
GoBuildInfoinstance, never null - Throws:
IOException- if error reading or bad data
-
setFallbackVersion
-
fromFallbackInfo
-
getPointerSize
public int getPointerSize() -
getEndian
-
getVersion
-
getGoVer
-
getPath
-
getModuleInfo
-
getDependencies
-
getBuildSettings
-
getBuildSetting
-
getGOOS
Returns the Go OS string ("GOOS") for the specified program, either from previously parsed metadata value, or from a static Ghidra-loader to Go mapping.- Parameters:
program-Program- Returns:
- Go "GOOS" string, see https://go.dev/doc/install/source#environment
-
getProgramGOOS
Returns a Go "GOOS" string created by a mapping from the Ghidra program's loader type.- Parameters:
program-Program- Returns:
- Go "GOOS" string
-
getGOARCH
Returns the Go Arch string for the specified program, either from previously parsed metadata value, or from a static Ghidra language to Go mapping.- Parameters:
program-Program- Returns:
- Go "GOARCH" string, see https://go.dev/doc/install/source#environment
-
getProgramGOARCH
Returns a Go "GOARCH" string created by a mapping from the Ghidra program's language (arch).- Parameters:
program-Program- Returns:
- Go "GOARCH" string
-
markupProgram
Description copied from interface:ElfInfoItemMarkup a program's info and memory with this item.- Specified by:
markupProgramin interfaceElfInfoItem- Parameters:
program-Programto markupaddress-Addressof the item in the program
-
decorateProgramInfo
-
toString
-