pyx2cscope.parser.elf32_parser

This module provides functionalities for parsing ELF files compatible with 32-bit architectures.

It focuses on extracting structure members and variable information from DWARF debugging information.

Module Contents

Classes

Elf32Parser

Class for parsing ELF files compatible with 32-bit architectures.

Attributes

elf_file

class pyx2cscope.parser.elf32_parser.Elf32Parser(elf_path)[source]

Bases: pyx2cscope.parser.elf_parser.ElfParser

Class for parsing ELF files compatible with 32-bit architectures.

_load_elf_file()[source]

Load the ELF file according to the specific hardware architecture.

This method should be implemented by subclasses to handle different ELF file formats.

close_elf_file()[source]

Closes the ELF file stream.

_map_variables() dict[str, pyx2cscope.parser.elf_parser.VariableInfo][source]

Abstract method to map variables from the parsed DWARF information.

Subclasses should implement this method to extract variable information specific to their ELF format.

Returns:

Dict[str, VariableInfo]: A dictionary of variable names to VariableInfo objects.

_process_variable_die(die_variable)[source]

Process an individual variable DIE.

_get_end_die(current_die)[source]

Find the end DIE of a type.

_processing_end_die(end_die)[source]

Processes the end DIE of a tag to extract variable information.

_extract_address(die_variable)[source]

Extracts the address of the current variable or fetches it from the symbol table if not found.

_load_symbol_table()[source]

Loads symbol table entries into a dictionary for fast access.

_fetch_address_from_symtab(variable_name)[source]

Fetches the address of a variable from the preloaded symbol table.

_find_actual_declaration(die_variable)[source]

Find the actual declaration of an extern variable.

_process_pointer_type(end_die)[source]

Process a pointer type variable.

_process_structure_type(end_die)[source]

Process a structure type variable.

_process_array_type(end_die)[source]

Process an array type variable.

_process_base_type(end_die)[source]

Process a base type variable.

_get_structure_members_recursive(die, parent_name: str, prev_address_offset=0)[source]

Recursively gets structure members from a DWARF DIE.

_get_structure_members(structure_die, var_name)[source]

Retrieves structure members from a DWARF DIE.

_get_array_length(type_die)[source]

Gets the length of an array type.

_get_member_type(type_offset)[source]

Retrieve the type information from DWARF given a type offset.

_get_dwarf_die_by_offset(offset)[source]

Retrieve a DWARF DIE given its offset.

pyx2cscope.parser.elf32_parser.elf_file = 'C:\\Users\\m67250\\Downloads\\pmsm_foc_zsmt_hybrid_sam_e54\\pmsm_foc_zsmt_hybrid_sam_e54\\firmware\\qspi...'[source]