]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Target/ProcessInfo.h
Import bhyve_graphics into CURRENT. Thanks to all who tested
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / 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     //----------------------------------------------------------------------
21     // ProcessInfo
22     //
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
25     // used for an instance of a process and can be filled in with the
26     // existing values for that process.
27     //----------------------------------------------------------------------
28     class ProcessInfo
29     {
30     public:
31         ProcessInfo ();
32
33         ProcessInfo (const char *name,
34                      const ArchSpec &arch,
35                      lldb::pid_t pid);
36
37         void
38         Clear ();
39
40         const char *
41         GetName() const;
42
43         size_t
44         GetNameLength() const;
45
46         FileSpec &
47         GetExecutableFile ()
48         {
49             return m_executable;
50         }
51
52         void
53         SetExecutableFile (const FileSpec &exe_file, bool add_exe_file_as_first_arg);
54
55         const FileSpec &
56         GetExecutableFile () const
57         {
58             return m_executable;
59         }
60
61         uint32_t
62         GetUserID() const
63         {
64             return m_uid;
65         }
66
67         uint32_t
68         GetGroupID() const
69         {
70             return m_gid;
71         }
72
73         bool
74         UserIDIsValid () const
75         {
76             return m_uid != UINT32_MAX;
77         }
78
79         bool
80         GroupIDIsValid () const
81         {
82             return m_gid != UINT32_MAX;
83         }
84
85         void
86         SetUserID (uint32_t uid)
87         {
88             m_uid = uid;
89         }
90
91         void
92         SetGroupID (uint32_t gid)
93         {
94             m_gid = gid;
95         }
96
97         ArchSpec &
98         GetArchitecture ()
99         {
100             return m_arch;
101         }
102
103         const ArchSpec &
104         GetArchitecture () const
105         {
106             return m_arch;
107         }
108
109         void
110         SetArchitecture (const ArchSpec& arch)
111         {
112             m_arch = arch;
113         }
114
115         lldb::pid_t
116         GetProcessID () const
117         {
118             return m_pid;
119         }
120
121         void
122         SetProcessID (lldb::pid_t pid)
123         {
124             m_pid = pid;
125         }
126
127         bool
128         ProcessIDIsValid() const
129         {
130             return m_pid != LLDB_INVALID_PROCESS_ID;
131         }
132
133         void
134         Dump (Stream &s, Platform *platform) const;
135
136         Args &
137         GetArguments ()
138         {
139             return m_arguments;
140         }
141
142         const Args &
143         GetArguments () const
144         {
145             return m_arguments;
146         }
147
148         const char *
149         GetArg0 () const;
150
151         void
152         SetArg0 (const char *arg);
153
154         void
155         SetArguments (const Args& args, bool first_arg_is_executable);
156
157         void
158         SetArguments (char const **argv, bool first_arg_is_executable);
159
160         Args &
161         GetEnvironmentEntries ()
162         {
163             return m_environment;
164         }
165
166         const Args &
167         GetEnvironmentEntries () const
168         {
169             return m_environment;
170         }
171
172     protected:
173         FileSpec m_executable;
174         std::string m_arg0; // argv[0] if supported. If empty, then use m_executable.
175         // Not all process plug-ins support specifying an argv[0]
176         // that differs from the resolved platform executable
177         // (which is in m_executable)
178         Args m_arguments;   // All program arguments except argv[0]
179         Args m_environment;
180         uint32_t m_uid;
181         uint32_t m_gid;
182         ArchSpec m_arch;
183         lldb::pid_t m_pid;
184     };
185 }
186
187 #endif // #ifndef liblldb_ProcessInfo_h_
188