1 //===-- NativeRegisterContextNetBSD_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__) 10 11 #ifndef lldb_NativeRegisterContextNetBSD_x86_64_h 12 #define lldb_NativeRegisterContextNetBSD_x86_64_h 13 14 // clang-format off 15 #include <sys/param.h> 16 #include <sys/types.h> 17 #include <sys/ptrace.h> 18 #include <machine/reg.h> 19 // clang-format on 20 21 #include "Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h" 22 #include "Plugins/Process/Utility/RegisterContext_x86.h" 23 #include "Plugins/Process/Utility/lldb-x86-register-enums.h" 24 25 #if defined(PT_GETXSTATE) && defined(PT_SETXSTATE) 26 #define HAVE_XSTATE 27 #endif 28 29 namespace lldb_private { 30 namespace process_netbsd { 31 32 class NativeProcessNetBSD; 33 34 class NativeRegisterContextNetBSD_x86_64 : public NativeRegisterContextNetBSD { 35 public: 36 NativeRegisterContextNetBSD_x86_64(const ArchSpec &target_arch, 37 NativeThreadProtocol &native_thread); 38 uint32_t GetRegisterSetCount() const override; 39 40 const RegisterSet *GetRegisterSet(uint32_t set_index) const override; 41 42 Status ReadRegister(const RegisterInfo *reg_info, 43 RegisterValue ®_value) override; 44 45 Status WriteRegister(const RegisterInfo *reg_info, 46 const RegisterValue ®_value) override; 47 48 Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; 49 50 Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; 51 52 Status IsWatchpointHit(uint32_t wp_index, bool &is_hit) override; 53 54 Status GetWatchpointHitIndex(uint32_t &wp_index, 55 lldb::addr_t trap_addr) override; 56 57 Status IsWatchpointVacant(uint32_t wp_index, bool &is_vacant) override; 58 59 bool ClearHardwareWatchpoint(uint32_t wp_index) override; 60 61 Status ClearAllHardwareWatchpoints() override; 62 63 Status SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, 64 uint32_t watch_flags, 65 uint32_t wp_index); 66 67 uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, 68 uint32_t watch_flags) override; 69 70 lldb::addr_t GetWatchpointAddress(uint32_t wp_index) override; 71 72 uint32_t NumSupportedHardwareWatchpoints() override; 73 74 private: 75 // Private member types. 76 enum { GPRegSet, FPRegSet, XStateRegSet, DBRegSet }; 77 78 // Private member variables. 79 struct reg m_gpr_x86_64; 80 struct fpreg m_fpr_x86_64; 81 struct dbreg m_dbr_x86_64; 82 #ifdef HAVE_XSTATE 83 struct xstate m_xstate_x86_64; 84 #endif 85 86 int GetSetForNativeRegNum(int reg_num) const; 87 88 Status ReadRegisterSet(uint32_t set); 89 Status WriteRegisterSet(uint32_t set); 90 }; 91 92 } // namespace process_netbsd 93 } // namespace lldb_private 94 95 #endif // #ifndef lldb_NativeRegisterContextNetBSD_x86_64_h 96 97 #endif // defined(__x86_64__) 98