1 //===-- SBProcess.h ---------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLDB_SBProcess_h_
11 #define LLDB_SBProcess_h_
13 #include "lldb/API/SBDefines.h"
14 #include "lldb/API/SBError.h"
15 #include "lldb/API/SBTarget.h"
25 //------------------------------------------------------------------
26 /// Broadcaster event bits definitions.
27 //------------------------------------------------------------------
30 eBroadcastBitStateChanged = (1 << 0),
31 eBroadcastBitInterrupt = (1 << 1),
32 eBroadcastBitSTDOUT = (1 << 2),
33 eBroadcastBitSTDERR = (1 << 3),
34 eBroadcastBitProfileData = (1 << 4)
39 SBProcess (const lldb::SBProcess& rhs);
41 const lldb::SBProcess&
42 operator = (const lldb::SBProcess& rhs);
44 SBProcess (const lldb::ProcessSP &process_sp);
49 GetBroadcasterClassName ();
54 // DEPRECATED: use GetPluginName()
56 GetShortPluginName ();
71 PutSTDIN (const char *src, size_t src_len);
74 GetSTDOUT (char *dst, size_t dst_len) const;
77 GetSTDERR (char *dst, size_t dst_len) const;
80 GetAsyncProfileData(char *dst, size_t dst_len) const;
83 ReportEventState (const lldb::SBEvent &event, FILE *out) const;
86 AppendEventStateReport (const lldb::SBEvent &event, lldb::SBCommandReturnObject &result);
88 //------------------------------------------------------------------
89 /// Remote connection related functions. These will fail if the
90 /// process is not in eStateConnected. They are intended for use
91 /// when connecting to an externally managed debugserver instance.
92 //------------------------------------------------------------------
94 RemoteAttachToProcessWithID (lldb::pid_t pid,
95 lldb::SBError& error);
98 RemoteLaunch (char const **argv,
100 const char *stdin_path,
101 const char *stdout_path,
102 const char *stderr_path,
103 const char *working_directory,
104 uint32_t launch_flags,
106 lldb::SBError& error);
108 //------------------------------------------------------------------
109 // Thread related functions
110 //------------------------------------------------------------------
115 GetThreadAtIndex (size_t index);
118 GetThreadByID (lldb::tid_t sb_thread_id);
121 GetThreadByIndexID (uint32_t index_id);
124 GetSelectedThread () const;
126 //------------------------------------------------------------------
127 // Function for lazily creating a thread using the current OS
128 // plug-in. This function will be removed in the future when there
129 // are APIs to create SBThread objects through the interface and add
130 // them to the process through the SBProcess API.
131 //------------------------------------------------------------------
133 CreateOSPluginThread (lldb::tid_t tid, lldb::addr_t context);
136 SetSelectedThread (const lldb::SBThread &thread);
139 SetSelectedThreadByID (lldb::tid_t tid);
142 SetSelectedThreadByIndexID (uint32_t index_id);
144 //------------------------------------------------------------------
145 // Stepping related functions
146 //------------------------------------------------------------------
155 GetExitDescription ();
157 //------------------------------------------------------------------
158 /// Gets the process ID
160 /// Returns the process identifier for the process as it is known
161 /// on the system on which the process is running. For unix systems
162 /// this is typically the same as if you called "getpid()" in the
166 /// Returns LLDB_INVALID_PROCESS_ID if this object does not
167 /// contain a valid process object, or if the process has not
168 /// been launched. Returns a valid process ID if the process is
170 //------------------------------------------------------------------
174 //------------------------------------------------------------------
175 /// Gets the unique ID associated with this process object
177 /// Unique IDs start at 1 and increment up with each new process
178 /// instance. Since starting a process on a system might always
179 /// create a process with the same process ID, there needs to be a
180 /// way to tell two process instances apart.
183 /// Returns a non-zero integer ID if this object contains a
184 /// valid process object, zero if this object does not contain
185 /// a valid process object.
186 //------------------------------------------------------------------
191 GetAddressByteSize() const;
209 Detach (bool keep_stopped);
215 SendAsyncInterrupt();
218 GetStopID(bool include_expression_stops = false);
221 ReadMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
224 WriteMemory (addr_t addr, const void *buf, size_t size, lldb::SBError &error);
227 ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
230 ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBError &error);
233 ReadPointerFromMemory (addr_t addr, lldb::SBError &error);
236 static lldb::StateType
237 GetStateFromEvent (const lldb::SBEvent &event);
240 GetRestartedFromEvent (const lldb::SBEvent &event);
243 GetNumRestartedReasonsFromEvent (const lldb::SBEvent &event);
246 GetRestartedReasonAtIndexFromEvent (const lldb::SBEvent &event, size_t idx);
248 static lldb::SBProcess
249 GetProcessFromEvent (const lldb::SBEvent &event);
252 EventIsProcessEvent (const lldb::SBEvent &event);
255 GetBroadcaster () const;
258 GetBroadcasterClass ();
261 GetDescription (lldb::SBStream &description);
264 GetNumSupportedHardwareWatchpoints (lldb::SBError &error) const;
267 LoadImage (lldb::SBFileSpec &image_spec, lldb::SBError &error);
270 UnloadImage (uint32_t image_token);
273 friend class SBAddress;
274 friend class SBBreakpoint;
275 friend class SBBreakpointLocation;
276 friend class SBCommandInterpreter;
277 friend class SBDebugger;
278 friend class SBFunction;
279 friend class SBModule;
280 friend class SBTarget;
281 friend class SBThread;
282 friend class SBValue;
288 SetSP (const lldb::ProcessSP &process_sp);
290 lldb::ProcessWP m_opaque_wp;
295 #endif // LLDB_SBProcess_h_