angr.knowledge_plugins.debug_variables

class angr.knowledge_plugins.debug_variables.DebugVariableContainer

Bases: object

Variable tree for variables with same name to lock up which variable is visible at a given program counter address.

__init__()

It is recommended to use DebugVariableManager.add_variable() instead

from_pc(pc)

Returns the visible variable (if any) for a given pc address.

Return type:

Variable

class angr.knowledge_plugins.debug_variables.DebugVariable

Bases: DebugVariableContainer

Variables:
  • low_pc – Start of the visibility scope of the variable as program counter address (rebased)

  • high_pc – End of the visibility scope of the variable as program counter address (rebased)

  • cle_variable – Original variable from cle

__init__(low_pc, high_pc, cle_variable)

It is recommended to use DebugVariableManager.add_variable() instead

Parameters:
contains(dvar)
Return type:

bool

Parameters:

dvar (DebugVariable)

test_unsupported_overlap(dvar)

Test for an unsupported overlapping

Parameters:

dvar (DebugVariable) – Second DebugVariable to compare with

Return type:

bool

Returns:

True if there is an unsupported overlapping

class angr.knowledge_plugins.debug_variables.DebugVariableManager

Bases: KnowledgeBasePlugin

Structure to manage and access variables with different visibility scopes.

__init__(kb)
Parameters:

kb (KnowledgeBase)

from_name_and_pc(var_name, pc_addr)

Get a variable from its string in the scope of pc.

Return type:

Variable

Parameters:
  • var_name (str)

  • pc_addr (int)

from_name(var_name)

Get the variable container for all variables named var_name

Parameters:

var_name (str) – name for a variable

Return type:

DebugVariableContainer

add_variable(cle_var, low_pc, high_pc)

Add/load a variable

Parameters:
  • cle_variable – The variable to add

  • low_pc (int) – Start of the visibility scope of the variable as program counter address (rebased)

  • high_pc (int) – End of the visibility scope of the variable as program counter address (rebased)

  • cle_var (Variable)

add_variable_list(vlist, low_pc, high_pc)

Add all variables in a list with the same visibility range

Parameters:
  • vlist (list[Variable]) – A list of cle variables to add

  • low_pc (int) – Start of the visibility scope as program counter address (rebased)

  • high_pc (int) – End of the visibility scope as program counter address (rebased)

load_from_dwarf(elf_object=None, cu=None)

Automatically load all variables (global/local) from the DWARF debugging info

Parameters:
  • elf_object (ELF) – Optional, when only one elf object should be considered (e.g. p.loader.main_object)

  • cu (CompilationUnit) – Optional, when only one compilation unit should be considered