angr.go.signature¶
Language-level Go function signatures and named-type descriptions.
Every source of Go type information (the stdlib signature database, DWARF, runtime type descriptors, external tools) is normalized into these records before it is turned into SimTypes. Types are carried as Go type strings in canonical Go syntax with package-path-qualified names, e.g.:
int uint8 uintptr bool string error unsafe.Pointer
*net/http.Server []byte [4]int map[string][]int chan<- int func(int, string) (int, error)
struct { x int; y int } interface { Error() string } any
Rules:
- Named types are qualified with the full import path (net/http.Server, main.point, os.File); a type
from package
mainismain.T. Predeclared types (int,string,error,any) are bare.
Struct field lists use
;separators; anonymous (embedded) fields are written as their type.Function types never carry parameter names; only signatures do.
Generic instantiations use the compiler’s spelling, e.g.
slices.Index[[]int,int].
JSON form (used by the on-disk signature databases):
{
"go_version": "go1.22.5",
"goarch": "amd64",
"functions": {
"strconv.Atoi": {"params": [["s", "string"]], "results": [["~r0", "int"], ["~r1", "error"]]},
"os.(*File).Write": {"recv": ["f", "*os.File"], "params": [["b", "[]byte"]],
"results": [["n", "int"], ["err", "error"]]}
},
"types": {
"os.File": {"kind": "struct", "size": 8, "align": 8, "fields": [["file", "*os.file", 0]]},
"error": {"kind": "interface", "methods": [["Error", "func() string"]]},
"time.Duration": {"kind": "named", "underlying": "int64", "size": 8, "align": 8}
}
}
kind is one of struct, interface and named (any other named type; underlying is its Go type
string). Sizes and offsets are in bytes for goarch.
- class angr.go.signature.GoParam¶
Bases:
objectA named parameter or result and its canonical Go type string.
- name: str
- type_str: str
- class angr.go.signature.GoFuncSignature¶
Bases:
objectA Go function or method signature.
nameis the linker symbol name (pkg.Func,pkg.(*T).Method,pkg.T.Method,pkg.Func.func1).- name: str
- classmethod from_json(name, d)¶
- Return type:
- Parameters:
- class angr.go.signature.GoStructField¶
Bases:
objectA struct field: name, canonical Go type string and byte offset.
- name: str
- type_str: str
- class angr.go.signature.GoNamedType¶
Bases:
objectA named Go type.
kindisstruct(fieldsset),interface(methodsset) ornamed(underlyingset).- name: str
- kind: str
- fields: list[GoStructField]
- classmethod from_json(name, d)¶
- Return type:
- Parameters:
- class angr.go.signature.GoVariable¶
Bases:
objectA package-level variable: its linker symbol name, (rebased) address and Go type.
- name: str
- addr: int
- type_str: str
- class angr.go.signature.GoSignatureSet¶
Bases:
objectA collection of signatures, named types and package-level variables from one source.
- functions: dict[str, GoFuncSignature]
- types: dict[str, GoNamedType]
- variables: dict[str, GoVariable]
- runtime_types: dict[int, str]
runtime type descriptor address -> type name (binary-specific, not serialized)
- without_layout(goarch)¶
The same set with sizes, alignments and field offsets dropped: they were computed for another GOARCH.
- Return type:
- Parameters:
goarch (str | None)
- __init__(go_version=None, goarch=None, functions=<factory>, types=<factory>, variables=<factory>, runtime_types=<factory>)¶
- Parameters:
go_version (str | None)
goarch (str | None)
functions (dict[str, GoFuncSignature])
types (dict[str, GoNamedType])
variables (dict[str, GoVariable])
- Return type:
None