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("autodoc", "
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("autodoc", "
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("autodoc", "
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("autodoc", "
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("autodoc", "
58     Returns the thread with the given thread ID."
59 ) lldb::SBProcess::GetThreadByID;
60 
61 %feature("autodoc", "
62     Returns the thread with the given thread IndexID."
63 ) lldb::SBProcess::GetThreadByIndexID;
64 
65 %feature("autodoc", "
66     Returns the currently selected thread."
67 ) lldb::SBProcess::GetSelectedThread;
68 
69 %feature("autodoc", "
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("autodoc", "
74     Returns the process ID of the process."
75 ) lldb::SBProcess::GetProcessID;
76 
77 %feature("autodoc", "
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("autodoc", "
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("autodoc", "
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("autodoc", "
120     Reads a NULL 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("autodoc", "
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("autodoc", "
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("autodoc", "
162     Returns the implementation object of the process plugin if available. None
163     otherwise."
164 ) lldb::SBProcess::GetScriptedImplementation;
165 
166 %feature("autodoc", "
167     Returns the process' extended crash information."
168 ) lldb::SBProcess::GetExtendedCrashInformation;
169 
170 %feature("autodoc", "
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("autodoc", "
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("autodoc", "
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("autodoc", "
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("autodoc", "
203     Allocates a block of memory within the process, with size and
204     access permissions specified in the arguments. The permissions
205     argument is an or-combination of zero or more of
206     lldb.ePermissionsWritable, lldb.ePermissionsReadable, and
207     lldb.ePermissionsExecutable. Returns the address
208     of the allocated buffer in the process, or
209     lldb.LLDB_INVALID_ADDRESS if the allocation failed."
210 ) lldb::SBProcess::AllocateMemory;
211 
212 %feature("autodoc", "
213     Deallocates the block of memory (previously allocated using
214     AllocateMemory) given in the argument."
215 ) lldb::SBProcess::DeallocateMemory;
216