Skip to content

libdebug.snapshots.registers.snapshot_registers

SnapshotRegisters

Bases: Registers

Class that holds the state of the architectural-dependent registers of a snapshot.

Source code in libdebug/snapshots/registers/snapshot_registers.py
class SnapshotRegisters(Registers):
    """Class that holds the state of the architectural-dependent registers of a snapshot."""

    def __init__(
        self: SnapshotRegisters,
        thread_id: int,
        generic_regs: list[str],
        special_regs: list[str],
        vec_fp_regs: list[str],
    ) -> None:
        """Initializes the Registers object.

        Args:
            thread_id (int): The thread ID.
            generic_regs (list[str]): The list of registers to include in the repr.
            special_regs (list[str]): The list of special registers to include in the repr.
            vec_fp_regs (list[str]): The list of vector and floating point registers to include in the repr
        """
        self._thread_id = thread_id
        self._generic_regs = generic_regs
        self._special_regs = special_regs
        self._vec_fp_regs = vec_fp_regs

    def filter(self: SnapshotRegisters, value: float) -> list[str]:
        """Filters the registers by value.

        Args:
            value (float): The value to search for.

        Returns:
            list[str]: A list of names of the registers containing the value.
        """
        attributes = self.__dict__

        return [attr for attr in attributes if getattr(self, attr) == value]

__init__(thread_id, generic_regs, special_regs, vec_fp_regs)

Initializes the Registers object.

Parameters:

Name Type Description Default
thread_id int

The thread ID.

required
generic_regs list[str]

The list of registers to include in the repr.

required
special_regs list[str]

The list of special registers to include in the repr.

required
vec_fp_regs list[str]

The list of vector and floating point registers to include in the repr

required
Source code in libdebug/snapshots/registers/snapshot_registers.py
def __init__(
    self: SnapshotRegisters,
    thread_id: int,
    generic_regs: list[str],
    special_regs: list[str],
    vec_fp_regs: list[str],
) -> None:
    """Initializes the Registers object.

    Args:
        thread_id (int): The thread ID.
        generic_regs (list[str]): The list of registers to include in the repr.
        special_regs (list[str]): The list of special registers to include in the repr.
        vec_fp_regs (list[str]): The list of vector and floating point registers to include in the repr
    """
    self._thread_id = thread_id
    self._generic_regs = generic_regs
    self._special_regs = special_regs
    self._vec_fp_regs = vec_fp_regs

filter(value)

Filters the registers by value.

Parameters:

Name Type Description Default
value float

The value to search for.

required

Returns:

Type Description
list[str]

list[str]: A list of names of the registers containing the value.

Source code in libdebug/snapshots/registers/snapshot_registers.py
def filter(self: SnapshotRegisters, value: float) -> list[str]:
    """Filters the registers by value.

    Args:
        value (float): The value to search for.

    Returns:
        list[str]: A list of names of the registers containing the value.
    """
    attributes = self.__dict__

    return [attr for attr in attributes if getattr(self, attr) == value]