LLDB API Documentation

SBLaunchInfo.h
Go to the documentation of this file.
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 {
16 
17 class SBPlatform;
18 class SBTarget;
19 
20 class LLDB_API SBLaunchInfo {
21 public:
22  SBLaunchInfo(const char **argv);
23 
24  ~SBLaunchInfo();
25 
26  lldb::pid_t GetProcessID();
27 
28  uint32_t GetUserID();
29 
30  uint32_t GetGroupID();
31 
32  bool UserIDIsValid();
33 
34  bool GroupIDIsValid();
35 
36  void SetUserID(uint32_t uid);
37 
38  void SetGroupID(uint32_t gid);
39 
40  SBFileSpec GetExecutableFile();
41 
42  //----------------------------------------------------------------------
43  /// Set the executable file that will be used to launch the process and
44  /// optionally set it as the first argument in the argument vector.
45  ///
46  /// This only needs to be specified if clients wish to carefully control
47  /// the exact path will be used to launch a binary. If you create a
48  /// target with a symlink, that symlink will get resolved in the target
49  /// and the resolved path will get used to launch the process. Calling
50  /// this function can help you still launch your process using the
51  /// path of your choice.
52  ///
53  /// If this function is not called prior to launching with
54  /// SBTarget::Launch(...), the target will use the resolved executable
55  /// path that was used to create the target.
56  ///
57  /// @param[in] exe_file
58  /// The override path to use when launching the executable.
59  ///
60  /// @param[in] add_as_first_arg
61  /// If true, then the path will be inserted into the argument vector
62  /// prior to launching. Otherwise the argument vector will be left
63  /// alone.
64  //----------------------------------------------------------------------
65  void SetExecutableFile(SBFileSpec exe_file, bool add_as_first_arg);
66 
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  //----------------------------------------------------------------------
75  SBListener GetListener();
76 
77  //----------------------------------------------------------------------
78  /// Set the listener that will be used to receive process events.
79  ///
80  /// By default the SBDebugger, which has a listener, that the SBTarget
81  /// belongs to will listen for the process events. Calling this function
82  /// allows a different listener to be used to listen for process events.
83  //----------------------------------------------------------------------
84  void SetListener(SBListener &listener);
85 
86  uint32_t GetNumArguments();
87 
88  const char *GetArgumentAtIndex(uint32_t idx);
89 
90  void SetArguments(const char **argv, bool append);
91 
92  uint32_t GetNumEnvironmentEntries();
93 
94  const char *GetEnvironmentEntryAtIndex(uint32_t idx);
95 
96  void SetEnvironmentEntries(const char **envp, bool append);
97 
98  void Clear();
99 
100  const char *GetWorkingDirectory() const;
101 
102  void SetWorkingDirectory(const char *working_dir);
103 
104  uint32_t GetLaunchFlags();
105 
106  void SetLaunchFlags(uint32_t flags);
107 
108  const char *GetProcessPluginName();
109 
110  void SetProcessPluginName(const char *plugin_name);
111 
112  const char *GetShell();
113 
114  void SetShell(const char *path);
115 
116  bool GetShellExpandArguments();
117 
118  void SetShellExpandArguments(bool expand);
119 
120  uint32_t GetResumeCount();
121 
122  void SetResumeCount(uint32_t c);
123 
124  bool AddCloseFileAction(int fd);
125 
126  bool AddDuplicateFileAction(int fd, int dup_fd);
127 
128  bool AddOpenFileAction(int fd, const char *path, bool read, bool write);
129 
130  bool AddSuppressFileAction(int fd, bool read, bool write);
131 
132  void SetLaunchEventData(const char *data);
133 
134  const char *GetLaunchEventData() const;
135 
136  bool GetDetachOnError() const;
137 
138  void SetDetachOnError(bool enable);
139 
140 protected:
141  friend class SBPlatform;
142  friend class SBTarget;
143 
144  lldb_private::ProcessLaunchInfo &ref();
145 
146  const lldb_private::ProcessLaunchInfo &ref() const;
147 
148  ProcessLaunchInfoSP m_opaque_sp;
149 };
150 
151 } // namespace lldb
152 
153 #endif // LLDB_SBLaunchInfo_h_
class LLDB_API SBTarget
Definition: SBDefines.h:78
class LLDB_API SBLaunchInfo
Definition: SBDefines.h:59
ProcessLaunchInfoSP m_opaque_sp
Definition: SBLaunchInfo.h:148