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/Core/ArchSpec.h"
15 #include "lldb/Host/FileSpec.h"
16 #include "lldb/Interpreter/Args.h"
18 namespace lldb_private {
19 //----------------------------------------------------------------------
22 // A base class for information for a process. This can be used to fill
23 // out information for a process prior to launching it, or it can be
24 // used for an instance of a process and can be filled in with the
25 // existing values for that process.
26 //----------------------------------------------------------------------
31 ProcessInfo(const char *name, const ArchSpec &arch, lldb::pid_t pid);
35 const char *GetName() const;
37 size_t GetNameLength() const;
39 FileSpec &GetExecutableFile() { return m_executable; }
41 void SetExecutableFile(const FileSpec &exe_file,
42 bool add_exe_file_as_first_arg);
44 const FileSpec &GetExecutableFile() const { return m_executable; }
46 uint32_t GetUserID() const { return m_uid; }
48 uint32_t GetGroupID() const { return m_gid; }
50 bool UserIDIsValid() const { return m_uid != UINT32_MAX; }
52 bool GroupIDIsValid() const { return m_gid != UINT32_MAX; }
54 void SetUserID(uint32_t uid) { m_uid = uid; }
56 void SetGroupID(uint32_t gid) { m_gid = gid; }
58 ArchSpec &GetArchitecture() { return m_arch; }
60 const ArchSpec &GetArchitecture() const { return m_arch; }
62 void SetArchitecture(const ArchSpec &arch) { m_arch = arch; }
64 lldb::pid_t GetProcessID() const { return m_pid; }
66 void SetProcessID(lldb::pid_t pid) { m_pid = pid; }
68 bool ProcessIDIsValid() const { return m_pid != LLDB_INVALID_PROCESS_ID; }
70 void Dump(Stream &s, Platform *platform) const;
72 Args &GetArguments() { return m_arguments; }
74 const Args &GetArguments() const { return m_arguments; }
76 llvm::StringRef GetArg0() const;
78 void SetArg0(llvm::StringRef arg);
80 void SetArguments(const Args &args, bool first_arg_is_executable);
82 void SetArguments(char const **argv, bool first_arg_is_executable);
84 Args &GetEnvironmentEntries() { return m_environment; }
86 const Args &GetEnvironmentEntries() 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]
92 // that differs from the resolved platform executable
93 // (which is in m_executable)
94 Args m_arguments; // All program arguments except argv[0]
103 #endif // #ifndef liblldb_ProcessInfo_h_