1*5146a9eaSAaron Smith //===-- NativeThreadWindows.h -----------------------------------*- C++ -*-===// 2*5146a9eaSAaron Smith // 3*5146a9eaSAaron Smith // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*5146a9eaSAaron Smith // See https://llvm.org/LICENSE.txt for license information. 5*5146a9eaSAaron Smith // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*5146a9eaSAaron Smith // 7*5146a9eaSAaron Smith //===----------------------------------------------------------------------===// 8*5146a9eaSAaron Smith 9*5146a9eaSAaron Smith #ifndef liblldb_NativeThreadWindows_h_ 10*5146a9eaSAaron Smith #define liblldb_NativeThreadWindows_h_ 11*5146a9eaSAaron Smith 12*5146a9eaSAaron Smith #include "lldb/Host/HostThread.h" 13*5146a9eaSAaron Smith #include "lldb/Host/common/NativeThreadProtocol.h" 14*5146a9eaSAaron Smith #include "lldb/lldb-private-forward.h" 15*5146a9eaSAaron Smith 16*5146a9eaSAaron Smith #include "NativeRegisterContextWindows.h" 17*5146a9eaSAaron Smith 18*5146a9eaSAaron Smith namespace lldb_private { 19*5146a9eaSAaron Smith 20*5146a9eaSAaron Smith class NativeProcessWindows; 21*5146a9eaSAaron Smith 22*5146a9eaSAaron Smith class NativeThreadWindows : public NativeThreadProtocol { 23*5146a9eaSAaron Smith public: 24*5146a9eaSAaron Smith NativeThreadWindows(NativeProcessWindows &process, const HostThread &thread); 25*5146a9eaSAaron Smith ~NativeThreadWindows()26*5146a9eaSAaron Smith ~NativeThreadWindows() {} 27*5146a9eaSAaron Smith 28*5146a9eaSAaron Smith Status DoStop(); 29*5146a9eaSAaron Smith Status DoResume(lldb::StateType resume_state); 30*5146a9eaSAaron Smith 31*5146a9eaSAaron Smith std::string GetName() override; 32*5146a9eaSAaron Smith GetState()33*5146a9eaSAaron Smith lldb::StateType GetState() override { return m_state; } 34*5146a9eaSAaron Smith GetRegisterContext()35*5146a9eaSAaron Smith NativeRegisterContextWindows &GetRegisterContext() override { 36*5146a9eaSAaron Smith return *m_reg_context_up; 37*5146a9eaSAaron Smith } 38*5146a9eaSAaron Smith 39*5146a9eaSAaron Smith bool GetStopReason(ThreadStopInfo &stop_info, 40*5146a9eaSAaron Smith std::string &description) override; 41*5146a9eaSAaron Smith 42*5146a9eaSAaron Smith Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, 43*5146a9eaSAaron Smith bool hardware) override; 44*5146a9eaSAaron Smith 45*5146a9eaSAaron Smith Status RemoveWatchpoint(lldb::addr_t addr) override; 46*5146a9eaSAaron Smith 47*5146a9eaSAaron Smith Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override; 48*5146a9eaSAaron Smith 49*5146a9eaSAaron Smith Status RemoveHardwareBreakpoint(lldb::addr_t addr) override; 50*5146a9eaSAaron Smith 51*5146a9eaSAaron Smith void SetStopReason(ThreadStopInfo stop_info, std::string description); 52*5146a9eaSAaron Smith GetHostThread()53*5146a9eaSAaron Smith const HostThread &GetHostThread() { return m_host_thread; } 54*5146a9eaSAaron Smith 55*5146a9eaSAaron Smith protected: 56*5146a9eaSAaron Smith lldb::StateType m_state = lldb::StateType::eStateInvalid; 57*5146a9eaSAaron Smith std::string m_name; 58*5146a9eaSAaron Smith ThreadStopInfo m_stop_info; 59*5146a9eaSAaron Smith std::string m_stop_description; 60*5146a9eaSAaron Smith std::unique_ptr<NativeRegisterContextWindows> m_reg_context_up; 61*5146a9eaSAaron Smith // Cache address and index of the watchpoints and hardware breakpoints since 62*5146a9eaSAaron Smith // the register context does not. 63*5146a9eaSAaron Smith using IndexMap = std::map<lldb::addr_t, uint32_t>; 64*5146a9eaSAaron Smith IndexMap m_watchpoint_index_map; 65*5146a9eaSAaron Smith IndexMap m_hw_breakpoint_index_map; 66*5146a9eaSAaron Smith HostThread m_host_thread; 67*5146a9eaSAaron Smith }; 68*5146a9eaSAaron Smith } // namespace lldb_private 69*5146a9eaSAaron Smith 70*5146a9eaSAaron Smith #endif // #ifndef liblldb_NativeThreadWindows_h_ 71