1 %feature("docstring", 2 "Represents the process associated with the target program. 3 4 SBProcess supports thread iteration. For example (from test/lldbutil.py), :: 5 6 # ================================================== 7 # Utility functions related to Threads and Processes 8 # ================================================== 9 10 def get_stopped_threads(process, reason): 11 '''Returns the thread(s) with the specified stop reason in a list. 12 13 The list can be empty if no such thread exists. 14 ''' 15 threads = [] 16 for t in process: 17 if t.GetStopReason() == reason: 18 threads.append(t) 19 return threads 20 " 21 ) lldb::SBProcess; 22 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; 27 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 31 Python string." 32 ) lldb::SBProcess::GetSTDOUT; 33 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 37 Python string." 38 ) lldb::SBProcess::GetSTDERR; 39 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; 45 46 %feature("docstring", 47 "See SBTarget.Launch for argument description and usage." 48 ) lldb::SBProcess::RemoteLaunch; 49 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 54 for more details." 55 ) lldb::SBProcess::GetThreadAtIndex; 56 57 %feature("docstring", " 58 Returns the thread with the given thread ID." 59 ) lldb::SBProcess::GetThreadByID; 60 61 %feature("docstring", " 62 Returns the thread with the given thread IndexID." 63 ) lldb::SBProcess::GetThreadByIndexID; 64 65 %feature("docstring", " 66 Returns the currently selected thread." 67 ) lldb::SBProcess::GetSelectedThread; 68 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; 72 73 %feature("docstring", " 74 Returns the process ID of the process." 75 ) lldb::SBProcess::GetProcessID; 76 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; 80 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; 85 86 %feature("docstring", "Same as Destroy(self).") lldb::SBProcess::Kill; 87 88 %feature("docstring", "Sends the process a unix signal.") lldb::SBProcess::Signal; 89 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; 97 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: :: 102 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; 107 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: :: 111 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; 118 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: :: 123 124 # Read a C string of at most 256 bytes from address '0x1000' 125 error = lldb.SBError() 126 cstring = process.ReadCStringFromMemory(0x1000, 256, error) 127 if error.Success(): 128 print('cstring: ', cstring) 129 else 130 print('error: ', error)" 131 ) lldb::SBProcess::ReadCStringFromMemory; 132 133 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: :: 137 138 # Read a 4 byte unsigned integer from address 0x1000 139 error = lldb.SBError() 140 uint = ReadUnsignedFromMemory(0x1000, 4, error) 141 if error.Success(): 142 print('integer: %u' % uint) 143 else 144 print('error: ', error)" 145 ) lldb::SBProcess::ReadUnsignedFromMemory; 146 147 148 %feature("docstring", " 149 Reads a pointer from memory from an address and returns the value. Example: :: 150 151 # Read a pointer from address 0x1000 152 error = lldb.SBError() 153 ptr = ReadPointerFromMemory(0x1000, error) 154 if error.Success(): 155 print('pointer: 0x%x' % ptr) 156 else 157 print('error: ', error)" 158 ) lldb::SBProcess::ReadPointerFromMemory; 159 160 161 %feature("docstring", " 162 Returns the implementation object of the process plugin if available. None 163 otherwise." 164 ) lldb::SBProcess::GetScriptedImplementation; 165 166 %feature("docstring", " 167 Returns the process' extended crash information." 168 ) lldb::SBProcess::GetExtendedCrashInformation; 169 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; 177 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 184 queue)." 185 ) lldb::SBProcess::GetNumExtendedBacktraceTypes; 186 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; 191 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. :: 196 197 process_info = process.GetProcessInfo() 198 if process_info.IsValid(): 199 process_info.GetProcessID()" 200 ) lldb::SBProcess::GetProcessInfo; 201 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 207 addresses. 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 210 mask. 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; 215 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; 225 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; 234 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; 242 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; 252 253 %feature("docstring", "Get default process broadcaster class name (lldb.process)." 254 ) lldb::SBProcess::GetBroadcasterClass; 255 256 257 %feature("docstring", " 258 Deallocates the block of memory (previously allocated using 259 AllocateMemory) given in the argument." 260 ) lldb::SBProcess::DeallocateMemory; 261