xref: /src/contrib/llvm-project/lldb/source/Host/common/HostProcess.cpp (revision 81ad626541db97eb356e2c1d4a20eb2a26a766ab)
1cfca06d7SDimitry Andric //===-- HostProcess.cpp ---------------------------------------------------===//
2205afe67SEd Maste //
35f29bb8aSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45f29bb8aSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
55f29bb8aSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6205afe67SEd Maste //
7205afe67SEd Maste //===----------------------------------------------------------------------===//
8205afe67SEd Maste 
9205afe67SEd Maste #include "lldb/Host/HostProcess.h"
1014f1b3e8SDimitry Andric #include "lldb/Host/HostNativeProcess.h"
11205afe67SEd Maste #include "lldb/Host/HostThread.h"
12205afe67SEd Maste 
13205afe67SEd Maste using namespace lldb;
14205afe67SEd Maste using namespace lldb_private;
15205afe67SEd Maste 
HostProcess()1614f1b3e8SDimitry Andric HostProcess::HostProcess() : m_native_process(new HostNativeProcess) {}
17205afe67SEd Maste 
HostProcess(lldb::process_t process)18205afe67SEd Maste HostProcess::HostProcess(lldb::process_t process)
1914f1b3e8SDimitry Andric     : m_native_process(new HostNativeProcess(process)) {}
20205afe67SEd Maste 
21344a3780SDimitry Andric HostProcess::~HostProcess() = default;
22205afe67SEd Maste 
Terminate()23b76161e4SDimitry Andric Status HostProcess::Terminate() { return m_native_process->Terminate(); }
24205afe67SEd Maste 
GetProcessId() const2514f1b3e8SDimitry Andric lldb::pid_t HostProcess::GetProcessId() const {
26205afe67SEd Maste   return m_native_process->GetProcessId();
27205afe67SEd Maste }
28205afe67SEd Maste 
IsRunning() const2914f1b3e8SDimitry Andric bool HostProcess::IsRunning() const { return m_native_process->IsRunning(); }
30205afe67SEd Maste 
StartMonitoring(const Host::MonitorChildProcessCallback & callback)31145449b1SDimitry Andric llvm::Expected<HostThread> HostProcess::StartMonitoring(
32145449b1SDimitry Andric     const Host::MonitorChildProcessCallback &callback) {
33145449b1SDimitry Andric   return m_native_process->StartMonitoring(callback);
34205afe67SEd Maste }
35205afe67SEd Maste 
GetNativeProcess()3614f1b3e8SDimitry Andric HostNativeProcessBase &HostProcess::GetNativeProcess() {
37205afe67SEd Maste   return *m_native_process;
38205afe67SEd Maste }
39205afe67SEd Maste 
GetNativeProcess() const4014f1b3e8SDimitry Andric const HostNativeProcessBase &HostProcess::GetNativeProcess() const {
41205afe67SEd Maste   return *m_native_process;
42205afe67SEd Maste }
43