Skip to content

libdebug.data.gdb_resume_event

GdbResumeEvent

This class handles the actions needed to resume the debugging session, after returning from GDB.

Source code in libdebug/data/gdb_resume_event.py
class GdbResumeEvent:
    """This class handles the actions needed to resume the debugging session, after returning from GDB."""

    def __init__(
        self: GdbResumeEvent,
        internal_debugger: InternalDebugger,
        lambda_function: callable[[], None],
    ) -> None:
        """Initializes the GdbResumeEvent.

        Args:
            internal_debugger (InternalDebugger): The internal debugger instance.
            lambda_function (callable[[], None]): The blocking lambda function to wait on.
        """
        self._internal_debugger = internal_debugger
        self._lambda_function = lambda_function
        self._joined = False

    def join(self: GdbResumeEvent) -> None:
        """Resumes the debugging session, blocking the script until GDB terminate and libdebug reattaches."""
        if self._joined:
            raise RuntimeError("GdbResumeEvent already joined")

        self._lambda_function()
        self._internal_debugger._resume_from_gdb()
        self._joined = True

__init__(internal_debugger, lambda_function)

Initializes the GdbResumeEvent.

Parameters:

Name Type Description Default
internal_debugger InternalDebugger

The internal debugger instance.

required
lambda_function callable[[], None]

The blocking lambda function to wait on.

required
Source code in libdebug/data/gdb_resume_event.py
def __init__(
    self: GdbResumeEvent,
    internal_debugger: InternalDebugger,
    lambda_function: callable[[], None],
) -> None:
    """Initializes the GdbResumeEvent.

    Args:
        internal_debugger (InternalDebugger): The internal debugger instance.
        lambda_function (callable[[], None]): The blocking lambda function to wait on.
    """
    self._internal_debugger = internal_debugger
    self._lambda_function = lambda_function
    self._joined = False

join()

Resumes the debugging session, blocking the script until GDB terminate and libdebug reattaches.

Source code in libdebug/data/gdb_resume_event.py
def join(self: GdbResumeEvent) -> None:
    """Resumes the debugging session, blocking the script until GDB terminate and libdebug reattaches."""
    if self._joined:
        raise RuntimeError("GdbResumeEvent already joined")

    self._lambda_function()
    self._internal_debugger._resume_from_gdb()
    self._joined = True