]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/lldb/Target/ProcessInfo.h
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / include / lldb / Target / ProcessInfo.h
1 //===-- ProcessInfo.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 liblldb_ProcessInfo_h_
11 #define liblldb_ProcessInfo_h_
12
13 // LLDB headers
14 #include "lldb/Core/ArchSpec.h"
15 #include "lldb/Host/FileSpec.h"
16 #include "lldb/Interpreter/Args.h"
17
18 namespace lldb_private {
19 //----------------------------------------------------------------------
20 // ProcessInfo
21 //
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 //----------------------------------------------------------------------
27 class ProcessInfo {
28 public:
29   ProcessInfo();
30
31   ProcessInfo(const char *name, const ArchSpec &arch, lldb::pid_t pid);
32
33   void Clear();
34
35   const char *GetName() const;
36
37   size_t GetNameLength() const;
38
39   FileSpec &GetExecutableFile() { return m_executable; }
40
41   void SetExecutableFile(const FileSpec &exe_file,
42                          bool add_exe_file_as_first_arg);
43
44   const FileSpec &GetExecutableFile() const { return m_executable; }
45
46   uint32_t GetUserID() const { return m_uid; }
47
48   uint32_t GetGroupID() const { return m_gid; }
49
50   bool UserIDIsValid() const { return m_uid != UINT32_MAX; }
51
52   bool GroupIDIsValid() const { return m_gid != UINT32_MAX; }
53
54   void SetUserID(uint32_t uid) { m_uid = uid; }
55
56   void SetGroupID(uint32_t gid) { m_gid = gid; }
57
58   ArchSpec &GetArchitecture() { return m_arch; }
59
60   const ArchSpec &GetArchitecture() const { return m_arch; }
61
62   void SetArchitecture(const ArchSpec &arch) { m_arch = arch; }
63
64   lldb::pid_t GetProcessID() const { return m_pid; }
65
66   void SetProcessID(lldb::pid_t pid) { m_pid = pid; }
67
68   bool ProcessIDIsValid() const { return m_pid != LLDB_INVALID_PROCESS_ID; }
69
70   void Dump(Stream &s, Platform *platform) const;
71
72   Args &GetArguments() { return m_arguments; }
73
74   const Args &GetArguments() const { return m_arguments; }
75
76   llvm::StringRef GetArg0() const;
77
78   void SetArg0(llvm::StringRef arg);
79
80   void SetArguments(const Args &args, bool first_arg_is_executable);
81
82   void SetArguments(char const **argv, bool first_arg_is_executable);
83
84   Args &GetEnvironmentEntries() { return m_environment; }
85
86   const Args &GetEnvironmentEntries() const { return m_environment; }
87
88 protected:
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]
95   Args m_environment;
96   uint32_t m_uid;
97   uint32_t m_gid;
98   ArchSpec m_arch;
99   lldb::pid_t m_pid;
100 };
101 }
102
103 #endif // #ifndef liblldb_ProcessInfo_h_