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"
20 class LLDB_API SBLaunchInfo {
22 SBLaunchInfo(const char **argv);
26 lldb::pid_t GetProcessID();
30 uint32_t GetGroupID();
34 bool GroupIDIsValid();
36 void SetUserID(uint32_t uid);
38 void SetGroupID(uint32_t gid);
40 SBFileSpec GetExecutableFile();
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.
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.
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.
57 /// @param[in] exe_file
58 /// The override path to use when launching the executable.
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
64 //----------------------------------------------------------------------
65 void SetExecutableFile(SBFileSpec exe_file, bool add_as_first_arg);
67 //----------------------------------------------------------------------
68 /// Get the listener that will be used to receive process events.
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();
77 //----------------------------------------------------------------------
78 /// Set the listener that will be used to receive process events.
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);
86 uint32_t GetNumArguments();
88 const char *GetArgumentAtIndex(uint32_t idx);
90 void SetArguments(const char **argv, bool append);
92 uint32_t GetNumEnvironmentEntries();
94 const char *GetEnvironmentEntryAtIndex(uint32_t idx);
96 void SetEnvironmentEntries(const char **envp, bool append);
100 const char *GetWorkingDirectory() const;
102 void SetWorkingDirectory(const char *working_dir);
104 uint32_t GetLaunchFlags();
106 void SetLaunchFlags(uint32_t flags);
108 const char *GetProcessPluginName();
110 void SetProcessPluginName(const char *plugin_name);
112 const char *GetShell();
114 void SetShell(const char *path);
116 bool GetShellExpandArguments();
118 void SetShellExpandArguments(bool expand);
120 uint32_t GetResumeCount();
122 void SetResumeCount(uint32_t c);
124 bool AddCloseFileAction(int fd);
126 bool AddDuplicateFileAction(int fd, int dup_fd);
128 bool AddOpenFileAction(int fd, const char *path, bool read, bool write);
130 bool AddSuppressFileAction(int fd, bool read, bool write);
132 void SetLaunchEventData(const char *data);
134 const char *GetLaunchEventData() const;
136 bool GetDetachOnError() const;
138 void SetDetachOnError(bool enable);
141 friend class SBPlatform;
142 friend class SBTarget;
144 lldb_private::ProcessLaunchInfo &ref();
146 const lldb_private::ProcessLaunchInfo &ref() const;
148 ProcessLaunchInfoSP m_opaque_sp;
153 #endif // LLDB_SBLaunchInfo_h_