ScriptedProcess#

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

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_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

capabilities = None#
loaded_images = None#
memory_regions = None#
metadata = None#
threads = None#

Methods Documentation

attach(attach_info)#

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, error)#
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_capabilities()#

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()#

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)#
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()#

Get the scripted process identifier.

Returns:

The scripted process identifier.

Return type:

int

get_process_metadata()#

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()#

Get scripted thread plugin name.

Returns:

Name of the scripted thread plugin.

Return type:

str

get_threads_info()#

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()#

Check if the scripted process is alive.

Returns:

True if scripted process is alive. False otherwise.

Return type:

bool

launch()#

Simulate the scripted process launch.

Returns:

An SBError with error code 0.

Return type:

lldb.SBError

abstract read_memory_at_address(addr, size, error)#
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=True)#

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, data, error)#

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)