2 "Represents the process associated with the target program.
4 SBProcess supports thread iteration. For example (from test/lldbutil.py), ::
6 # ==================================================
7 # Utility functions related to Threads and Processes
8 # ==================================================
10 def get_stopped_threads(process, reason):
11 '''Returns the thread(s) with the specified stop reason in a list.
13 The list can be empty if no such thread exists.
17 if t.GetStopReason() == reason:
23 %feature
("docstring", "
24 Writes data into the current process's stdin. API client specifies a Python
25 string as the only argument."
26 ) lldb
::SBProcess
::PutSTDIN
;
28 %feature
("docstring", "
29 Reads data from the current process's stdout stream. API client specifies
30 the size of the buffer to read data into. It returns the byte buffer in a
32 ) lldb
::SBProcess
::GetSTDOUT
;
34 %feature
("docstring", "
35 Reads data from the current process's stderr stream. API client specifies
36 the size of the buffer to read data into. It returns the byte buffer in a
38 ) lldb
::SBProcess
::GetSTDERR
;
40 %feature
("docstring", "
41 Remote connection related functions. These will fail if the
42 process is not in eStateConnected. They are intended for use
43 when connecting to an externally managed debugserver instance."
44 ) lldb
::SBProcess
::RemoteAttachToProcessWithID
;
47 "See SBTarget.Launch for argument description and usage."
48 ) lldb
::SBProcess
::RemoteLaunch
;
50 %feature
("docstring", "
51 Returns the INDEX'th thread from the list of current threads. The index
52 of a thread is only valid for the current stop. For a persistent thread
53 identifier use either the thread ID or the IndexID. See help on SBThread
55 ) lldb
::SBProcess
::GetThreadAtIndex
;
57 %feature
("docstring", "
58 Returns the thread with the given thread ID."
59 ) lldb
::SBProcess
::GetThreadByID
;
61 %feature
("docstring", "
62 Returns the thread with the given thread IndexID."
63 ) lldb
::SBProcess
::GetThreadByIndexID
;
65 %feature
("docstring", "
66 Returns the currently selected thread."
67 ) lldb
::SBProcess
::GetSelectedThread
;
69 %feature
("docstring", "
70 Lazily create a thread on demand through the current OperatingSystem plug-in, if the current OperatingSystem plug-in supports it."
71 ) lldb
::SBProcess
::CreateOSPluginThread
;
73 %feature
("docstring", "
74 Returns the process ID of the process."
75 ) lldb
::SBProcess
::GetProcessID
;
77 %feature
("docstring", "
78 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."
79 ) lldb
::SBProcess
::GetUniqueID
;
81 %feature
("docstring", "
82 Kills the process and shuts down all threads that were spawned to
83 track and monitor process."
84 ) lldb
::SBProcess
::Destroy
;
86 %feature
("docstring", "Same as Destroy(self).") lldb
::SBProcess
::Kill
;
88 %feature
("docstring", "Sends the process a unix signal.") lldb
::SBProcess
::Signal
;
90 %feature
("docstring", "
91 Returns a stop id that will increase every time the process executes. If
92 include_expression_stops is true, then stops caused by expression evaluation
93 will cause the returned value to increase, otherwise the counter returned will
94 only increase when execution is continued explicitly by the user. Note, the value
95 will always increase, but may increase by more than one per stop."
96 ) lldb
::SBProcess
::GetStopID
;
98 %feature
("docstring", "
99 Reads memory from the current process's address space and removes any
100 traps that may have been inserted into the memory. It returns the byte
101 buffer in a Python string. Example: ::
103 # Read 4 bytes from address 'addr' and assume error.Success() is True.
104 content = process.ReadMemory(addr, 4, error)
105 new_bytes = bytearray(content)"
106 ) lldb
::SBProcess
::ReadMemory
;
108 %feature
("docstring", "
109 Writes memory to the current process's address space and maintains any
110 traps that might be present due to software breakpoints. Example: ::
112 # Create a Python string from the byte array.
113 new_value = str(bytes)
114 result = process.WriteMemory(addr, new_value, error)
115 if not error.Success() or result != len(bytes):
116 print('SBProcess.WriteMemory() failed!')"
117 ) lldb
::SBProcess
::WriteMemory
;
119 %feature
("docstring", "
120 Reads a NUL terminated C string from the current process's address space.
121 It returns a python string of the exact length, or truncates the string if
122 the maximum character limit is reached. Example: ::
124 # Read a C string of at most 256 bytes from address '0x1000'
125 error = lldb.SBError()
126 cstring = process.ReadCStringFromMemory(0x1000, 256, error)
128 print('cstring: ', cstring)
130 print('error: ', error)"
131 ) lldb
::SBProcess
::ReadCStringFromMemory
;
134 %feature
("docstring", "
135 Reads an unsigned integer from memory given a byte size and an address.
136 Returns the unsigned integer that was read. Example: ::
138 # Read a 4 byte unsigned integer from address 0x1000
139 error = lldb.SBError()
140 uint = ReadUnsignedFromMemory(0x1000, 4, error)
142 print('integer: %u' % uint)
144 print('error: ', error)"
145 ) lldb
::SBProcess
::ReadUnsignedFromMemory
;
148 %feature
("docstring", "
149 Reads a pointer from memory from an address and returns the value. Example: ::
151 # Read a pointer from address 0x1000
152 error = lldb.SBError()
153 ptr = ReadPointerFromMemory(0x1000, error)
155 print('pointer: 0x%x' % ptr)
157 print('error: ', error)"
158 ) lldb
::SBProcess
::ReadPointerFromMemory
;
161 %feature
("docstring", "
162 Returns the implementation object of the process plugin if available. None
164 ) lldb
::SBProcess
::GetScriptedImplementation
;
166 %feature
("docstring", "
167 Returns the process' extended crash information."
168 ) lldb
::SBProcess
::GetExtendedCrashInformation
;
170 %feature
("docstring", "
171 Load the library whose filename is given by image_spec looking in all the
172 paths supplied in the paths argument. If successful, return a token that
173 can be passed to UnloadImage and fill loaded_path with the path that was
174 successfully loaded. On failure, return
175 lldb.LLDB_INVALID_IMAGE_TOKEN."
176 ) lldb
::SBProcess
::LoadImageUsingPaths
;
178 %feature
("docstring", "
179 Return the number of different thread-origin extended backtraces
180 this process can support as a uint32_t.
181 When the process is stopped and you have an SBThread, lldb may be
182 able to show a backtrace of when that thread was originally created,
183 or the work item was enqueued to it (in the case of a libdispatch
185 ) lldb
::SBProcess
::GetNumExtendedBacktraceTypes
;
187 %feature
("docstring", "
188 Takes an index argument, returns the name of one of the thread-origin
189 extended backtrace methods as a str."
190 ) lldb
::SBProcess
::GetExtendedBacktraceTypeAtIndex
;
192 %feature
("docstring", "
193 Get information about the process.
194 Valid process info will only be returned when the process is alive,
195 use IsValid() to check if the info returned is valid. ::
197 process_info = process.GetProcessInfo()
198 if process_info.IsValid():
199 process_info.GetProcessID()"
200 ) lldb
::SBProcess
::GetProcessInfo
;
202 %feature
("docstring", "
203 Get the current address mask in this Process of a given type.
204 There are lldb.eAddressMaskTypeCode and lldb.eAddressMaskTypeData address
205 masks, and on most Targets, the the Data address mask is more general
206 because there are no alignment restrictions, as there can be with Code
208 lldb.eAddressMaskTypeAny may be used to get the most general mask.
209 The bits which are not used for addressing are set to 1 in the returned
211 In an unusual environment with different address masks for high and low
212 memory, this may also be specified. This is uncommon, default is
213 lldb.eAddressMaskRangeLow."
214 ) lldb
::SBProcess
::GetAddressMask
;
216 %feature
("docstring", "
217 Set the current address mask in this Process for a given type,
218 lldb.eAddressMaskTypeCode or lldb.eAddressMaskTypeData. Bits that are not
219 used for addressing should be set to 1 in the mask.
220 When setting all masks, lldb.eAddressMaskTypeAll may be specified.
221 In an unusual environment with different address masks for high and low
222 memory, this may also be specified. This is uncommon, default is
223 lldb.eAddressMaskRangeLow."
224 ) lldb
::SBProcess
::SetAddressMask
;
226 %feature
("docstring", "
227 Set the number of low bits relevant for addressing in this Process
228 for a given type, lldb.eAddressMaskTypeCode or lldb.eAddressMaskTypeData.
229 When setting all masks, lldb.eAddressMaskTypeAll may be specified.
230 In an unusual environment with different address masks for high and low
231 memory, the address range may also be specified. This is uncommon,
232 default is lldb.eAddressMaskRangeLow."
233 ) lldb
::SBProcess
::SetAddressableBits
;
235 %feature
("docstring", "
236 Given a virtual address, clear the bits that are not used for addressing
237 (and may be used for metadata, memory tagging, point authentication, etc).
238 By default the most general mask, lldb.eAddressMaskTypeAny is used to
239 process the address, but lldb.eAddressMaskTypeData and
240 lldb.eAddressMaskTypeCode may be specified if the type of address is known."
241 ) lldb
::SBProcess
::FixAddress
;
243 %feature
("docstring", "
244 Allocates a block of memory within the process, with size and
245 access permissions specified in the arguments. The permissions
246 argument is an or-combination of zero or more of
247 lldb.ePermissionsWritable, lldb.ePermissionsReadable, and
248 lldb.ePermissionsExecutable. Returns the address
249 of the allocated buffer in the process, or
250 lldb.LLDB_INVALID_ADDRESS if the allocation failed."
251 ) lldb
::SBProcess
::AllocateMemory
;
253 %feature
("docstring", "Get default process broadcaster class name (lldb.process)."
254 ) lldb
::SBProcess
::GetBroadcasterClass
;
257 %feature
("docstring", "
258 Deallocates the block of memory (previously allocated using
259 AllocateMemory) given in the argument."
260 ) lldb
::SBProcess
::DeallocateMemory
;