ScriptedProcess#

class lldb.plugins.scripted_process.ScriptedProcess(exe_ctx: SBExecutionContext, args: SBStructuredData)#

The base class for a scripted process.

Most of the base class methods are @abstractmethod that need to be overwritten by the inheriting class.

Attributes Summary

Methods Summary

attach(attach_info)

Simulate the scripted process attach.

create_breakpoint(addr, error)

Create a breakpoint in the scripted process from an address.

get_addressable_bits()

Get the number of bits this process uses for addressing.

get_capabilities()

Get a dictionary containing the process capabilities.

get_loaded_images()

Get the list of loaded images for the scripted process.

get_memory_region_containing_address(addr)

Get the memory region for the scripted process, containing a

get_process_id()

Get the scripted process identifier.

get_process_metadata()

Get some metadata for the scripted process.

get_scripted_thread_plugin()

Get scripted thread plugin name.

get_threads_info()

Get the dictionary describing the process' Scripted Threads.

is_alive()

Check if the scripted process is alive.

launch()

Simulate the scripted process launch.

read_memory_at_address(addr, size, error)

Get a memory buffer from the scripted process at a certain address,

resume([should_stop])

Simulate the scripted process resume.

write_memory_at_address(addr, data, error)

Write a buffer to the scripted process memory.

Attributes Documentation

addressable_bits: dict[str, int] | None = None#
capabilities: dict[str, bool] | None = None#
loaded_images: list[dict] | None = None#
memory_regions: list[SBMemoryRegionInfo] | None = None#
metadata: dict[str, Any] | None = None#
threads: dict[int, ScriptedThread] | None = None#

Methods Documentation

attach(attach_info: SBAttachInfo) → SBError#

Simulate the scripted process attach.

Parameters:
  • attach_info (lldb.SBAttachInfo) – The information related to the

  • to. (process we're attaching) –

Returns:

An SBError with error code 0.

Return type:

lldb.SBError

create_breakpoint(addr: int, error: SBError) → SBBreakpoint | bool#
Create a breakpoint in the scripted process from an address.

This is mainly used with interactive scripted process debugging.

Parameters:
  • addr (int) – Address at which the breakpoint should be set.

  • error (lldb.SBError) – Error object.

Returns:

A valid breakpoint object that was created a the specified

address. None if the breakpoint creation failed.

Return type:

SBBreakpoint

get_addressable_bits() → dict[str, int]#

Get the number of bits this process uses for addressing.

LLDB strips the remaining bits off every code and data address, the way the LC_NOTE "addrable bits" corefile note and the qHostInfo addressing_bits key do for corefiles and live processes.

This is queried before the first stop is reported, so the threads and backtraces built from that stop already have the mask applied.

Returns:

int]: A dictionary with optional “lowmem” and “highmem” keys, holding the number of bits used for addressing in low and high memory. “highmem” defaults to “lowmem” when it is missing. The dictionary can be empty, in which case no bits are stripped.

Return type:

Dict[str

get_capabilities() → dict[str, bool]#

Get a dictionary containing the process capabilities.

Returns:

bool]: The dictionary of capability, with the capability name as the key and a boolean flag as the value. The dictionary can be empty.

Return type:

Dict[str

get_loaded_images() → list[dict] | None#

Get the list of loaded images for the scripted process.

scripted_image = {
    uuid = "c6ea2b64-f77c-3d27-9528-74f507b9078b",
    path = "/usr/lib/dyld"
    load_addr = 0xbadc0ffee
}
Returns:

A list of scripted_image dictionaries

containing for each entry the library UUID or its file path and its load address. None if the list is empty.

Return type:

List[scripted_image]

get_memory_region_containing_address(addr: int) → SBMemoryRegionInfo | None#
Get the memory region for the scripted process, containing a

specific address.

Parameters:

addr (int) – Address to look for in the scripted process memory regions.

Returns:

The memory region containing the address.

None if out of bounds.

Return type:

lldb.SBMemoryRegionInfo

get_process_id() → int#

Get the scripted process identifier.

Returns:

The scripted process identifier.

Return type:

int

get_process_metadata() → dict[str, Any] | None#

Get some metadata for the scripted process.

Returns:

A dictionary containing metadata for the scripted process.

None if the process as no metadata.

Return type:

Dict

abstract get_scripted_thread_plugin() → str#

Get scripted thread plugin name.

Returns:

Name of the scripted thread plugin.

Return type:

str

get_threads_info() → dict[int, ScriptedThread]#

Get the dictionary describing the process’ Scripted Threads.

Returns:

The dictionary of threads, with the thread ID as the key and a Scripted Thread instance as the value. The dictionary can be empty.

Return type:

Dict

abstract is_alive() → bool#

Check if the scripted process is alive.

Returns:

True if scripted process is alive. False otherwise.

Return type:

bool

launch() → SBError#

Simulate the scripted process launch.

Returns:

An SBError with error code 0.

Return type:

lldb.SBError

abstract read_memory_at_address(addr: int, size: int, error: SBError) → SBData#
Get a memory buffer from the scripted process at a certain address,

of a certain size.

Parameters:
  • addr (int) – Address from which we should start reading.

  • size (int) – Size of the memory to read.

  • error (lldb.SBError) – Error object.

Returns:

An SBData buffer with the target byte size and

byte order storing the memory read.

Return type:

lldb.SBData

resume(should_stop: bool = True) → SBError#

Simulate the scripted process resume.

Parameters:
  • should_stop (bool) – If True, resume will also force the process

  • it. (state to stopped after running) –

Returns:

An SBError with error code 0.

Return type:

lldb.SBError

write_memory_at_address(addr: int, data: SBData, error: SBError) → int#

Write a buffer to the scripted process memory.

Parameters:
  • addr (int) – Address from which we should start reading.

  • data (lldb.SBData) – An SBData buffer to write to the process

  • memory. –

  • error (lldb.SBError) – Error object.

Returns:

Size of the memory to read.

Return type:

size (int)