HostProcess.h 1.7 KB

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