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]
 
__setattr__(self, name, value)
x.__setattr__('name', value) <==> x.name = value
source code
 
__getattr__(self, name) source code
 
__repr__(self)
repr(x)
source code
 
__iter__(self) source code
 
__len__(self) source code
 
__init__(self, *args)
__init__(lldb::SBProcess self) -> SBProcess __init__(lldb::SBProcess self, SBProcess rhs) -> SBProcess
source code
 
__swig_destroy__(...)
delete_SBProcess(SBProcess self)
 
__del__(self) source code
 
GetPluginName(self)
GetPluginName(SBProcess self) -> str const *
source code
 
GetShortPluginName(self)
GetShortPluginName(SBProcess self) -> str const *
source code
 
Clear(self)
Clear(SBProcess self)
source code
 
__nonzero__(self) source code
 
IsValid(self)
IsValid(SBProcess self) -> bool
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, str * 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, str const ** argv, str const ** envp, str const * stdin_path, str const * stdout_path, str const * stderr_path, str 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
 
GetState(self)
GetState(SBProcess self) -> lldb::StateType
source code
 
GetExitStatus(self)
GetExitStatus(SBProcess self) -> int
source code
 
GetExitDescription(self)
GetExitDescription(SBProcess self) -> str 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
 
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
 
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
 
UnloadImage(self, *args)
UnloadImage(SBProcess self, uint32_t image_token) -> SBError
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 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
 
__str__(self)
__str__(SBProcess self) -> PyObject *
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __sizeof__, __subclasshook__

Static Methods [hide private]
str const *
GetBroadcasterClassName() 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) -> str const *
source code
 
GetProcessFromEvent(*args)
GetProcessFromEvent(SBEvent event) -> SBProcess
source code
 
EventIsProcessEvent(*args)
EventIsProcessEvent(SBEvent event) -> bool
source code
Class Variables [hide private]
  __swig_setmethods__ = {}
  __swig_getmethods__ = {}
  eBroadcastBitStateChanged = 1
  eBroadcastBitInterrupt = 2
  eBroadcastBitSTDOUT = 4
  eBroadcastBitSTDERR = 8
  eBroadcastBitProfileData = 16
Properties [hide private]
  broadcaster
A read only property that an lldb object that represents the broadcaster (lldb.SBBroadcaster) for this process.
  exit_description
A read only property that returns an exit description as a string of this process when the process state is lldb.eStateExited.
  exit_state
A read only property that returns an exit status as an integer of this process when the process state is lldb.eStateExited.
  id
A read only property that returns the process ID as an integer.
  is_alive
A read only property that returns a boolean value that indicates if this process is currently alive.
  is_running
A read only property that returns a boolean value that indicates if this process is currently running.
  is_stopped
A read only property that returns a boolean value that indicates if this process is currently stopped.
  num_threads
A read only property that returns the number of threads in this process as an integer.
  selected_thread
A read/write property that gets/sets the currently selected thread in this process.
  state
A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eState") that represents the current state of this process (running, stopped, exited, etc.).
  target
A read only property that an lldb object that represents the target (lldb.SBTarget) that owns this process.
  thread
A read only property that returns an object that can access threads by thread index (thread = lldb.process.thread[12]).
  threads
A read only property that returns a list() of lldb.SBThread objects for this process.

Inherited from object: __class__

Method Details [hide private]

__setattr__(self, name, value)

source code 

x.__setattr__('name', value) <==> x.name = value

Overrides: object.__setattr__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__init__(self, *args)
(Constructor)

source code 

__init__(lldb::SBProcess self) -> SBProcess __init__(lldb::SBProcess self, SBProcess rhs) -> SBProcess

Overrides: object.__init__

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, str const ** argv, str const ** envp, str const * stdin_path, str const * stdout_path, 
    str const * stderr_path, str 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) # Use 'ascii' encoding as each byte of 'content' is within [0..255]. new_bytes = bytearray(content, 'ascii')

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

__str__(self)
(Informal representation operator)

source code 

__str__(SBProcess self) -> PyObject *

Overrides: object.__str__

Property Details [hide private]

broadcaster

A read only property that an lldb object that represents the broadcaster (lldb.SBBroadcaster) for this process.

Get Method:
GetBroadcaster(self) - GetBroadcaster(SBProcess self) -> SBBroadcaster

exit_description

A read only property that returns an exit description as a string of this process when the process state is lldb.eStateExited.

Get Method:
GetExitDescription(self) - GetExitDescription(SBProcess self) -> str const *

exit_state

A read only property that returns an exit status as an integer of this process when the process state is lldb.eStateExited.

Get Method:
GetExitStatus(self) - GetExitStatus(SBProcess self) -> int

id

A read only property that returns the process ID as an integer.

Get Method:
GetProcessID(self) - Returns the process ID of the process.

is_alive

A read only property that returns a boolean value that indicates if this process is currently alive.

Get Method:
__get_is_alive__(self) - Returns "True" if the process is currently alive, "False" otherwise

is_running

A read only property that returns a boolean value that indicates if this process is currently running.

Get Method:
__get_is_running__(self) - Returns "True" if the process is currently stopped, "False" otherwise

is_stopped

A read only property that returns a boolean value that indicates if this process is currently stopped.

Get Method:
__get_is_running__(self) - Returns "True" if the process is currently stopped, "False" otherwise

num_threads

A read only property that returns the number of threads in this process as an integer.

Get Method:
GetNumThreads(self) - GetNumThreads(SBProcess self) -> uint32_t

selected_thread

A read/write property that gets/sets the currently selected thread in this process. The getter returns a lldb.SBThread object and the setter takes an lldb.SBThread object.

Get Method:
GetSelectedThread(self) - Returns the currently selected thread.
Set Method:
SetSelectedThread(self, *args) - SetSelectedThread(SBProcess self, SBThread thread) -> bool

state

A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eState") that represents the current state of this process (running, stopped, exited, etc.).

Get Method:
GetState(self) - GetState(SBProcess self) -> lldb::StateType

target

A read only property that an lldb object that represents the target (lldb.SBTarget) that owns this process.

Get Method:
GetTarget(self) - GetTarget(SBProcess self) -> SBTarget

thread

A read only property that returns an object that can access threads by thread index (thread = lldb.process.thread[12]).

Get Method:
get_threads_access_object(self) - An accessor function that returns a modules_access() object which allows lazy thread access from a lldb.SBProcess object.

threads

A read only property that returns a list() of lldb.SBThread objects for this process.

Get Method:
get_process_thread_list(self) - An accessor function that returns a list() that contains all threads in a lldb.SBProcess object.