1662548c8SAlex Langford %feature("docstring", 2662548c8SAlex Langford "Represents the process associated with the target program. 3662548c8SAlex Langford 4662548c8SAlex Langford SBProcess supports thread iteration. For example (from test/lldbutil.py), :: 5662548c8SAlex Langford 6662548c8SAlex Langford # ================================================== 7662548c8SAlex Langford # Utility functions related to Threads and Processes 8662548c8SAlex Langford # ================================================== 9662548c8SAlex Langford 10662548c8SAlex Langford def get_stopped_threads(process, reason): 11662548c8SAlex Langford '''Returns the thread(s) with the specified stop reason in a list. 12662548c8SAlex Langford 13662548c8SAlex Langford The list can be empty if no such thread exists. 14662548c8SAlex Langford ''' 15662548c8SAlex Langford threads = [] 16662548c8SAlex Langford for t in process: 17662548c8SAlex Langford if t.GetStopReason() == reason: 18662548c8SAlex Langford threads.append(t) 19662548c8SAlex Langford return threads 20662548c8SAlex Langford " 21662548c8SAlex Langford ) lldb::SBProcess; 22662548c8SAlex Langford 23e35fb3fbSJason Molenda %feature("docstring", " 24662548c8SAlex Langford Writes data into the current process's stdin. API client specifies a Python 25662548c8SAlex Langford string as the only argument." 26662548c8SAlex Langford ) lldb::SBProcess::PutSTDIN; 27662548c8SAlex Langford 28e35fb3fbSJason Molenda %feature("docstring", " 29662548c8SAlex Langford Reads data from the current process's stdout stream. API client specifies 30662548c8SAlex Langford the size of the buffer to read data into. It returns the byte buffer in a 31662548c8SAlex Langford Python string." 32662548c8SAlex Langford ) lldb::SBProcess::GetSTDOUT; 33662548c8SAlex Langford 34e35fb3fbSJason Molenda %feature("docstring", " 35662548c8SAlex Langford Reads data from the current process's stderr stream. API client specifies 36662548c8SAlex Langford the size of the buffer to read data into. It returns the byte buffer in a 37662548c8SAlex Langford Python string." 38662548c8SAlex Langford ) lldb::SBProcess::GetSTDERR; 39662548c8SAlex Langford 40662548c8SAlex Langford %feature("docstring", " 41662548c8SAlex Langford Remote connection related functions. These will fail if the 42662548c8SAlex Langford process is not in eStateConnected. They are intended for use 43662548c8SAlex Langford when connecting to an externally managed debugserver instance." 44662548c8SAlex Langford ) lldb::SBProcess::RemoteAttachToProcessWithID; 45662548c8SAlex Langford 46662548c8SAlex Langford %feature("docstring", 47662548c8SAlex Langford "See SBTarget.Launch for argument description and usage." 48662548c8SAlex Langford ) lldb::SBProcess::RemoteLaunch; 49662548c8SAlex Langford 50e35fb3fbSJason Molenda %feature("docstring", " 51662548c8SAlex Langford Returns the INDEX'th thread from the list of current threads. The index 52662548c8SAlex Langford of a thread is only valid for the current stop. For a persistent thread 53662548c8SAlex Langford identifier use either the thread ID or the IndexID. See help on SBThread 54662548c8SAlex Langford for more details." 55662548c8SAlex Langford ) lldb::SBProcess::GetThreadAtIndex; 56662548c8SAlex Langford 57e35fb3fbSJason Molenda %feature("docstring", " 58662548c8SAlex Langford Returns the thread with the given thread ID." 59662548c8SAlex Langford ) lldb::SBProcess::GetThreadByID; 60662548c8SAlex Langford 61e35fb3fbSJason Molenda %feature("docstring", " 62662548c8SAlex Langford Returns the thread with the given thread IndexID." 63662548c8SAlex Langford ) lldb::SBProcess::GetThreadByIndexID; 64662548c8SAlex Langford 65e35fb3fbSJason Molenda %feature("docstring", " 66662548c8SAlex Langford Returns the currently selected thread." 67662548c8SAlex Langford ) lldb::SBProcess::GetSelectedThread; 68662548c8SAlex Langford 69e35fb3fbSJason Molenda %feature("docstring", " 70662548c8SAlex Langford Lazily create a thread on demand through the current OperatingSystem plug-in, if the current OperatingSystem plug-in supports it." 71662548c8SAlex Langford ) lldb::SBProcess::CreateOSPluginThread; 72662548c8SAlex Langford 73e35fb3fbSJason Molenda %feature("docstring", " 74662548c8SAlex Langford Returns the process ID of the process." 75662548c8SAlex Langford ) lldb::SBProcess::GetProcessID; 76662548c8SAlex Langford 77e35fb3fbSJason Molenda %feature("docstring", " 78662548c8SAlex Langford 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." 79662548c8SAlex Langford ) lldb::SBProcess::GetUniqueID; 80662548c8SAlex Langford 81662548c8SAlex Langford %feature("docstring", " 82662548c8SAlex Langford Kills the process and shuts down all threads that were spawned to 83662548c8SAlex Langford track and monitor process." 84662548c8SAlex Langford ) lldb::SBProcess::Destroy; 85662548c8SAlex Langford 86662548c8SAlex Langford %feature("docstring", "Same as Destroy(self).") lldb::SBProcess::Kill; 87662548c8SAlex Langford 88662548c8SAlex Langford %feature("docstring", "Sends the process a unix signal.") lldb::SBProcess::Signal; 89662548c8SAlex Langford 90662548c8SAlex Langford %feature("docstring", " 91662548c8SAlex Langford Returns a stop id that will increase every time the process executes. If 92662548c8SAlex Langford include_expression_stops is true, then stops caused by expression evaluation 93662548c8SAlex Langford will cause the returned value to increase, otherwise the counter returned will 94662548c8SAlex Langford only increase when execution is continued explicitly by the user. Note, the value 95662548c8SAlex Langford will always increase, but may increase by more than one per stop." 96662548c8SAlex Langford ) lldb::SBProcess::GetStopID; 97662548c8SAlex Langford 98e35fb3fbSJason Molenda %feature("docstring", " 99662548c8SAlex Langford Reads memory from the current process's address space and removes any 100662548c8SAlex Langford traps that may have been inserted into the memory. It returns the byte 101662548c8SAlex Langford buffer in a Python string. Example: :: 102662548c8SAlex Langford 103662548c8SAlex Langford # Read 4 bytes from address 'addr' and assume error.Success() is True. 104662548c8SAlex Langford content = process.ReadMemory(addr, 4, error) 105662548c8SAlex Langford new_bytes = bytearray(content)" 106662548c8SAlex Langford ) lldb::SBProcess::ReadMemory; 107662548c8SAlex Langford 108e35fb3fbSJason Molenda %feature("docstring", " 109662548c8SAlex Langford Writes memory to the current process's address space and maintains any 110662548c8SAlex Langford traps that might be present due to software breakpoints. Example: :: 111662548c8SAlex Langford 112662548c8SAlex Langford # Create a Python string from the byte array. 113662548c8SAlex Langford new_value = str(bytes) 114662548c8SAlex Langford result = process.WriteMemory(addr, new_value, error) 115662548c8SAlex Langford if not error.Success() or result != len(bytes): 116662548c8SAlex Langford print('SBProcess.WriteMemory() failed!')" 117662548c8SAlex Langford ) lldb::SBProcess::WriteMemory; 118662548c8SAlex Langford 119e35fb3fbSJason Molenda %feature("docstring", " 120e35fb3fbSJason Molenda Reads a NUL terminated C string from the current process's address space. 121662548c8SAlex Langford It returns a python string of the exact length, or truncates the string if 122662548c8SAlex Langford the maximum character limit is reached. Example: :: 123662548c8SAlex Langford 124662548c8SAlex Langford # Read a C string of at most 256 bytes from address '0x1000' 125662548c8SAlex Langford error = lldb.SBError() 126662548c8SAlex Langford cstring = process.ReadCStringFromMemory(0x1000, 256, error) 127662548c8SAlex Langford if error.Success(): 128662548c8SAlex Langford print('cstring: ', cstring) 129662548c8SAlex Langford else 130662548c8SAlex Langford print('error: ', error)" 131662548c8SAlex Langford ) lldb::SBProcess::ReadCStringFromMemory; 132662548c8SAlex Langford 133662548c8SAlex Langford 134e35fb3fbSJason Molenda %feature("docstring", " 135662548c8SAlex Langford Reads an unsigned integer from memory given a byte size and an address. 136662548c8SAlex Langford Returns the unsigned integer that was read. Example: :: 137662548c8SAlex Langford 138662548c8SAlex Langford # Read a 4 byte unsigned integer from address 0x1000 139662548c8SAlex Langford error = lldb.SBError() 140662548c8SAlex Langford uint = ReadUnsignedFromMemory(0x1000, 4, error) 141662548c8SAlex Langford if error.Success(): 142662548c8SAlex Langford print('integer: %u' % uint) 143662548c8SAlex Langford else 144662548c8SAlex Langford print('error: ', error)" 145662548c8SAlex Langford ) lldb::SBProcess::ReadUnsignedFromMemory; 146662548c8SAlex Langford 147662548c8SAlex Langford 148e35fb3fbSJason Molenda %feature("docstring", " 149662548c8SAlex Langford Reads a pointer from memory from an address and returns the value. Example: :: 150662548c8SAlex Langford 151662548c8SAlex Langford # Read a pointer from address 0x1000 152662548c8SAlex Langford error = lldb.SBError() 153662548c8SAlex Langford ptr = ReadPointerFromMemory(0x1000, error) 154662548c8SAlex Langford if error.Success(): 155662548c8SAlex Langford print('pointer: 0x%x' % ptr) 156662548c8SAlex Langford else 157662548c8SAlex Langford print('error: ', error)" 158662548c8SAlex Langford ) lldb::SBProcess::ReadPointerFromMemory; 159662548c8SAlex Langford 160662548c8SAlex Langford 161e35fb3fbSJason Molenda %feature("docstring", " 162662548c8SAlex Langford Returns the implementation object of the process plugin if available. None 163662548c8SAlex Langford otherwise." 164662548c8SAlex Langford ) lldb::SBProcess::GetScriptedImplementation; 165662548c8SAlex Langford 166e35fb3fbSJason Molenda %feature("docstring", " 167662548c8SAlex Langford Returns the process' extended crash information." 168662548c8SAlex Langford ) lldb::SBProcess::GetExtendedCrashInformation; 169662548c8SAlex Langford 170e35fb3fbSJason Molenda %feature("docstring", " 171662548c8SAlex Langford Load the library whose filename is given by image_spec looking in all the 172662548c8SAlex Langford paths supplied in the paths argument. If successful, return a token that 173662548c8SAlex Langford can be passed to UnloadImage and fill loaded_path with the path that was 174662548c8SAlex Langford successfully loaded. On failure, return 175662548c8SAlex Langford lldb.LLDB_INVALID_IMAGE_TOKEN." 176662548c8SAlex Langford ) lldb::SBProcess::LoadImageUsingPaths; 177662548c8SAlex Langford 178e35fb3fbSJason Molenda %feature("docstring", " 179662548c8SAlex Langford Return the number of different thread-origin extended backtraces 180662548c8SAlex Langford this process can support as a uint32_t. 181662548c8SAlex Langford When the process is stopped and you have an SBThread, lldb may be 182662548c8SAlex Langford able to show a backtrace of when that thread was originally created, 183662548c8SAlex Langford or the work item was enqueued to it (in the case of a libdispatch 184662548c8SAlex Langford queue)." 185662548c8SAlex Langford ) lldb::SBProcess::GetNumExtendedBacktraceTypes; 186662548c8SAlex Langford 187e35fb3fbSJason Molenda %feature("docstring", " 188662548c8SAlex Langford Takes an index argument, returns the name of one of the thread-origin 189662548c8SAlex Langford extended backtrace methods as a str." 190662548c8SAlex Langford ) lldb::SBProcess::GetExtendedBacktraceTypeAtIndex; 191662548c8SAlex Langford 192e35fb3fbSJason Molenda %feature("docstring", " 193662548c8SAlex Langford Get information about the process. 194662548c8SAlex Langford Valid process info will only be returned when the process is alive, 195662548c8SAlex Langford use IsValid() to check if the info returned is valid. :: 196662548c8SAlex Langford 197662548c8SAlex Langford process_info = process.GetProcessInfo() 198662548c8SAlex Langford if process_info.IsValid(): 199662548c8SAlex Langford process_info.GetProcessID()" 200662548c8SAlex Langford ) lldb::SBProcess::GetProcessInfo; 201662548c8SAlex Langford 202e35fb3fbSJason Molenda %feature("docstring", " 203*41dc04e5SJason Molenda Get the current address mask in this Process of a given type. 204*41dc04e5SJason Molenda There are lldb.eAddressMaskTypeCode and lldb.eAddressMaskTypeData address 205*41dc04e5SJason Molenda masks, and on most Targets, the the Data address mask is more general 206*41dc04e5SJason Molenda because there are no alignment restrictions, as there can be with Code 207*41dc04e5SJason Molenda addresses. 208*41dc04e5SJason Molenda lldb.eAddressMaskTypeAny may be used to get the most general mask. 209*41dc04e5SJason Molenda The bits which are not used for addressing are set to 1 in the returned 210*41dc04e5SJason Molenda mask. 211*41dc04e5SJason Molenda In an unusual environment with different address masks for high and low 212*41dc04e5SJason Molenda memory, this may also be specified. This is uncommon, default is 213*41dc04e5SJason Molenda lldb.eAddressMaskRangeLow." 214*41dc04e5SJason Molenda ) lldb::SBProcess::GetAddressMask; 215*41dc04e5SJason Molenda 216*41dc04e5SJason Molenda %feature("docstring", " 217*41dc04e5SJason Molenda Set the current address mask in this Process for a given type, 218*41dc04e5SJason Molenda lldb.eAddressMaskTypeCode or lldb.eAddressMaskTypeData. Bits that are not 219*41dc04e5SJason Molenda used for addressing should be set to 1 in the mask. 220*41dc04e5SJason Molenda When setting all masks, lldb.eAddressMaskTypeAll may be specified. 221*41dc04e5SJason Molenda In an unusual environment with different address masks for high and low 222*41dc04e5SJason Molenda memory, this may also be specified. This is uncommon, default is 223*41dc04e5SJason Molenda lldb.eAddressMaskRangeLow." 224*41dc04e5SJason Molenda ) lldb::SBProcess::SetAddressMask; 225*41dc04e5SJason Molenda 226*41dc04e5SJason Molenda %feature("docstring", " 227*41dc04e5SJason Molenda Set the number of low bits relevant for addressing in this Process 228*41dc04e5SJason Molenda for a given type, lldb.eAddressMaskTypeCode or lldb.eAddressMaskTypeData. 229*41dc04e5SJason Molenda When setting all masks, lldb.eAddressMaskTypeAll may be specified. 230*41dc04e5SJason Molenda In an unusual environment with different address masks for high and low 231*41dc04e5SJason Molenda memory, the address range may also be specified. This is uncommon, 232*41dc04e5SJason Molenda default is lldb.eAddressMaskRangeLow." 233*41dc04e5SJason Molenda ) lldb::SBProcess::SetAddressableBits; 234*41dc04e5SJason Molenda 235*41dc04e5SJason Molenda %feature("docstring", " 236*41dc04e5SJason Molenda Given a virtual address, clear the bits that are not used for addressing 237*41dc04e5SJason Molenda (and may be used for metadata, memory tagging, point authentication, etc). 238*41dc04e5SJason Molenda By default the most general mask, lldb.eAddressMaskTypeAny is used to 239*41dc04e5SJason Molenda process the address, but lldb.eAddressMaskTypeData and 240*41dc04e5SJason Molenda lldb.eAddressMaskTypeCode may be specified if the type of address is known." 241*41dc04e5SJason Molenda ) lldb::SBProcess::FixAddress; 242*41dc04e5SJason Molenda 243*41dc04e5SJason Molenda %feature("docstring", " 244662548c8SAlex Langford Allocates a block of memory within the process, with size and 245662548c8SAlex Langford access permissions specified in the arguments. The permissions 246662548c8SAlex Langford argument is an or-combination of zero or more of 247662548c8SAlex Langford lldb.ePermissionsWritable, lldb.ePermissionsReadable, and 248662548c8SAlex Langford lldb.ePermissionsExecutable. Returns the address 249662548c8SAlex Langford of the allocated buffer in the process, or 250662548c8SAlex Langford lldb.LLDB_INVALID_ADDRESS if the allocation failed." 251662548c8SAlex Langford ) lldb::SBProcess::AllocateMemory; 252662548c8SAlex Langford 253e35fb3fbSJason Molenda %feature("docstring", "Get default process broadcaster class name (lldb.process)." 2546813ef37SMed Ismail Bennani ) lldb::SBProcess::GetBroadcasterClass; 2556813ef37SMed Ismail Bennani 2566813ef37SMed Ismail Bennani 257e35fb3fbSJason Molenda %feature("docstring", " 258662548c8SAlex Langford Deallocates the block of memory (previously allocated using 259662548c8SAlex Langford AllocateMemory) given in the argument." 260662548c8SAlex Langford ) lldb::SBProcess::DeallocateMemory; 261