memtab.models module

Shared data models used across the memtab package.

This module defines the common data structures used by various parsers and other components of the memtab package to ensure a consistent interface.

class memtab.models.MemtabCPU(memory_regions=<factory>, gcc_prefix='', name='', exclude_arm_sections=True, exclude_debug_sections=True, allow_zero_address_sections=False)

Bases: object

Details about the CPU. This is used to categorize symbols

allow_zero_address_sections: bool = False
exclude_arm_sections: bool = True
exclude_debug_sections: bool = True
gcc_prefix: str = ''
memory_regions: List[Region]
name: str = ''
class memtab.models.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.models.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.models.MemtabSourceCode(categories=<factory>, root='')

Bases: object

Details about source code

categories: List[Dict[str, MemtabCategory]]
root: str = ''
class memtab.models.ParserResult(sections=<factory>, symbols=<factory>, regions=<factory>, metadata=<factory>)

Bases: object

Common result structure for all parsers.

This provides a consistent interface for Memtab to process parsing results from different sources.

metadata: Dict[str, Any]
regions: List[Region]
sections: List[Section]
symbols: List[Symbol]
class memtab.models.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.models.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.models.SubRegion(name, start, end, size=0, parent_region='')

Bases: object

Represents a sub-region of a memory region.

A sub-region is a segment of a memory region with specific properties, such as flash, RAM, etc.

end: int
name: str
parent_region: str = ''
size: int = 0
start: int
class memtab.models.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 = ''