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