1 //===-- SBLaunchInfo.h ------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLDB_SBLaunchInfo_h_
11 #define LLDB_SBLaunchInfo_h_
13 #include "lldb/API/SBDefines.h"
15 namespace lldb_private {
16 class SBLaunchInfoImpl;
24 class LLDB_API SBLaunchInfo {
26 SBLaunchInfo(const char **argv);
30 lldb::pid_t GetProcessID();
34 uint32_t GetGroupID();
38 bool GroupIDIsValid();
40 void SetUserID(uint32_t uid);
42 void SetGroupID(uint32_t gid);
44 SBFileSpec GetExecutableFile();
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.
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.
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.
61 /// @param[in] exe_file
62 /// The override path to use when launching the executable.
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
68 //----------------------------------------------------------------------
69 void SetExecutableFile(SBFileSpec exe_file, bool add_as_first_arg);
71 //----------------------------------------------------------------------
72 /// Get the listener that will be used to receive process events.
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();
81 //----------------------------------------------------------------------
82 /// Set the listener that will be used to receive process events.
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);
90 uint32_t GetNumArguments();
92 const char *GetArgumentAtIndex(uint32_t idx);
94 void SetArguments(const char **argv, bool append);
96 uint32_t GetNumEnvironmentEntries();
98 const char *GetEnvironmentEntryAtIndex(uint32_t idx);
100 void SetEnvironmentEntries(const char **envp, bool append);
104 const char *GetWorkingDirectory() const;
106 void SetWorkingDirectory(const char *working_dir);
108 uint32_t GetLaunchFlags();
110 void SetLaunchFlags(uint32_t flags);
112 const char *GetProcessPluginName();
114 void SetProcessPluginName(const char *plugin_name);
116 const char *GetShell();
118 void SetShell(const char *path);
120 bool GetShellExpandArguments();
122 void SetShellExpandArguments(bool expand);
124 uint32_t GetResumeCount();
126 void SetResumeCount(uint32_t c);
128 bool AddCloseFileAction(int fd);
130 bool AddDuplicateFileAction(int fd, int dup_fd);
132 bool AddOpenFileAction(int fd, const char *path, bool read, bool write);
134 bool AddSuppressFileAction(int fd, bool read, bool write);
136 void SetLaunchEventData(const char *data);
138 const char *GetLaunchEventData() const;
140 bool GetDetachOnError() const;
142 void SetDetachOnError(bool enable);
145 friend class SBPlatform;
146 friend class SBTarget;
148 const lldb_private::ProcessLaunchInfo &ref() const;
149 void set_ref(const lldb_private::ProcessLaunchInfo &info);
151 std::shared_ptr<lldb_private::SBLaunchInfoImpl> m_opaque_sp;
156 #endif // LLDB_SBLaunchInfo_h_