1285101Semaste//===-- SBAttachInfo.h ------------------------------------------*- C++ -*-===// 2285101Semaste// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6285101Semaste// 7285101Semaste//===----------------------------------------------------------------------===// 8285101Semaste 9285101Semaste#ifndef LLDB_SBAttachInfo_h_ 10285101Semaste#define LLDB_SBAttachInfo_h_ 11285101Semaste 12285101Semaste#include "lldb/API/SBDefines.h" 13285101Semaste 14285101Semastenamespace lldb { 15285101Semaste 16285101Semasteclass SBTarget; 17285101Semaste 18314564Sdimclass LLDB_API SBAttachInfo { 19285101Semastepublic: 20314564Sdim SBAttachInfo(); 21285101Semaste 22314564Sdim SBAttachInfo(lldb::pid_t pid); 23285101Semaste 24314564Sdim /// Attach to a process by name. 25314564Sdim /// 26314564Sdim /// This function implies that a future call to SBTarget::Attach(...) 27314564Sdim /// will be synchronous. 28314564Sdim /// 29353358Sdim /// \param[in] path 30314564Sdim /// A full or partial name for the process to attach to. 31314564Sdim /// 32353358Sdim /// \param[in] wait_for 33314564Sdim /// If \b false, attach to an existing process whose name matches. 34314564Sdim /// If \b true, then wait for the next process whose name matches. 35314564Sdim SBAttachInfo(const char *path, bool wait_for); 36285101Semaste 37314564Sdim /// Attach to a process by name. 38314564Sdim /// 39314564Sdim /// Future calls to SBTarget::Attach(...) will be synchronous or 40314564Sdim /// asynchronous depending on the \a async argument. 41314564Sdim /// 42353358Sdim /// \param[in] path 43314564Sdim /// A full or partial name for the process to attach to. 44314564Sdim /// 45353358Sdim /// \param[in] wait_for 46314564Sdim /// If \b false, attach to an existing process whose name matches. 47314564Sdim /// If \b true, then wait for the next process whose name matches. 48314564Sdim /// 49353358Sdim /// \param[in] async 50314564Sdim /// If \b false, then the SBTarget::Attach(...) call will be a 51314564Sdim /// synchronous call with no way to cancel the attach in 52314564Sdim /// progress. 53314564Sdim /// If \b true, then the SBTarget::Attach(...) function will 54314564Sdim /// return immediately and clients are expected to wait for a 55314564Sdim /// process eStateStopped event if a suitable process is 56314564Sdim /// eventually found. If the client wants to cancel the event, 57314564Sdim /// SBProcess::Stop() can be called and an eStateExited process 58314564Sdim /// event will be delivered. 59314564Sdim SBAttachInfo(const char *path, bool wait_for, bool async); 60296417Sdim 61314564Sdim SBAttachInfo(const SBAttachInfo &rhs); 62285101Semaste 63314564Sdim ~SBAttachInfo(); 64285101Semaste 65314564Sdim SBAttachInfo &operator=(const SBAttachInfo &rhs); 66285101Semaste 67314564Sdim lldb::pid_t GetProcessID(); 68285101Semaste 69314564Sdim void SetProcessID(lldb::pid_t pid); 70285101Semaste 71314564Sdim void SetExecutable(const char *path); 72285101Semaste 73314564Sdim void SetExecutable(lldb::SBFileSpec exe_file); 74285101Semaste 75314564Sdim bool GetWaitForLaunch(); 76285101Semaste 77314564Sdim /// Set attach by process name settings. 78314564Sdim /// 79314564Sdim /// Designed to be used after a call to SBAttachInfo::SetExecutable(). 80314564Sdim /// This function implies that a call to SBTarget::Attach(...) will 81314564Sdim /// be synchronous. 82314564Sdim /// 83353358Sdim /// \param[in] b 84314564Sdim /// If \b false, attach to an existing process whose name matches. 85314564Sdim /// If \b true, then wait for the next process whose name matches. 86314564Sdim void SetWaitForLaunch(bool b); 87285101Semaste 88314564Sdim /// Set attach by process name settings. 89314564Sdim /// 90314564Sdim /// Designed to be used after a call to SBAttachInfo::SetExecutable(). 91314564Sdim /// Future calls to SBTarget::Attach(...) will be synchronous or 92314564Sdim /// asynchronous depending on the \a async argument. 93314564Sdim /// 94353358Sdim /// \param[in] b 95314564Sdim /// If \b false, attach to an existing process whose name matches. 96314564Sdim /// If \b true, then wait for the next process whose name matches. 97314564Sdim /// 98353358Sdim /// \param[in] async 99314564Sdim /// If \b false, then the SBTarget::Attach(...) call will be a 100314564Sdim /// synchronous call with no way to cancel the attach in 101314564Sdim /// progress. 102314564Sdim /// If \b true, then the SBTarget::Attach(...) function will 103314564Sdim /// return immediately and clients are expected to wait for a 104314564Sdim /// process eStateStopped event if a suitable process is 105314564Sdim /// eventually found. If the client wants to cancel the event, 106314564Sdim /// SBProcess::Stop() can be called and an eStateExited process 107314564Sdim /// event will be delivered. 108314564Sdim void SetWaitForLaunch(bool b, bool async); 109296417Sdim 110314564Sdim bool GetIgnoreExisting(); 111285101Semaste 112314564Sdim void SetIgnoreExisting(bool b); 113285101Semaste 114314564Sdim uint32_t GetResumeCount(); 115285101Semaste 116314564Sdim void SetResumeCount(uint32_t c); 117285101Semaste 118314564Sdim const char *GetProcessPluginName(); 119285101Semaste 120314564Sdim void SetProcessPluginName(const char *plugin_name); 121285101Semaste 122314564Sdim uint32_t GetUserID(); 123285101Semaste 124314564Sdim uint32_t GetGroupID(); 125285101Semaste 126314564Sdim bool UserIDIsValid(); 127285101Semaste 128314564Sdim bool GroupIDIsValid(); 129285101Semaste 130314564Sdim void SetUserID(uint32_t uid); 131285101Semaste 132314564Sdim void SetGroupID(uint32_t gid); 133285101Semaste 134314564Sdim uint32_t GetEffectiveUserID(); 135285101Semaste 136314564Sdim uint32_t GetEffectiveGroupID(); 137285101Semaste 138314564Sdim bool EffectiveUserIDIsValid(); 139285101Semaste 140314564Sdim bool EffectiveGroupIDIsValid(); 141285101Semaste 142314564Sdim void SetEffectiveUserID(uint32_t uid); 143285101Semaste 144314564Sdim void SetEffectiveGroupID(uint32_t gid); 145285101Semaste 146314564Sdim lldb::pid_t GetParentProcessID(); 147285101Semaste 148314564Sdim void SetParentProcessID(lldb::pid_t pid); 149285101Semaste 150314564Sdim bool ParentProcessIDIsValid(); 151285101Semaste 152314564Sdim /// Get the listener that will be used to receive process events. 153314564Sdim /// 154314564Sdim /// If no listener has been set via a call to 155321723Sdim /// SBAttachInfo::SetListener(), then an invalid SBListener will be 156314564Sdim /// returned (SBListener::IsValid() will return false). If a listener 157314564Sdim /// has been set, then the valid listener object will be returned. 158314564Sdim SBListener GetListener(); 159285101Semaste 160314564Sdim /// Set the listener that will be used to receive process events. 161314564Sdim /// 162314564Sdim /// By default the SBDebugger, which has a listener, that the SBTarget 163314564Sdim /// belongs to will listen for the process events. Calling this function 164314564Sdim /// allows a different listener to be used to listen for process events. 165314564Sdim void SetListener(SBListener &listener); 166285101Semaste 167285101Semasteprotected: 168314564Sdim friend class SBTarget; 169285101Semaste 170314564Sdim lldb_private::ProcessAttachInfo &ref(); 171285101Semaste 172314564Sdim ProcessAttachInfoSP m_opaque_sp; 173285101Semaste}; 174285101Semaste 175285101Semaste} // namespace lldb 176285101Semaste 177314564Sdim#endif // LLDB_SBAttachInfo_h_ 178