memtab package

Subpackages

Submodules

Module contents

The Memory Tabulator Package

class memtab.Memtab(elf=None, map_file=None, config=[], project=None, cache=True, check=False, debug=False)

Bases: object

The primary class for the memory tabulator.

This class is responsible for coordinating the parsing of various data sources (nm, readelf, objdump, size, map files), processing the output to produce a list of symbols and their associated memory regions, and categorizing them consistently.

property cache: bool

Get or set the cache flag.

property check: bool

Get or set the check flag.

clean_cache()
Return type:

None

property config: MemtabConfig

Returns the config data

property debug: bool

Get or set the debug flag.

property elf: Path | None

The ELF file being processed, as a path.

property elf_str: str

The ELF file being processed as a string.

property memtab: Dict[str, Any]

The Memory Table. Contains version, symbols array, regions array, and metadata (i.e. where the memory table came from/when it was produced)

property project: str

The project name

property schema: Any

Returns the schema file for the output data format.

tabulate()

Main entry point for the memory tabulator.

This method coordinates the parsing of data from various sources, processes symbols, assigns categories, and produces the final output.

Return type:

DataFrame

Returns:

A dictionary containing the tabulated memory data.

class memtab.MemtabCategory(name='', categories=<factory>)

Bases: object

Name and subcategories for a symbol. This is used to categorize symbols

categories: List[MemtabCategory]
name: str = ''
class memtab.MemtabConfig(Project='', CPU=<factory>, SourceCode=<factory>)

Bases: object

Configuration for the memory tabulator

CPU: MemtabCPU
Project: str = ''
SourceCode: MemtabSourceCode
asdict()

Convert the config to a dictionary.

Return type:

Dict[str, Any]

class memtab.Region(name, start, end, spare, size=0, flags='', region='')

Bases: object

Represents a memory region in the target system.

A memory region is a contiguous block of physical memory with specific properties (e.g., flash, RAM).

end: int
flags: str = ''
name: str
region: str = ''
size: int = 0
spare: int
start: int
class memtab.Section(name, address, size, flags='', type='', calculated_symbol_size=0, unused=0)

Bases: object

Represents a section in a binary.

A section is a segment of the binary that contains code or data with specific properties (e.g., read-only, executable).

address: int
calculated_symbol_size: int = 0
flags: str = ''
name: str
size: int
type: str = ''
unused: int = 0
class memtab.Symbol(name, address, size=0, type='', file='', line_number=0, region='', subregion='', elf_section='', commit='unknown', repo='', categories=<factory>)

Bases: object

Represents a symbol in a binary.

A symbol typically represents a function, variable, or other named entity in the compiled code.

address: int
categories: Dict[str, str]
commit: str = 'unknown'
elf_section: str = ''
file: str = ''
line_number: int = 0
name: str
region: str = ''
repo: str = ''
size: int = 0
subregion: str = ''
to_dict()

Convert the symbol to a dictionary representation.

Return type:

Dict[str, Any]

type: str = ''