Module stm8dce.rel_analysis
This module provides classes and functions for analyzing .rel and .lib files
Functions
def modules_by_defined_symbol(modules, symbol_name)-
Returns a list of modules that define the given symbol.
Args
modules:list- List of Module objects.
symbol_name:str- The symbol to search for.
Returns
list- List of modules that define the symbol.
Classes
class Module-
Class to represent a module in the .rel or .lib file.
Attributes
path:str- Path to the file containing the module.
line_number:int- Line number in the file where the module starts.
name:str- The name of the module.
referenced_symbols:list- Symbols referenced by this module.
defined_symbols:list- Symbols defined by this module.
referenced_by:list- ASM functions that reference this module.
references:list- ASM Functions or constants referenced by this module.
Initializes the Module with the given path and line_number.
Args
path:str- The file path of the module.
line_number:int- The line number in the file.
Methods
def __init__(self, path, line_number)-
Initializes the Module with the given path and line_number.
Args
path:str- The file path of the module.
line_number:int- The line number in the file.
def __repr__(self)-
Return repr(self).
def __str__(self)-
Return str(self).
def add_defined_symbol(self, symbol)-
Adds a symbol to the list of defined symbols.
Args
symbol:str- The symbol to add.
def add_referenced_symbol(self, symbol)-
Adds a symbol to the list of referenced symbols.
Args
symbol:str- The symbol to add.
def print(self)-
Prints the details of the module.
def resolve_incoming_references(self, keep_functions, all_initializers)-
Resolves incoming references for the module. This means finding the functions that reference this module's defined symbols.
Args
keep_functions:list- List of kept function objects.
all_initializers:list- List of all initializer objects.
def resolve_outgoing_references(self, all_functions, all_constants)-
Resolves outgoing references for the module. This means finding the functions and constants that this module references.
Args
all_functions:list- List of all function objects.
all_constants:list- List of all constant objects.
def resolve_references(self, keep_functions, all_initializers, all_functions, all_constants)-
Resolves references for the module by calling incoming and outgoing reference resolvers. Resolving means: - Find the functions that reference this module's defined symbols - Find the functions and constants that this module references
Args
keep_functions:list- List of kept function objects.
all_initializers:list- List of all initializer objects.
all_functions:list- List of all function objects.
all_constants:list- List of all constant objects.
def set_name(self, name)-
Sets the name of the module.
Args
name:str- The name to set for the module.