1 //===-- NativeRegisterContextWindows_x86_64.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 #if defined(__x86_64__) || defined(_M_X64) 10 #ifndef liblldb_NativeRegisterContextWindows_x86_64_h_ 11 #define liblldb_NativeRegisterContextWindows_x86_64_h_ 12 13 #include "Plugins/Process/Utility/RegisterContext_x86.h" 14 #include "Plugins/Process/Utility/lldb-x86-register-enums.h" 15 16 #include "NativeRegisterContextWindows.h" 17 18 namespace lldb_private { 19 20 class NativeThreadWindows; 21 22 class NativeRegisterContextWindows_x86_64 23 : public NativeRegisterContextWindows { 24 public: 25 NativeRegisterContextWindows_x86_64(const ArchSpec &target_arch, 26 NativeThreadProtocol &native_thread); 27 28 uint32_t GetRegisterSetCount() const override; 29 30 const RegisterSet *GetRegisterSet(uint32_t set_index) const override; 31 32 Status ReadRegister(const RegisterInfo *reg_info, 33 RegisterValue ®_value) override; 34 35 Status WriteRegister(const RegisterInfo *reg_info, 36 const RegisterValue ®_value) override; 37 38 Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override; 39 40 Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; 41 42 Status IsWatchpointHit(uint32_t wp_index, bool &is_hit) override; 43 44 Status GetWatchpointHitIndex(uint32_t &wp_index, 45 lldb::addr_t trap_addr) override; 46 47 Status IsWatchpointVacant(uint32_t wp_index, bool &is_vacant) override; 48 49 bool ClearHardwareWatchpoint(uint32_t wp_index) override; 50 51 Status ClearAllHardwareWatchpoints() override; 52 53 uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, 54 uint32_t watch_flags) override; 55 56 lldb::addr_t GetWatchpointAddress(uint32_t wp_index) override; 57 58 uint32_t NumSupportedHardwareWatchpoints() override; 59 60 protected: 61 Status GPRRead(const uint32_t reg, RegisterValue ®_value); 62 Status GPRWrite(const uint32_t reg, const RegisterValue ®_value); 63 64 Status FPRRead(const uint32_t reg, RegisterValue ®_value); 65 Status FPRWrite(const uint32_t reg, const RegisterValue ®_value); 66 67 Status DRRead(const uint32_t reg, RegisterValue ®_value); 68 Status DRWrite(const uint32_t reg, const RegisterValue ®_value); 69 70 private: 71 Status ApplyHardwareBreakpoint(uint32_t wp_index, lldb::addr_t addr, 72 size_t size, uint32_t flags); 73 74 bool IsGPR(uint32_t reg_index) const; 75 bool IsFPR(uint32_t reg_index) const; 76 bool IsDR(uint32_t reg_index) const; 77 }; 78 79 } // namespace lldb_private 80 81 #endif // liblldb_NativeRegisterContextWindows_x86_64_h_ 82 #endif // defined(__x86_64__) || defined(_M_X64) 83