1 //===-- HostProcess.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 lldb_Host_HostProcess_h_
11 #define lldb_Host_HostProcess_h_
12 
13 #include "lldb/Host/Host.h"
14 #include "lldb/lldb-types.h"
15 
16 //----------------------------------------------------------------------
17 /// @class HostInfo HostInfo.h "lldb/Host/HostProcess.h"
18 /// A class that represents a running process on the host machine.
19 ///
20 /// HostProcess allows querying and manipulation of processes running on the
21 /// host machine.  It is not intended to be represent a process which is being
22 /// debugged, although the native debug engine of a platform may likely back
23 /// inferior processes by a HostProcess.
24 ///
25 /// HostProcess is implemented using static polymorphism so that on any given
26 /// platform, an instance of HostProcess will always be able to bind
27 /// statically to the concrete Process implementation for that platform.  See
28 /// HostInfo for more details.
29 ///
30 //----------------------------------------------------------------------
31 
32 namespace lldb_private {
33 
34 class HostNativeProcessBase;
35 class HostThread;
36 
37 class HostProcess {
38 public:
39   HostProcess();
40   HostProcess(lldb::process_t process);
41   ~HostProcess();
42 
43   Status Terminate();
44   Status GetMainModule(FileSpec &file_spec) const;
45 
46   lldb::pid_t GetProcessId() const;
47   bool IsRunning() const;
48 
49   HostThread StartMonitoring(const Host::MonitorChildProcessCallback &callback,
50                              bool monitor_signals);
51 
52   HostNativeProcessBase &GetNativeProcess();
53   const HostNativeProcessBase &GetNativeProcess() const;
54 
55 private:
56   std::shared_ptr<HostNativeProcessBase> m_native_process;
57 };
58 }
59 
60 #endif
61