1 //===-- NativeThreadNetBSD.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 liblldb_NativeThreadNetBSD_H_ 10 #define liblldb_NativeThreadNetBSD_H_ 11 12 #include "lldb/Host/common/NativeThreadProtocol.h" 13 14 #include <csignal> 15 #include <map> 16 #include <string> 17 18 namespace lldb_private { 19 namespace process_netbsd { 20 21 class NativeProcessNetBSD; 22 23 class NativeThreadNetBSD : public NativeThreadProtocol { 24 friend class NativeProcessNetBSD; 25 26 public: 27 NativeThreadNetBSD(NativeProcessNetBSD &process, lldb::tid_t tid); 28 29 // NativeThreadProtocol Interface 30 std::string GetName() override; 31 32 lldb::StateType GetState() override; 33 34 bool GetStopReason(ThreadStopInfo &stop_info, 35 std::string &description) override; 36 37 NativeRegisterContext& GetRegisterContext() override; 38 39 Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, 40 bool hardware) override; 41 42 Status RemoveWatchpoint(lldb::addr_t addr) override; 43 44 Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override; 45 46 Status RemoveHardwareBreakpoint(lldb::addr_t addr) override; 47 48 private: 49 // Interface for friend classes 50 51 void SetStoppedBySignal(uint32_t signo, const siginfo_t *info = nullptr); 52 void SetStoppedByBreakpoint(); 53 void SetStoppedByTrace(); 54 void SetStoppedByExec(); 55 void SetStoppedByWatchpoint(uint32_t wp_index); 56 void SetStopped(); 57 void SetRunning(); 58 void SetStepping(); 59 60 // Member Variables 61 lldb::StateType m_state; 62 ThreadStopInfo m_stop_info; 63 std::unique_ptr<NativeRegisterContext> m_reg_context_up; 64 std::string m_stop_description; 65 using WatchpointIndexMap = std::map<lldb::addr_t, uint32_t>; 66 WatchpointIndexMap m_watchpoint_index_map; 67 WatchpointIndexMap m_hw_break_index_map; 68 }; 69 70 typedef std::shared_ptr<NativeThreadNetBSD> NativeThreadNetBSDSP; 71 } // namespace process_netbsd 72 } // namespace lldb_private 73 74 #endif // #ifndef liblldb_NativeThreadNetBSD_H_ 75