OperatingSystem#

class lldb.plugins.operating_system.OperatingSystem(process)#

Class that provides data for an instance of a LLDB ā€˜OperatingSystemPythonā€™ plug-in class.

thread_info = {
    "tid": tid,
    "name": "four",
    "queue": "queue4",
    "state": "stopped",
    "stop_reason": "none",
    "core" : 2
}
  • tid : thread ID (mandatory)

  • name : thread name (optional key/value pair)

  • queue : thread dispatch queue name (optional key/value pair)

  • state : thread state (mandatory, set to ā€˜stoppedā€™ for now)

  • core : the index of the core (lldb) thread that this OS Thread should shadow

  • stop_reasonthread stop reason. (mandatory, usually set to ā€˜noneā€™)

    Possible values include: - ā€˜breakpointā€™: thread is stopped at a breakpoint - ā€˜noneā€™: thread is stopped because the process is stopped - ā€˜traceā€™: thread is stopped after single stepping The usual value for this while threads are in memory is ā€˜noneā€™

  • register_data_addrthe address of the register data in memory (optional key/value pair)

    Specifying this key/value pair for a thread will avoid a call to get_register_data() and can be used when your registers are in a thread context structure that is contiguous in memory. Donā€™t specify this if your register layout in memory doesnā€™t match the layout described by the dictionary returned from a call to the get_register_info() method.

Methods Summary

create_thread(tid, context)

Lazily create an operating system thread using a thread information dictionary and an optional operating system thread context address.

get_register_context()

Get the scripted thread register context

get_register_data(tid)

Get the operating system thread register context for given a thread id.

get_stop_reason()

Get the dictionary describing the stop reason type with some data.

get_thread_info()

Get the list of operating system threads.

Methods Documentation

create_thread(tid, context)#

Lazily create an operating system thread using a thread information dictionary and an optional operating system thread context address. This method is called manually, using the SBAPI lldb.SBProcess.CreateOSPluginThread affordance.

Args:

tid (int): Thread ID to get thread_info dictionary for. context (int): Address of the operating system thread struct.

Returns:

Dict: The thread_info dictionary containing the various information for lldb to create a Thread object and add it to the process thread list.

get_register_context()#

Get the scripted thread register context

Returns:

str: A byte representing all registerā€™s value.

abstract get_register_data(tid)#

Get the operating system thread register context for given a thread id. This method is called when unwinding the stack of one of the operating system threads.

Args:

tid (int): Thread ID to get register context for.

Returns:

str: A byte representing all registerā€™s value.

get_stop_reason()#
Get the dictionary describing the stop reason type with some data.

This method is optional.

Returns:

Dict: The dictionary holding the stop reason type and the possibly the stop reason data.

abstract get_thread_info()#

Get the list of operating system threads. This method gets called automatically every time the process stops and it needs to update its thread list.

Returns:
List[thread_info]: A list of os_thread dictionaries

containing at least for each entry, the thread id, itā€™s name, queue, state, stop reason. It can also contain a register_data_addr. The list can be empty.