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 golang 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 GoBuildInfofromProgram(Program program) Reads a GoBuildInfo ".go.buildinfo" section from the specified Program, if present.getBuildSetting(String key) Returns the Golang Arch string for the specified program, either from previously parsed metadata value, or from a static Ghidra language to golang mapping.Returns the Golang OS string for the specified program, either from previously parsed metadata value, or from a static Ghidra-loader to golang mapping.getGoVer()getPath()intstatic StringgetProgramGOARCH(Program program) Returns a Golang "GOARCH" string created by a mapping from the Ghidra program's language (arch).static StringgetProgramGOOS(Program program) Returns a Golang "GOOS" string created by a mapping from the Ghidra program's loader type.static booleanisPresent(InputStream is) Probes the specified InputStream and returns true if it starts with a go buildinfo magic signature.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.toString()
-
Field Details
-
SECTION_NAME
- See Also:
-
ELF_SECTION_NAME
- See Also:
-
MACHO_SECTION_NAME
- 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
-
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
-
isPresent
Probes the specified InputStream and returns true if it starts with a go buildinfo magic signature.- Parameters:
is- InputStream- Returns:
- true if starts with buildinfo magic signature
-
getPointerSize
public int getPointerSize() -
getEndian
-
getVersion
-
getGoVer
-
getPath
-
getModuleInfo
-
getDependencies
-
getBuildSettings
-
getBuildSetting
-
getGOOS
Returns the Golang OS string for the specified program, either from previously parsed metadata value, or from a static Ghidra-loader to golang mapping.- Parameters:
program-Program- Returns:
- golang GOOS string, see https://go.dev/doc/install/source#environment
-
getProgramGOOS
Returns a Golang "GOOS" string created by a mapping from the Ghidra program's loader type.- Parameters:
program-Program- Returns:
- Golang "GOOS" string
-
getGOARCH
Returns the Golang Arch string for the specified program, either from previously parsed metadata value, or from a static Ghidra language to golang mapping.- Parameters:
program-Program- Returns:
- golang GOARCH string, see https://go.dev/doc/install/source#environment
-
getProgramGOARCH
Returns a Golang "GOARCH" string created by a mapping from the Ghidra program's language (arch).- Parameters:
program-Program- Returns:
- Golang "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
-