1 //===-- ProcessInfo.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 liblldb_ProcessInfo_h_
11 #define liblldb_ProcessInfo_h_
14 #include "lldb/Utility/ArchSpec.h"
15 #include "lldb/Utility/Args.h"
16 #include "lldb/Utility/Environment.h"
17 #include "lldb/Utility/FileSpec.h"
19 namespace lldb_private {
20 //----------------------------------------------------------------------
23 // A base class for information for a process. This can be used to fill
24 // out information for a process prior to launching it, or it can be used for
25 // an instance of a process and can be filled in with the existing values for
27 //----------------------------------------------------------------------
32 ProcessInfo(const char *name, const ArchSpec &arch, lldb::pid_t pid);
36 const char *GetName() const;
38 size_t GetNameLength() const;
40 FileSpec &GetExecutableFile() { return m_executable; }
42 void SetExecutableFile(const FileSpec &exe_file,
43 bool add_exe_file_as_first_arg);
45 const FileSpec &GetExecutableFile() const { return m_executable; }
47 uint32_t GetUserID() const { return m_uid; }
49 uint32_t GetGroupID() const { return m_gid; }
51 bool UserIDIsValid() const { return m_uid != UINT32_MAX; }
53 bool GroupIDIsValid() const { return m_gid != UINT32_MAX; }
55 void SetUserID(uint32_t uid) { m_uid = uid; }
57 void SetGroupID(uint32_t gid) { m_gid = gid; }
59 ArchSpec &GetArchitecture() { return m_arch; }
61 const ArchSpec &GetArchitecture() const { return m_arch; }
63 void SetArchitecture(const ArchSpec &arch) { m_arch = arch; }
65 lldb::pid_t GetProcessID() const { return m_pid; }
67 void SetProcessID(lldb::pid_t pid) { m_pid = pid; }
69 bool ProcessIDIsValid() const { return m_pid != LLDB_INVALID_PROCESS_ID; }
71 void Dump(Stream &s, Platform *platform) const;
73 Args &GetArguments() { return m_arguments; }
75 const Args &GetArguments() const { return m_arguments; }
77 llvm::StringRef GetArg0() const;
79 void SetArg0(llvm::StringRef arg);
81 void SetArguments(const Args &args, bool first_arg_is_executable);
83 void SetArguments(char const **argv, bool first_arg_is_executable);
85 Environment &GetEnvironment() { return m_environment; }
86 const Environment &GetEnvironment() const { return m_environment; }
89 FileSpec m_executable;
90 std::string m_arg0; // argv[0] if supported. If empty, then use m_executable.
91 // Not all process plug-ins support specifying an argv[0] that differs from
92 // the resolved platform executable (which is in m_executable)
93 Args m_arguments; // All program arguments except argv[0]
94 Environment m_environment;
102 #endif // #ifndef liblldb_ProcessInfo_h_