Skip to content

libdebug.data.symbol

Symbol dataclass

A symbol in the target process.

start (int): The start address of the symbol in the target process. end (int): The end address of the symbol in the target process. name (str): The name of the symbol in the target process. backing_file (str): The backing file of the symbol in the target process. reference_file (str): The file that the symbol's offsets refer to in the target process. reference_build_id (str | None): The build ID of the reference file. is_external (bool): Whether the symbol is external or not.

Source code in libdebug/data/symbol.py
@dataclass
class Symbol:
    """A symbol in the target process.

    start (int): The start address of the symbol in the target process.
    end (int): The end address of the symbol in the target process.
    name (str): The name of the symbol in the target process.
    backing_file (str): The backing file of the symbol in the target process.
    reference_file (str): The file that the symbol's offsets refer to in the target process.
    reference_build_id (str | None): The build ID of the reference file.
    is_external (bool): Whether the symbol is external or not.
    """

    start: int
    end: int
    name: str
    backing_file: str
    reference_file: str
    reference_build_id: str | None
    is_external: bool

    def __hash__(self: Symbol) -> int:
        """Returns the hash of the symbol."""
        return hash((self.start, self.end, self.name, self.backing_file))

    def __repr__(self: Symbol) -> str:
        """Returns the string representation of the symbol."""
        return f"Symbol(start={self.start:#x}, end={self.end:#x}, name={self.name}, backing_file={self.backing_file}, reference_file={self.reference_file}, reference_build_id={self.reference_build_id}, is_external={self.is_external})"

__hash__()

Returns the hash of the symbol.

Source code in libdebug/data/symbol.py
def __hash__(self: Symbol) -> int:
    """Returns the hash of the symbol."""
    return hash((self.start, self.end, self.name, self.backing_file))

__repr__()

Returns the string representation of the symbol.

Source code in libdebug/data/symbol.py
def __repr__(self: Symbol) -> str:
    """Returns the string representation of the symbol."""
    return f"Symbol(start={self.start:#x}, end={self.end:#x}, name={self.name}, backing_file={self.backing_file}, reference_file={self.reference_file}, reference_build_id={self.reference_build_id}, is_external={self.is_external})"