]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/API/SBLaunchInfo.h
MFV r344063:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / API / SBLaunchInfo.h
1 //===-- SBLaunchInfo.h ------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLDB_SBLaunchInfo_h_
11 #define LLDB_SBLaunchInfo_h_
12
13 #include "lldb/API/SBDefines.h"
14
15 namespace lldb_private {
16 class SBLaunchInfoImpl;
17 }
18
19 namespace lldb {
20
21 class SBPlatform;
22 class SBTarget;
23
24 class LLDB_API SBLaunchInfo {
25 public:
26   SBLaunchInfo(const char **argv);
27
28   ~SBLaunchInfo();
29
30   lldb::pid_t GetProcessID();
31
32   uint32_t GetUserID();
33
34   uint32_t GetGroupID();
35
36   bool UserIDIsValid();
37
38   bool GroupIDIsValid();
39
40   void SetUserID(uint32_t uid);
41
42   void SetGroupID(uint32_t gid);
43
44   SBFileSpec GetExecutableFile();
45
46   //----------------------------------------------------------------------
47   /// Set the executable file that will be used to launch the process and
48   /// optionally set it as the first argument in the argument vector.
49   ///
50   /// This only needs to be specified if clients wish to carefully control
51   /// the exact path will be used to launch a binary. If you create a
52   /// target with a symlink, that symlink will get resolved in the target
53   /// and the resolved path will get used to launch the process. Calling
54   /// this function can help you still launch your process using the
55   /// path of your choice.
56   ///
57   /// If this function is not called prior to launching with
58   /// SBTarget::Launch(...), the target will use the resolved executable
59   /// path that was used to create the target.
60   ///
61   /// @param[in] exe_file
62   ///     The override path to use when launching the executable.
63   ///
64   /// @param[in] add_as_first_arg
65   ///     If true, then the path will be inserted into the argument vector
66   ///     prior to launching. Otherwise the argument vector will be left
67   ///     alone.
68   //----------------------------------------------------------------------
69   void SetExecutableFile(SBFileSpec exe_file, bool add_as_first_arg);
70
71   //----------------------------------------------------------------------
72   /// Get the listener that will be used to receive process events.
73   ///
74   /// If no listener has been set via a call to
75   /// SBLaunchInfo::SetListener(), then an invalid SBListener will be
76   /// returned (SBListener::IsValid() will return false). If a listener
77   /// has been set, then the valid listener object will be returned.
78   //----------------------------------------------------------------------
79   SBListener GetListener();
80
81   //----------------------------------------------------------------------
82   /// Set the listener that will be used to receive process events.
83   ///
84   /// By default the SBDebugger, which has a listener, that the SBTarget
85   /// belongs to will listen for the process events. Calling this function
86   /// allows a different listener to be used to listen for process events.
87   //----------------------------------------------------------------------
88   void SetListener(SBListener &listener);
89
90   uint32_t GetNumArguments();
91
92   const char *GetArgumentAtIndex(uint32_t idx);
93
94   void SetArguments(const char **argv, bool append);
95
96   uint32_t GetNumEnvironmentEntries();
97
98   const char *GetEnvironmentEntryAtIndex(uint32_t idx);
99
100   void SetEnvironmentEntries(const char **envp, bool append);
101
102   void Clear();
103
104   const char *GetWorkingDirectory() const;
105
106   void SetWorkingDirectory(const char *working_dir);
107
108   uint32_t GetLaunchFlags();
109
110   void SetLaunchFlags(uint32_t flags);
111
112   const char *GetProcessPluginName();
113
114   void SetProcessPluginName(const char *plugin_name);
115
116   const char *GetShell();
117
118   void SetShell(const char *path);
119
120   bool GetShellExpandArguments();
121
122   void SetShellExpandArguments(bool expand);
123
124   uint32_t GetResumeCount();
125
126   void SetResumeCount(uint32_t c);
127
128   bool AddCloseFileAction(int fd);
129
130   bool AddDuplicateFileAction(int fd, int dup_fd);
131
132   bool AddOpenFileAction(int fd, const char *path, bool read, bool write);
133
134   bool AddSuppressFileAction(int fd, bool read, bool write);
135
136   void SetLaunchEventData(const char *data);
137
138   const char *GetLaunchEventData() const;
139
140   bool GetDetachOnError() const;
141
142   void SetDetachOnError(bool enable);
143
144 protected:
145   friend class SBPlatform;
146   friend class SBTarget;
147
148   const lldb_private::ProcessLaunchInfo &ref() const;
149   void set_ref(const lldb_private::ProcessLaunchInfo &info);
150
151   std::shared_ptr<lldb_private::SBLaunchInfoImpl> m_opaque_sp;
152 };
153
154 } // namespace lldb
155
156 #endif // LLDB_SBLaunchInfo_h_