angr.go.optimization_passes.result_widener

class angr.go.optimization_passes.result_widener.GoResultWidener

Bases: OptimizationPass

Let the return statements of a function whose results are only guessed name every ABIInternal result register that holds a value at the return: registers written on all paths since the last call, or carried by that call’s results. The calling-convention guess only ever counts the first two, so the result inference would otherwise never see the cap word of a slice or the error behind a pointer. The prototype keeps its guessed shape; the extra expressions are tagged with the guessed word count and dropped again once the inference has read them.

A guess can also count too many: a result register a callee left behind looks returned. When a return site of known provenance leaves it unset and the function never writes it after its last call, it is dropped from the returns and from the guessed prototype.

ARCHES = None
PLATFORMS = None
STAGE: OptimizationPassStage = 1
NAME = 'Widen guessed Go return statements to every result register'
__init__(func, manager, **kwargs)