angr.go.optimization_passes.prototype_inference

class angr.go.optimization_passes.prototype_inference.GoPrototypeInference

Bases: OptimizationPass

Infer the signature of a function nobody names (no DWARF, not in the signature database, not a method) from the typed code around it:

  • parameters, from how they reach callees whose prototypes are known: a parameter word passed where a callee takes an int is an int, two consecutive words fused into io.Writer for a callee are an io.Writer;

  • results, from what its return statements put in the result registers (a new(T) gives *T, a constant string header a string, an itab an interface, a known callee’s result its type) and from how callers use the result registers of calls to it (passed to a typed callee, returned through a typed prototype, stored into a typed field, compared against an itab).

Everything is recorded in kb.go_signatures as an inferred signature; it takes effect the next time the function is decompiled (the argument variables and return sites are built before any pass runs).

ARCHES = None
PLATFORMS = None
STAGE: OptimizationPassStage = 7
NAME = 'Infer Go signatures from typed callers and callees'
__init__(func, manager, **kwargs)