Package lldb :: Class SBProcess
[hide private]
[frames] | no frames]

Class SBProcess

source code



Represents the process associated with the target program.

SBProcess supports thread iteration. For example (from test/lldbutil.py),

# ==================================================
# Utility functions related to Threads and Processes
# ==================================================

def get_stopped_threads(process, reason):
    '''Returns the thread(s) with the specified stop reason in a list.

    The list can be empty if no such thread exists.
    '''
    threads = []
    for t in process:
        if t.GetStopReason() == reason:
            threads.append(t)
    return threads

...

Nested Classes [hide private]
  threads_access
A helper object that will lazily hand out thread for a process when supplied an index.
Instance Methods [hide private]
 
__repr__(self) source code
 
__init__(self, *args)
__init__(lldb::SBProcess self) -> SBProcess __init__(lldb::SBProcess self, SBProcess rhs) -> SBProcess
source code
char const *
GetBroadcasterClassName() source code
 
GetPluginName(self)
GetPluginName(SBProcess self) -> char const *
source code
 
GetShortPluginName(self)
GetShortPluginName(SBProcess self) -> char const *
source code
 
Clear(self)
Clear(SBProcess self)
source code
 
IsValid(self)
IsValid(SBProcess self) -> bool
source code
 
__nonzero__(self) source code
 
__bool__(self) source code
 
GetTarget(self)
GetTarget(SBProcess self) -> SBTarget
source code
 
GetByteOrder(self)
GetByteOrder(SBProcess self) -> lldb::ByteOrder
source code
 
PutSTDIN(self, *args)
Writes data into the current process's stdin.
source code
 
GetSTDOUT(self, *args)
Reads data from the current process's stdout stream.
source code
 
GetSTDERR(self, *args)
Reads data from the current process's stderr stream.
source code
 
GetAsyncProfileData(self, *args)
GetAsyncProfileData(SBProcess self, char * dst) -> size_t
source code
 
ReportEventState(self, *args)
ReportEventState(SBProcess self, SBEvent event, FILE * out)
source code
 
AppendEventStateReport(self, *args)
AppendEventStateReport(SBProcess self, SBEvent event, SBCommandReturnObject result)
source code
 
RemoteAttachToProcessWithID(self, *args)
RemoteAttachToProcessWithID(SBProcess self, lldb::pid_t pid, SBError error) -> bool
source code
 
RemoteLaunch(self, *args)
RemoteLaunch(SBProcess self, char const ** argv, char const ** envp, char const * stdin_path, char const * stdout_path, char const * stderr_path, char const * working_directory, uint32_t launch_flags, bool stop_at_entry, SBError error) -> bool
source code
 
GetNumThreads(self)
GetNumThreads(SBProcess self) -> uint32_t
source code
 
GetThreadAtIndex(self, *args)
Returns the INDEX'th thread from the list of current threads.
source code
 
GetThreadByID(self, *args)
Returns the thread with the given thread ID.
source code
 
GetThreadByIndexID(self, *args)
Returns the thread with the given thread IndexID.
source code
 
GetSelectedThread(self)
Returns the currently selected thread.
source code
 
CreateOSPluginThread(self, *args)
Lazily create a thread on demand through the current OperatingSystem plug-in, if the current OperatingSystem plug-in supports it.
source code
 
SetSelectedThread(self, *args)
SetSelectedThread(SBProcess self, SBThread thread) -> bool
source code
 
SetSelectedThreadByID(self, *args)
SetSelectedThreadByID(SBProcess self, lldb::tid_t tid) -> bool
source code
 
SetSelectedThreadByIndexID(self, *args)
SetSelectedThreadByIndexID(SBProcess self, uint32_t index_id) -> bool
source code
 
GetNumQueues(self)
GetNumQueues(SBProcess self) -> uint32_t
source code
 
GetQueueAtIndex(self, *args)
GetQueueAtIndex(SBProcess self, uint32_t index) -> SBQueue
source code
 
GetState(self)
GetState(SBProcess self) -> lldb::StateType
source code
 
