Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:41

0001 //===-- SBAttachInfo.h ------------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_API_SBATTACHINFO_H
0010 #define LLDB_API_SBATTACHINFO_H
0011 
0012 #include "lldb/API/SBDefines.h"
0013 
0014 namespace lldb_private {
0015 class ScriptInterpreter;
0016 }
0017 
0018 namespace lldb {
0019 
0020 class SBTarget;
0021 
0022 class LLDB_API SBAttachInfo {
0023 public:
0024   SBAttachInfo();
0025 
0026   SBAttachInfo(lldb::pid_t pid);
0027 
0028   /// Attach to a process by name.
0029   ///
0030   /// This function implies that a future call to SBTarget::Attach(...)
0031   /// will be synchronous.
0032   ///
0033   /// \param[in] path
0034   ///     A full or partial name for the process to attach to.
0035   ///
0036   /// \param[in] wait_for
0037   ///     If \b false, attach to an existing process whose name matches.
0038   ///     If \b true, then wait for the next process whose name matches.
0039   SBAttachInfo(const char *path, bool wait_for);
0040 
0041   /// Attach to a process by name.
0042   ///
0043   /// Future calls to SBTarget::Attach(...) will be synchronous or
0044   /// asynchronous depending on the \a async argument.
0045   ///
0046   /// \param[in] path
0047   ///     A full or partial name for the process to attach to.
0048   ///
0049   /// \param[in] wait_for
0050   ///     If \b false, attach to an existing process whose name matches.
0051   ///     If \b true, then wait for the next process whose name matches.
0052   ///
0053   /// \param[in] async
0054   ///     If \b false, then the SBTarget::Attach(...) call will be a
0055   ///     synchronous call with no way to cancel the attach in
0056   ///     progress.
0057   ///     If \b true, then the SBTarget::Attach(...) function will
0058   ///     return immediately and clients are expected to wait for a
0059   ///     process eStateStopped event if a suitable process is
0060   ///     eventually found. If the client wants to cancel the event,
0061   ///     SBProcess::Stop() can be called and an eStateExited process
0062   ///     event will be delivered.
0063   SBAttachInfo(const char *path, bool wait_for, bool async);
0064 
0065   SBAttachInfo(const SBAttachInfo &rhs);
0066 
0067   ~SBAttachInfo();
0068 
0069   SBAttachInfo &operator=(const SBAttachInfo &rhs);
0070 
0071   lldb::pid_t GetProcessID();
0072 
0073   void SetProcessID(lldb::pid_t pid);
0074 
0075   void SetExecutable(const char *path);
0076 
0077   void SetExecutable(lldb::SBFileSpec exe_file);
0078 
0079   bool GetWaitForLaunch();
0080 
0081   /// Set attach by process name settings.
0082   ///
0083   /// Designed to be used after a call to SBAttachInfo::SetExecutable().
0084   /// This function implies that a call to SBTarget::Attach(...) will
0085   /// be synchronous.
0086   ///
0087   /// \param[in] b
0088   ///     If \b false, attach to an existing process whose name matches.
0089   ///     If \b true, then wait for the next process whose name matches.
0090   void SetWaitForLaunch(bool b);
0091 
0092   /// Set attach by process name settings.
0093   ///
0094   /// Designed to be used after a call to SBAttachInfo::SetExecutable().
0095   /// Future calls to SBTarget::Attach(...) will be synchronous or
0096   /// asynchronous depending on the \a async argument.
0097   ///
0098   /// \param[in] b
0099   ///     If \b false, attach to an existing process whose name matches.
0100   ///     If \b true, then wait for the next process whose name matches.
0101   ///
0102   /// \param[in] async
0103   ///     If \b false, then the SBTarget::Attach(...) call will be a
0104   ///     synchronous call with no way to cancel the attach in
0105   ///     progress.
0106   ///     If \b true, then the SBTarget::Attach(...) function will
0107   ///     return immediately and clients are expected to wait for a
0108   ///     process eStateStopped event if a suitable process is
0109   ///     eventually found. If the client wants to cancel the event,
0110   ///     SBProcess::Stop() can be called and an eStateExited process
0111   ///     event will be delivered.
0112   void SetWaitForLaunch(bool b, bool async);
0113 
0114   bool GetIgnoreExisting();
0115 
0116   void SetIgnoreExisting(bool b);
0117 
0118   uint32_t GetResumeCount();
0119 
0120   void SetResumeCount(uint32_t c);
0121 
0122   const char *GetProcessPluginName();
0123 
0124   void SetProcessPluginName(const char *plugin_name);
0125 
0126   uint32_t GetUserID();
0127 
0128   uint32_t GetGroupID();
0129 
0130   bool UserIDIsValid();
0131 
0132   bool GroupIDIsValid();
0133 
0134   void SetUserID(uint32_t uid);
0135 
0136   void SetGroupID(uint32_t gid);
0137 
0138   uint32_t GetEffectiveUserID();
0139 
0140   uint32_t GetEffectiveGroupID();
0141 
0142   bool EffectiveUserIDIsValid();
0143 
0144   bool EffectiveGroupIDIsValid();
0145 
0146   void SetEffectiveUserID(uint32_t uid);
0147 
0148   void SetEffectiveGroupID(uint32_t gid);
0149 
0150   lldb::pid_t GetParentProcessID();
0151 
0152   void SetParentProcessID(lldb::pid_t pid);
0153 
0154   bool ParentProcessIDIsValid();
0155 
0156   /// Get the listener that will be used to receive process events.
0157   ///
0158   /// If no listener has been set via a call to
0159   /// SBAttachInfo::SetListener(), then an invalid SBListener will be
0160   /// returned (SBListener::IsValid() will return false). If a listener
0161   /// has been set, then the valid listener object will be returned.
0162   SBListener GetListener();
0163 
0164   /// Set the listener that will be used to receive process events.
0165   ///
0166   /// By default the SBDebugger, which has a listener, that the SBTarget
0167   /// belongs to will listen for the process events. Calling this function
0168   /// allows a different listener to be used to listen for process events.
0169   void SetListener(SBListener &listener);
0170 
0171   /// Get the shadow listener that receive public process events,
0172   /// additionally to the default process event listener.
0173   ///
0174   /// If no listener has been set via a call to
0175   /// SBLaunchInfo::SetShadowListener(), then an invalid SBListener will
0176   /// be returned (SBListener::IsValid() will return false). If a listener
0177   /// has been set, then the valid listener object will be returned.
0178   SBListener GetShadowListener();
0179 
0180   /// Set the shadow listener that will receive public process events,
0181   /// additionally to the default process event listener.
0182   ///
0183   /// By default a process have no shadow event listener.
0184   /// Calling this function allows public process events to be broadcasted to an
0185   /// additional listener on top of the default process event listener.
0186   /// If the `listener` argument is invalid (SBListener::IsValid() will
0187   /// return false), this will clear the shadow listener.
0188   void SetShadowListener(SBListener &listener);
0189 
0190   const char *GetScriptedProcessClassName() const;
0191 
0192   void SetScriptedProcessClassName(const char *class_name);
0193 
0194   lldb::SBStructuredData GetScriptedProcessDictionary() const;
0195 
0196   void SetScriptedProcessDictionary(lldb::SBStructuredData dict);
0197 
0198 protected:
0199   friend class SBTarget;
0200   friend class SBPlatform;
0201 
0202   friend class lldb_private::ScriptInterpreter;
0203 
0204   lldb_private::ProcessAttachInfo &ref();
0205 
0206   ProcessAttachInfoSP m_opaque_sp;
0207 };
0208 
0209 } // namespace lldb
0210 
0211 #endif // LLDB_API_SBATTACHINFO_H