angr.knowledge_plugins.key_definitions.uses

class angr.knowledge_plugins.key_definitions.uses.Uses

Bases: object

Describes uses (including the use location and the use expression) for definitions.

__init__(uses_by_definition=None, uses_by_location=None)
Parameters:
add_use(definition, codeloc, expr=None)

Add a use for a given definition.

Parameters:
  • definition (Definition) – The definition that is used.

  • codeloc (CodeLocation) – The code location where the use occurs.

  • expr (Any | None) – The expression that uses the specified definition at this location.

get_uses(definition)

Retrieve the uses of a given definition.

Parameters:

definition (Definition) – The definition for which we get the uses.

Return type:

set[CodeLocation]

get_uses_with_expr(definition)

Retrieve the uses and the corresponding expressions of a given definition.

Parameters:

definition (Definition) – The definition for which we get the uses and the corresponding expressions.

Return type:

set[tuple[CodeLocation, Any | None]]

remove_use(definition, codeloc, expr=None)

Remove one use of a given definition.

Parameters:
  • definition (Definition) – The definition of which to remove the uses.

  • codeloc (CodeLocation) – The code location where the use is.

  • expr (Any | None) – The expression that uses the definition at the given location.

Return type:

None

Returns:

None

remove_uses(definition)

Remove all uses of a given definition.

Parameters:

definition (Definition) – The definition of which to remove the uses.

Returns:

None

get_uses_by_location(codeloc, exprs=False)

Retrieve all definitions that are used at a given location.

Parameters:
Return type:

set[Definition] | set[tuple[Definition, Any | None]]

Returns:

A set of definitions that are used at the given location.

get_uses_by_insaddr(ins_addr, exprs=False)

Retrieve all definitions that are used at a given location specified by the instruction address.

Parameters:
  • ins_addr (int) – The instruction address.

  • exprs (bool)

Return type:

set[Definition] | set[tuple[Definition, Any | None]]

Returns:

A set of definitions that are used at the given location.

copy()

Copy the instance.

Return type:

Uses

Returns:

Return a new <Uses> instance containing the same data.

merge(other)

Merge an instance of <Uses> into the current instance.

Parameters:

other (Uses) – The other <Uses> from which the data will be added to the current instance.

Return type:

bool

Returns:

True if any merge occurred, False otherwise