GetExitStatus(self)
GetExitStatus(SBProcess self) -> int
source code
 
GetExitDescription(self)
GetExitDescription(SBProcess self) -> char const *
source code
 
GetProcessID(self)
Returns the process ID of the process.
source code
 
GetUniqueID(self)
Returns an integer ID that is guaranteed to be unique across all process instances.
source code
 
GetAddressByteSize(self)
GetAddressByteSize(SBProcess self) -> uint32_t
source code
 
Destroy(self)
Destroy(SBProcess self) -> SBError
source code
 
Continue(self)
Continue(SBProcess self) -> SBError
source code
 
Stop(self)
Stop(SBProcess self) -> SBError
source code
 
Kill(self)
Kill(SBProcess self) -> SBError
source code
 
Detach(self)
Detach(SBProcess self) -> SBError
source code
 
Signal(self, *args)
Signal(SBProcess self, int signal) -> SBError
source code
 
GetUnixSignals(self)
GetUnixSignals(SBProcess self) -> SBUnixSignals
source code
 
GetStopID(self, include_expression_stops=False)
GetStopID(SBProcess self, bool include_expression_stops=False) -> uint32_t GetStopID(SBProcess self) -> uint32_t
source code
 
SendAsyncInterrupt(self)
SendAsyncInterrupt(SBProcess self)
source code
 
ReadMemory(self, *args)
Reads memory from the current process's address space and removes any traps that may have been inserted into the memory.
source code
 
WriteMemory(self, *args)
Writes memory to the current process's address space and maintains any traps that might be present due to software breakpoints.
source code
 
ReadCStringFromMemory(self, *args)
Reads a NULL terminated C string from the current process's address space.
source code
 
ReadUnsignedFromMemory(self, *args)
Reads an unsigned integer from memory given a byte size and an address.
source code
 
ReadPointerFromMemory(self, *args)
Reads a pointer from memory from an address and returns the value.
source code
 
GetStateFromEvent(*args)
GetStateFromEvent(SBEvent event) -> lldb::StateType
source code
 
GetRestartedFromEvent(*args)
GetRestartedFromEvent(SBEvent event) -> bool
source code
 
GetNumRestartedReasonsFromEvent(*args)
GetNumRestartedReasonsFromEvent(SBEvent event) -> size_t
source code
 
GetRestartedReasonAtIndexFromEvent(*args)
GetRestartedReasonAtIndexFromEvent(SBEvent event, size_t idx) -> char const *
source code
 
GetProcessFromEvent(*args)
GetProcessFromEvent(SBEvent event) -> SBProcess
source code
 
GetInterruptedFromEvent(*args)
GetInterruptedFromEvent(SBEvent event) -> bool
source code
 
GetStructuredDataFromEvent(*args)
GetStructuredDataFromEvent(SBEvent event) -> SBStructuredData
source code
 
EventIsProcessEvent(*args)
EventIsProcessEvent(SBEvent event) -> bool
source code
 
EventIsStructuredDataEvent(*args)
EventIsStructuredDataEvent(SBEvent event) -> bool
source code
 
GetBroadcaster(self)
GetBroadcaster(SBProcess self) -> SBBroadcaster
source code
 
GetDescription(self, *args)
GetDescription(SBProcess self, SBStream description) -> bool
source code
 
GetNumSupportedHardwareWatchpoints(self, *args)
GetNumSupportedHardwareWatchpoints(SBProcess self, SBError error) -> uint32_t
source code
 
LoadImage(self, *args)
LoadImage(SBProcess self, SBFileSpec image_spec, SBError error) -> uint32_t
source code
 
LoadImageUsingPaths(self, *args)
Load the library whose filename is given by image_spec looking in all the paths supplied in the paths argument.
source code
 
UnloadImage(self, *args)
UnloadImage(SBProcess self, uint32_t image_token) -> SBError
source code
 
SendEventData(self, *args)
SendEventData(SBProcess self, char const * event_data) -> SBError
source code
 
GetNumExtendedBacktraceTypes(self)
Return the number of different thread-origin extended backtraces this process can support as a uint32_t.
source code
 
