angr.go.analyses.type_descriptors¶
Read Go runtime type descriptors (internal/abi.Type) and itabs out of a binary’s runtime.moduledata.
This is the DWARF-less counterpart of angr.go.analyses.dwarf_signatures: the descriptors are the ground truth
for the layout of every type in this binary. Type strings follow the canonical syntax of angr.go.signature;
named types are qualified with the full import path taken from the descriptor’s UncommonType.PkgPath.
Layouts handled (src/runtime/symtab.go and src/internal/abi/type.go):
go1.20 .. go1.25:
moduledata.typelinks([]int32 offsets fromtypes) anditablinks([]*itab).go1.26+:
typedesclen/itaboffset/itabsizedescribe contiguous runs of descriptors and itabs that are walked withType.DescriptorSize;epclntabwas inserted aftergofunc.go1.18 / go1.19 (no
covctrs) are accepted as well since the descriptor layout is identical, except that before go1.19 a struct field’s offset word isoffsetAnon(offset << 1 | embedded).
- class angr.go.analyses.type_descriptors.GoTypeDescriptors¶
Bases:
objectThe runtime type descriptors of one binary.
- Variables:
go_version – The Go release the binary was built with, when identifiable.
types – Every named type as a GoNamedType record (only
typesis filled).addr_to_name – Descriptor address -> canonical Go type string.
name_to_addr (
dict[str,int]) – The reverse map (first descriptor wins).itabs – itab address -> (interface type name, concrete type name).
moduledata_addr – Address of
runtime.firstmoduledata, or None when none was found.types_addr –
moduledata.types: the base that every NameOff/TypeOff (and DWARF’sDW_AT_go_runtime_type) is relative to.
The eager walk covers everything reachable from the typelinks and itabs; descriptors that only code references (anonymous interfaces of type assertions, map buckets, …) are parsed on demand by
resolve().- __init__(go_version=None, goarch=None, types=None, addr_to_name=None, itabs=None, moduledata_addr=None, types_addr=None, reader=None, methods=None)¶
- go_version
- types
- addr_to_name
- itabs
- moduledata_addr
- types_addr
- resolve(addr)¶
The type string of the descriptor at
addr, parsing it on demand when no typelink reached it.
- angr.go.analyses.type_descriptors.read_go_type_descriptors(project, use_cache=True)¶
Parse the runtime type descriptors and itabs of the main object. Returns an empty result when the binary has no Go moduledata. Results are cached per binary within the process.
- Return type:
- Parameters: