1 //===-- NativeThreadWindows.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_NativeThreadWindows_h_ 10 #define liblldb_NativeThreadWindows_h_ 11 12 #include "lldb/Host/HostThread.h" 13 #include "lldb/Host/common/NativeThreadProtocol.h" 14 #include "lldb/lldb-private-forward.h" 15 16 #include "NativeRegisterContextWindows.h" 17 18 namespace lldb_private { 19 20 class NativeProcessWindows; 21 22 class NativeThreadWindows : public NativeThreadProtocol { 23 public: 24 NativeThreadWindows(NativeProcessWindows &process, const HostThread &thread); 25 ~NativeThreadWindows()26 ~NativeThreadWindows() {} 27 28 Status DoStop(); 29 Status DoResume(lldb::StateType resume_state); 30 31 std::string GetName() override; 32 GetState()33 lldb::StateType GetState() override { return m_state; } 34 GetRegisterContext()35 NativeRegisterContextWindows &GetRegisterContext() override { 36 return *m_reg_context_up; 37 } 38 39 bool GetStopReason(ThreadStopInfo &stop_info, 40 std::string &description) override; 41 42 Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, 43 bool hardware) override; 44 45 Status RemoveWatchpoint(lldb::addr_t addr) override; 46 47 Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override; 48 49 Status RemoveHardwareBreakpoint(lldb::addr_t addr) override; 50 51 void SetStopReason(ThreadStopInfo stop_info, std::string description); 52 GetHostThread()53 const HostThread &GetHostThread() { return m_host_thread; } 54 55 protected: 56 lldb::StateType m_state = lldb::StateType::eStateInvalid; 57 std::string m_name; 58 ThreadStopInfo m_stop_info; 59 std::string m_stop_description; 60 std::unique_ptr<NativeRegisterContextWindows> m_reg_context_up; 61 // Cache address and index of the watchpoints and hardware breakpoints since 62 // the register context does not. 63 using IndexMap = std::map<lldb::addr_t, uint32_t>; 64 IndexMap m_watchpoint_index_map; 65 IndexMap m_hw_breakpoint_index_map; 66 HostThread m_host_thread; 67 }; 68 } // namespace lldb_private 69 70 #endif // #ifndef liblldb_NativeThreadWindows_h_ 71