GetExtendedBacktraceTypeAtIndex(self, *args)
Takes an index argument, returns the name of one of the thread-origin extended backtrace methods as a str.
source code
 
GetHistoryThreads(self, *args)
GetHistoryThreads(SBProcess self, lldb::addr_t addr) -> SBThreadCollection
source code
 
IsInstrumentationRuntimePresent(self, *args)
IsInstrumentationRuntimePresent(SBProcess self, lldb::InstrumentationRuntimeType type) -> bool
source code
 
SaveCore(self, *args)
SaveCore(SBProcess self, char const * file_name) -> SBError
source code
 
StartTrace(self, *args)
StartTrace(SBProcess self, SBTraceOptions options, SBError error) -> SBTrace
source code
 
GetMemoryRegionInfo(self, *args)
GetMemoryRegionInfo(SBProcess self, lldb::addr_t load_addr, SBMemoryRegionInfo region_info) -> SBError
source code
 
GetMemoryRegions(self)
GetMemoryRegions(SBProcess self) -> SBMemoryRegionInfoList
source code
 
GetProcessInfo(self)
Get information about the process.
source code
 
__get_is_alive__(self)
Returns "True" if the process is currently alive, "False" otherwise
source code
 
__get_is_running__(self)
Returns "True" if the process is currently running, "False" otherwise
source code
 
__get_is_stopped__(self)
Returns "True" if the process is currently stopped, "False" otherwise
source code
 
get_threads_access_object(self)
An accessor function that returns a modules_access() object which allows lazy thread access from a lldb.SBProcess object.
source code
 
get_process_thread_list(self)
An accessor function that returns a list() that contains all threads in a lldb.SBProcess object.
source code
 
__iter__(self)
Iterate over all threads in a lldb.SBProcess object.
source code
 
__len__(self)
Return the number of threads in a lldb.SBProcess object.
source code
 
__str__(self)
__str__(SBProcess self) -> PyObject *
source code
Class Variables [hide private]
  __swig_setmethods__ = {}
  __setattr__ = lambda self, name, value:
  __swig_getmethods__ = {}
  __getattr__ = lambda self, name:
  eBroadcastBitStateChanged = _lldb.SBProcess_eBroadcastBitState...
  eBroadcastBitInterrupt = _lldb.SBProcess_eBroadcastBitInterrupt
  eBroadcastBitSTDOUT = _lldb.SBProcess_eBroadcastBitSTDOUT
  eBroadcastBitSTDERR = _lldb.SBProcess_eBroadcastBitSTDERR
  eBroadcastBitProfileData = _lldb.SBProcess_eBroadcastBitProfil...
  eBroadcastBitStructuredData = _lldb.SBProcess_eBroadcastBitStr...
  __swig_destroy__ = _lldb.delete_SBProcess
  __del__ = lambda self:
Method Details [hide private]

PutSTDIN(self, *args)

source code 

Writes data into the current process's stdin. API client specifies a Python string as the only argument.

GetSTDOUT(self, *args)

source code 

Reads data from the current process's stdout stream. API client specifies the size of the buffer to read data into. It returns the byte buffer in a Python string.

GetSTDERR(self, *args)

source code 

Reads data from the current process's stderr stream. API client specifies the size of the buffer to read data into. It returns the byte buffer in a Python string.

RemoteAttachToProcessWithID(self, *args)

source code 

RemoteAttachToProcessWithID(SBProcess self, lldb::pid_t pid, SBError error) -> bool

Remote connection related functions. These will fail if the process is not in eStateConnected. They are intended for use when connecting to an externally managed debugserver instance.

RemoteLaunch(self, *args)

source code 

RemoteLaunch(SBProcess self, char const ** argv, char const ** envp, char const * stdin_path, char const * stdout_path, 
    char const * stderr_path, char const * working_directory, uint32_t launch_flags, 
    bool stop_at_entry, SBError error) -> bool

See SBTarget.Launch for argument description and usage.

GetThreadAtIndex(self, *args)

source code 

Returns the INDEX'th thread from the list of current threads. The index of a thread is only valid for the current stop. For a persistent thread identifier use either the thread ID or the IndexID. See help on SBThread for more details.

GetUniqueID(self)

source code 

Returns an integer ID that is guaranteed to be unique across all process instances. This is not the process ID, just a unique integer for comparison and caching purposes.

Destroy(self)

source code 

Destroy(SBProcess self) -> SBError

Kills the process and shuts down all threads that were spawned to track and monitor process.

Signal(self, *args)

source code 

Signal(SBProcess self, int signal) -> SBError

Sends the process a unix signal.

GetStopID(self, include_expression_stops=False)

source code 

GetStopID(SBProcess self, bool include_expression_stops=False) -> uint32_t GetStopID(SBProcess self) -> uint32_t

Returns a stop id that will increase every time the process executes. If include_expression_stops is true, then stops caused by expression evaluation will cause the returned value to increase, otherwise the counter returned will only increase when execution is continued explicitly by the user. Note, the value will always increase, but may increase by more than one per stop.

ReadMemory(self, *args)

source code 

Reads memory from the current process's address space and removes any traps that may have been inserted into the memory. It returns the byte buffer in a Python string. Example:

# Read 4 bytes from address 'addr' and assume error.Success() is True. content = process.ReadMemory(addr, 4, error) new_bytes = bytearray(content)

WriteMemory(self, *args)

source code 

Writes memory to the current process's address space and maintains any
traps that might be present due to software breakpoints. Example:

# Create a Python string from the byte array.
new_value = str(bytes)
result = process.WriteMemory(addr, new_value, error)
if not error.Success() or result != len(bytes):
    print('SBProcess.WriteMemory() failed!')

ReadCStringFromMemory(self, *args)

source code 

Reads a NULL terminated C string from the current process's address space.
It returns a python string of the exact length, or truncates the string if
the maximum character limit is reached. Example:

# Read a C string of at most 256 bytes from address '0x1000'
error = lldb.SBError()
cstring = process.ReadCStringFromMemory(0x1000, 256, error)
if error.Success():
    print('cstring: ', cstring)
else
    print('error: ', error)

ReadUnsignedFromMemory(self, *args)

source code 

Reads an unsigned integer from memory given a byte size and an address.
Returns the unsigned integer that was read. Example:

# Read a 4 byte unsigned integer from address 0x1000
error = lldb.SBError()
uint = ReadUnsignedFromMemory(0x1000, 4, error)
if error.Success():
    print('integer: %u' % uint)
else
    print('error: ', error)

ReadPointerFromMemory(self, *args)

source code 

Reads a pointer from memory from an address and returns the value. Example:

# Read a pointer from address 0x1000
error = lldb.SBError()
ptr = ReadPointerFromMemory(0x1000, error)
if error.Success():
    print('pointer: 0x%x' % ptr)
else
    print('error: ', error)

LoadImageUsingPaths(self, *args)

source code 

Load the library whose filename is given by image_spec looking in all the paths supplied in the paths argument. If successful, return a token that can be passed to UnloadImage and fill loaded_path with the path that was successfully loaded. On failure, return lldb.LLDB_INVALID_IMAGE_TOKEN.

GetNumExtendedBacktraceTypes(self)

source code 

Return the number of different thread-origin extended backtraces this process can support as a uint32_t. When the process is stopped and you have an SBThread, lldb may be able to show a backtrace of when that thread was originally created, or the work item was enqueued to it (in the case of a libdispatch queue).

GetProcessInfo(self)

source code 

Get information about the process.
Valid process info will only be returned when the process is alive,
use IsValid() to check if the info returned is valid.

process_info = process.GetProcessInfo()
if process_info.IsValid():
    process_info.GetProcessID()


Class Variable Details [hide private]

eBroadcastBitStateChanged

Value:
_lldb.SBProcess_eBroadcastBitStateChanged

eBroadcastBitProfileData

Value:
_lldb.SBProcess_eBroadcastBitProfileData

eBroadcastBitStructuredData

Value:
_lldb.SBProcess_eBroadcastBitStructuredData