1317027Sdim//===-- NativeThreadNetBSD.h ---------------------------------- -*- C++ -*-===// 2317027Sdim// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6317027Sdim// 7317027Sdim//===----------------------------------------------------------------------===// 8317027Sdim 9317027Sdim#ifndef liblldb_NativeThreadNetBSD_H_ 10317027Sdim#define liblldb_NativeThreadNetBSD_H_ 11317027Sdim 12317027Sdim#include "lldb/Host/common/NativeThreadProtocol.h" 13317027Sdim 14360784Sdim#include "Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h" 15360784Sdim 16321238Sdim#include <csignal> 17317230Sdim#include <map> 18317230Sdim#include <string> 19317230Sdim 20317027Sdimnamespace lldb_private { 21317027Sdimnamespace process_netbsd { 22317027Sdim 23317027Sdimclass NativeProcessNetBSD; 24317027Sdim 25317027Sdimclass NativeThreadNetBSD : public NativeThreadProtocol { 26317027Sdim friend class NativeProcessNetBSD; 27317027Sdim 28317027Sdimpublic: 29321238Sdim NativeThreadNetBSD(NativeProcessNetBSD &process, lldb::tid_t tid); 30317027Sdim 31317027Sdim // NativeThreadProtocol Interface 32317027Sdim std::string GetName() override; 33317027Sdim 34317027Sdim lldb::StateType GetState() override; 35317027Sdim 36317027Sdim bool GetStopReason(ThreadStopInfo &stop_info, 37317027Sdim std::string &description) override; 38317027Sdim 39360784Sdim NativeRegisterContextNetBSD &GetRegisterContext() override; 40317027Sdim 41318384Sdim Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, 42318384Sdim bool hardware) override; 43317027Sdim 44318384Sdim Status RemoveWatchpoint(lldb::addr_t addr) override; 45317027Sdim 46318384Sdim Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override; 47317027Sdim 48318384Sdim Status RemoveHardwareBreakpoint(lldb::addr_t addr) override; 49317027Sdim 50317027Sdimprivate: 51317027Sdim // Interface for friend classes 52317027Sdim 53360784Sdim Status Resume(); 54360784Sdim Status SingleStep(); 55360784Sdim Status Suspend(); 56360784Sdim 57317027Sdim void SetStoppedBySignal(uint32_t signo, const siginfo_t *info = nullptr); 58317027Sdim void SetStoppedByBreakpoint(); 59317027Sdim void SetStoppedByTrace(); 60317027Sdim void SetStoppedByExec(); 61317230Sdim void SetStoppedByWatchpoint(uint32_t wp_index); 62360784Sdim void SetStoppedWithNoReason(); 63317027Sdim void SetStopped(); 64317027Sdim void SetRunning(); 65317027Sdim void SetStepping(); 66317027Sdim 67360784Sdim Status CopyWatchpointsFrom(NativeThreadNetBSD& source); 68360784Sdim 69317027Sdim // Member Variables 70317027Sdim lldb::StateType m_state; 71317027Sdim ThreadStopInfo m_stop_info; 72360784Sdim std::unique_ptr<NativeRegisterContextNetBSD> m_reg_context_up; 73317027Sdim std::string m_stop_description; 74317230Sdim using WatchpointIndexMap = std::map<lldb::addr_t, uint32_t>; 75317230Sdim WatchpointIndexMap m_watchpoint_index_map; 76317230Sdim WatchpointIndexMap m_hw_break_index_map; 77317027Sdim}; 78317027Sdim 79317027Sdimtypedef std::shared_ptr<NativeThreadNetBSD> NativeThreadNetBSDSP; 80317027Sdim} // namespace process_netbsd 81317027Sdim} // namespace lldb_private 82317027Sdim 83317027Sdim#endif // #ifndef liblldb_NativeThreadNetBSD_H_ 84