Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
39654 views
//===-- NativeProcessNetBSD.h --------------------------------- -*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef liblldb_NativeProcessNetBSD_H_9#define liblldb_NativeProcessNetBSD_H_1011#include "Plugins/Process/POSIX/NativeProcessELF.h"12#include "lldb/Target/MemoryRegionInfo.h"13#include "lldb/Utility/ArchSpec.h"14#include "lldb/Utility/FileSpec.h"1516#include "NativeThreadNetBSD.h"1718namespace lldb_private {19namespace process_netbsd {20/// \class NativeProcessNetBSD21/// Manages communication with the inferior (debugee) process.22///23/// Upon construction, this class prepares and launches an inferior process24/// for debugging.25///26/// Changes in the inferior process state are broadcasted.27class NativeProcessNetBSD : public NativeProcessELF {28public:29class Manager : public NativeProcessProtocol::Manager {30public:31using NativeProcessProtocol::Manager::Manager;3233llvm::Expected<std::unique_ptr<NativeProcessProtocol>>34Launch(ProcessLaunchInfo &launch_info,35NativeDelegate &native_delegate) override;3637llvm::Expected<std::unique_ptr<NativeProcessProtocol>>38Attach(lldb::pid_t pid, NativeDelegate &native_delegate) override;3940Extension GetSupportedExtensions() const override;41};4243// NativeProcessProtocol Interface44Status Resume(const ResumeActionList &resume_actions) override;4546Status Halt() override;4748Status Detach() override;4950Status Signal(int signo) override;5152Status Interrupt() override;5354Status Kill() override;5556Status GetMemoryRegionInfo(lldb::addr_t load_addr,57MemoryRegionInfo &range_info) override;5859Status ReadMemory(lldb::addr_t addr, void *buf, size_t size,60size_t &bytes_read) override;6162Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size,63size_t &bytes_written) override;6465lldb::addr_t GetSharedLibraryInfoAddress() override;6667size_t UpdateThreads() override;6869const ArchSpec &GetArchitecture() const override { return m_arch; }7071Status SetBreakpoint(lldb::addr_t addr, uint32_t size,72bool hardware) override;7374// The two following methods are probably not necessary and probably75// will never be called. Nevertheless, we implement them right now76// to reduce the differences between different platforms and reduce77// the risk of the lack of implementation actually breaking something,78// at least for the time being.79Status GetLoadedModuleFileSpec(const char *module_path,80FileSpec &file_spec) override;81Status GetFileLoadAddress(const llvm::StringRef &file_name,82lldb::addr_t &load_addr) override;8384llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>85GetAuxvData() const override;8687// Interface used by NativeRegisterContext-derived classes.88static Status PtraceWrapper(int req, lldb::pid_t pid, void *addr = nullptr,89int data = 0, int *result = nullptr);90static Status StopProcess(lldb::pid_t pid);9192llvm::Expected<std::string> SaveCore(llvm::StringRef path_hint) override;9394private:95MainLoop::SignalHandleUP m_sigchld_handle;96ArchSpec m_arch;97MainLoop& m_main_loop;98LazyBool m_supports_mem_region = eLazyBoolCalculate;99std::vector<std::pair<MemoryRegionInfo, FileSpec>> m_mem_region_cache;100101// Private Instance Methods102NativeProcessNetBSD(::pid_t pid, int terminal_fd, NativeDelegate &delegate,103const ArchSpec &arch, MainLoop &mainloop);104105bool HasThreadNoLock(lldb::tid_t thread_id);106107NativeThreadNetBSD &AddThread(lldb::tid_t thread_id);108void RemoveThread(lldb::tid_t thread_id);109110void MonitorCallback(lldb::pid_t pid, int signal);111void MonitorExited(lldb::pid_t pid, WaitStatus status);112void MonitorSIGSTOP(lldb::pid_t pid);113void MonitorSIGTRAP(lldb::pid_t pid);114void MonitorSignal(lldb::pid_t pid, int signal);115void MonitorClone(::pid_t child_pid, bool is_vfork,116NativeThreadNetBSD &parent_thread);117118Status PopulateMemoryRegionCache();119void SigchldHandler();120121Status Attach();122Status SetupTrace();123Status ReinitializeThreads();124};125126} // namespace process_netbsd127} // namespace lldb_private128129#endif // #ifndef liblldb_NativeProcessNetBSD_H_130131132