1 //===-- HostNativeProcessBase.h ---------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_HOST_HOSTNATIVEPROCESSBASE_H
10 #define LLDB_HOST_HOSTNATIVEPROCESSBASE_H
11 
12 #include "lldb/Host/HostProcess.h"
13 #include "lldb/Utility/Status.h"
14 #include "lldb/lldb-defines.h"
15 #include "lldb/lldb-types.h"
16 
17 namespace lldb_private {
18 
19 class HostThread;
20 
21 class HostNativeProcessBase {
22   HostNativeProcessBase(const HostNativeProcessBase &) = delete;
23   const HostNativeProcessBase &
24   operator=(const HostNativeProcessBase &) = delete;
25 
26 public:
HostNativeProcessBase()27   HostNativeProcessBase() : m_process(LLDB_INVALID_PROCESS) {}
HostNativeProcessBase(lldb::process_t process)28   explicit HostNativeProcessBase(lldb::process_t process)
29       : m_process(process) {}
30   virtual ~HostNativeProcessBase() = default;
31 
32   virtual Status Terminate() = 0;
33 
34   virtual lldb::pid_t GetProcessId() const = 0;
35   virtual bool IsRunning() const = 0;
36 
GetSystemHandle()37   lldb::process_t GetSystemHandle() const { return m_process; }
38 
39   virtual llvm::Expected<HostThread>
40   StartMonitoring(const Host::MonitorChildProcessCallback &callback) = 0;
41 
42 protected:
43   lldb::process_t m_process;
44 };
45 }
46 
47 #endif
48