Skip to content

proc ¤

Classes:

  • EventHandler

    The event types that make sense for us to track in the process driver aren't

  • ProcessDriver

    Drives the execution of a process, responding to its events and handling its

EventHandler ¤

The event types that make sense for us to track in the process driver aren't the same as the ones in the rest of Pwndbg, so we just expose the native events in process driver, and let the rest of the REPL deal with any complexities that might arise from the translation.

This is mostly intended to keep the complexity of generating the START and NEW_THREAD events correctly out of the process driver.

Methods:

  • created

    This function is called when a process is created or attached to.

  • suspended

    This function is called when the execution of a process is suspended.

  • resumed

    This function is called when the execution of a process is resumed.

  • exited

    This function is called when a process terminates or is detached from.

  • modules_loaded

    This function is called when a new modules have been loaded.

created ¤

created()

This function is called when a process is created or attached to.

suspended ¤

suspended()

This function is called when the execution of a process is suspended.

resumed ¤

resumed()

This function is called when the execution of a process is resumed.

exited ¤

exited()

This function is called when a process terminates or is detached from.

modules_loaded ¤

modules_loaded()

This function is called when a new modules have been loaded.

ProcessDriver ¤

ProcessDriver(event_handler: EventHandler, debug=False)

Drives the execution of a process, responding to its events and handling its I/O, and exposes a simple synchronous interface to the REPL interface.

Methods:

  • has_process

    Whether there's an active process in this driver.

  • has_connection

    Whether this driver's connected to a target. All drivers that have an

  • cancel

    Request that a currently ongoing operation be cancelled.

  • interrupt

    Interrupts the currently running process.

  • cont

    Continues execution of the process this object is driving, and returns

  • run_lldb_command

    Runs the given LLDB command and ataches I/O if necessary.

  • run_coroutine

    Runs the given coroutine and allows it to control the execution of the

  • launch

    Launches the process and handles startup events. Always stops on first

  • attach

    Attach to a process and handles startup events. Always stops on first

  • connect

    Connects to a remote proces with the given URL using the plugin with the

Attributes:

io instance-attribute ¤

io: IODriver = None

process instance-attribute ¤

process: SBProcess = None

listener instance-attribute ¤

listener: SBListener = None

debug instance-attribute ¤

debug: bool = debug

eh instance-attribute ¤

eh: EventHandler = event_handler

cancellation_requested instance-attribute ¤

cancellation_requested: bool = False

has_process ¤

has_process() -> bool

Whether there's an active process in this driver.

has_connection ¤

has_connection() -> bool

Whether this driver's connected to a target. All drivers that have an active process also must necessarily be connected.

cancel ¤

cancel() -> None

Request that a currently ongoing operation be cancelled.

interrupt ¤

interrupt() -> None

Interrupts the currently running process.

cont ¤

cont() -> None

Continues execution of the process this object is driving, and returns whenever the process stops.

run_lldb_command ¤

run_lldb_command(command: str, target: BinaryIO) -> None

Runs the given LLDB command and ataches I/O if necessary.

run_coroutine ¤

run_coroutine(coroutine: Coroutine[Any, Any, None]) -> bool

Runs the given coroutine and allows it to control the execution of the process in this driver. Returns True if the coroutine ran to completion, and False if it was cancelled.

launch ¤

launch(
    target: SBTarget,
    io: IODriver,
    env: list[str],
    args: list[str],
    working_dir: str,
) -> SBError

Launches the process and handles startup events. Always stops on first opportunity, and returns immediately after the process has stopped.

Fires the created() event.

attach ¤

attach(target: SBTarget, io: IODriver, info: SBAttachInfo) -> SBError

Attach to a process and handles startup events. Always stops on first opportunity, and returns immediately after the process has stopped.

Fires the created() event.

connect ¤

connect(target: SBTarget, io: IODriver, url: str, plugin: str) -> SBError

Connects to a remote proces with the given URL using the plugin with the given name. This might cause the process to launch in some implementations, or it might require a call to launch(), in implementations that require a further call to SBProcess::RemoteLaunch().

Fires the created() event if a process is automatically attached to or launched when a connection succeeds.