1 //===-- SBAttachInfo.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_SBAttachInfo_h_
11 #define LLDB_SBAttachInfo_h_
13 #include "lldb/API/SBDefines.h"
19 class LLDB_API SBAttachInfo {
23 SBAttachInfo(lldb::pid_t pid);
25 //------------------------------------------------------------------
26 /// Attach to a process by name.
28 /// This function implies that a future call to SBTarget::Attach(...)
29 /// will be synchronous.
32 /// A full or partial name for the process to attach to.
34 /// @param[in] wait_for
35 /// If \b false, attach to an existing process whose name matches.
36 /// If \b true, then wait for the next process whose name matches.
37 //------------------------------------------------------------------
38 SBAttachInfo(const char *path, bool wait_for);
40 //------------------------------------------------------------------
41 /// Attach to a process by name.
43 /// Future calls to SBTarget::Attach(...) will be synchronous or
44 /// asynchronous depending on the \a async argument.
47 /// A full or partial name for the process to attach to.
49 /// @param[in] wait_for
50 /// If \b false, attach to an existing process whose name matches.
51 /// If \b true, then wait for the next process whose name matches.
54 /// If \b false, then the SBTarget::Attach(...) call will be a
55 /// synchronous call with no way to cancel the attach in
57 /// If \b true, then the SBTarget::Attach(...) function will
58 /// return immediately and clients are expected to wait for a
59 /// process eStateStopped event if a suitable process is
60 /// eventually found. If the client wants to cancel the event,
61 /// SBProcess::Stop() can be called and an eStateExited process
62 /// event will be delivered.
63 //------------------------------------------------------------------
64 SBAttachInfo(const char *path, bool wait_for, bool async);
66 SBAttachInfo(const SBAttachInfo &rhs);
70 SBAttachInfo &operator=(const SBAttachInfo &rhs);
72 lldb::pid_t GetProcessID();
74 void SetProcessID(lldb::pid_t pid);
76 void SetExecutable(const char *path);
78 void SetExecutable(lldb::SBFileSpec exe_file);
80 bool GetWaitForLaunch();
82 //------------------------------------------------------------------
83 /// Set attach by process name settings.
85 /// Designed to be used after a call to SBAttachInfo::SetExecutable().
86 /// This function implies that a call to SBTarget::Attach(...) will
89 /// @param[in] wait_for
90 /// If \b false, attach to an existing process whose name matches.
91 /// If \b true, then wait for the next process whose name matches.
92 //------------------------------------------------------------------
93 void SetWaitForLaunch(bool b);
95 //------------------------------------------------------------------
96 /// Set attach by process name settings.
98 /// Designed to be used after a call to SBAttachInfo::SetExecutable().
99 /// Future calls to SBTarget::Attach(...) will be synchronous or
100 /// asynchronous depending on the \a async argument.
102 /// @param[in] wait_for
103 /// If \b false, attach to an existing process whose name matches.
104 /// If \b true, then wait for the next process whose name matches.
107 /// If \b false, then the SBTarget::Attach(...) call will be a
108 /// synchronous call with no way to cancel the attach in
110 /// If \b true, then the SBTarget::Attach(...) function will
111 /// return immediately and clients are expected to wait for a
112 /// process eStateStopped event if a suitable process is
113 /// eventually found. If the client wants to cancel the event,
114 /// SBProcess::Stop() can be called and an eStateExited process
115 /// event will be delivered.
116 //------------------------------------------------------------------
117 void SetWaitForLaunch(bool b, bool async);
119 bool GetIgnoreExisting();
121 void SetIgnoreExisting(bool b);
123 uint32_t GetResumeCount();
125 void SetResumeCount(uint32_t c);
127 const char *GetProcessPluginName();
129 void SetProcessPluginName(const char *plugin_name);
131 uint32_t GetUserID();
133 uint32_t GetGroupID();
135 bool UserIDIsValid();
137 bool GroupIDIsValid();
139 void SetUserID(uint32_t uid);
141 void SetGroupID(uint32_t gid);
143 uint32_t GetEffectiveUserID();
145 uint32_t GetEffectiveGroupID();
147 bool EffectiveUserIDIsValid();
149 bool EffectiveGroupIDIsValid();
151 void SetEffectiveUserID(uint32_t uid);
153 void SetEffectiveGroupID(uint32_t gid);
155 lldb::pid_t GetParentProcessID();
157 void SetParentProcessID(lldb::pid_t pid);
159 bool ParentProcessIDIsValid();
161 //----------------------------------------------------------------------
162 /// Get the listener that will be used to receive process events.
164 /// If no listener has been set via a call to
165 /// SBLaunchInfo::SetListener(), then an invalid SBListener will be
166 /// returned (SBListener::IsValid() will return false). If a listener
167 /// has been set, then the valid listener object will be returned.
168 //----------------------------------------------------------------------
169 SBListener GetListener();
171 //----------------------------------------------------------------------
172 /// Set the listener that will be used to receive process events.
174 /// By default the SBDebugger, which has a listener, that the SBTarget
175 /// belongs to will listen for the process events. Calling this function
176 /// allows a different listener to be used to listen for process events.
177 //----------------------------------------------------------------------
178 void SetListener(SBListener &listener);
181 friend class SBTarget;
183 lldb_private::ProcessAttachInfo &ref();
185 ProcessAttachInfoSP m_opaque_sp;
190 #endif // LLDB_SBAttachInfo_h_