memtab.parsers.base module

The base class from which all MemTab parsers should inherit.

class memtab.parsers.base.MemtabGnuBinUtilsParser(file, gcc_prefix, cache=False, cache_dir=None)

Bases: MemtabParser

Base class for GNU Binutils parsers.

This class provides a common interface for GNU Binutils parsers such as nm, objdump and readelf. The main extension this provides beyond the base MemtabParser is support for the GCC prefix attribute.

class memtab.parsers.base.MemtabParser(file, cache=False, cache_dir=None)

Bases: object

Base class for MemTab parsers. This class provides a common interface for all MemTab parsers.

property args: List[str]

Get the arguments used for the tool command.

Returns:

The arguments as a string.

property cache: bool

Check if caching is enabled.

Returns:

bool: True if caching is enabled, False otherwise.

property cache_dir: str

Get the directory where cache files are stored.

Returns:

str: The path to the cache directory.

property command: str

Get the command used to run the tool.

Returns:

The command as a string.

property file: Path

Get the file being parsed.

Returns:

The file as a Path object.

parse_output_into_results()

Parse the tool output into the results attribute.

Return type:

None

property raw_data: str

Get the raw tool output.

Returns:

The raw output string from the tool.

property result: ParserResult

Get the complete parsing result.

Returns:

A ParserResult object containing sections, symbols and other data.

run()

Run the tool command and parse the output into results.

This method executes the command specified in the command property, captures its output, and parses it into the result attribute.

Return type:

None

run_system_command()

Run a system command and optionally cache the results.

Return type:

None

property sections: List[Section]

Get the parsed sections.

Returns:

A list of Section objects.

property symbols: List[Symbol]

Get the parsed symbols.

Returns:

A list of Symbol objects.