Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Plugins / Process / NetBSD / NativeRegisterContextNetBSD_x86_64.h
blobe4597b2f69c6cfee2997c4d54ca50f05a7007cb6
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 //===----------------------------------------------------------------------===//
9 #if defined(__i386__) || defined(__x86_64__)
11 #ifndef lldb_NativeRegisterContextNetBSD_x86_64_h
12 #define lldb_NativeRegisterContextNetBSD_x86_64_h
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
21 #include <array>
22 #include <optional>
24 #include "Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h"
25 #include "Plugins/Process/Utility/RegisterContext_x86.h"
26 #include "Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h"
27 #include "Plugins/Process/Utility/lldb-x86-register-enums.h"
29 namespace lldb_private {
30 namespace process_netbsd {
32 class NativeProcessNetBSD;
34 class NativeRegisterContextNetBSD_x86_64
35 : public NativeRegisterContextNetBSD,
36 public NativeRegisterContextDBReg_x86 {
37 public:
38 NativeRegisterContextNetBSD_x86_64(const ArchSpec &target_arch,
39 NativeThreadProtocol &native_thread);
40 uint32_t GetRegisterSetCount() const override;
42 const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
44 Status ReadRegister(const RegisterInfo *reg_info,
45 RegisterValue &reg_value) override;
47 Status WriteRegister(const RegisterInfo *reg_info,
48 const RegisterValue &reg_value) override;
50 Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override;
52 Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
54 llvm::Error
55 CopyHardwareWatchpointsFrom(NativeRegisterContextNetBSD &source) override;
57 private:
58 // Private member types.
59 enum RegSetKind {
60 GPRegSet,
61 FPRegSet,
62 DBRegSet,
63 MaxRegularRegSet = DBRegSet,
64 YMMRegSet,
65 MPXRegSet,
66 MaxRegSet = MPXRegSet,
69 // Private member variables.
70 std::array<uint8_t, sizeof(struct reg)> m_gpr;
71 std::array<uint8_t, sizeof(struct xstate)> m_xstate;
72 std::array<uint8_t, sizeof(struct dbreg)> m_dbr;
73 std::array<size_t, MaxRegularRegSet + 1> m_regset_offsets;
75 std::optional<RegSetKind> GetSetForNativeRegNum(uint32_t reg_num) const;
77 Status ReadRegisterSet(RegSetKind set);
78 Status WriteRegisterSet(RegSetKind set);
80 uint8_t *GetOffsetRegSetData(RegSetKind set, size_t reg_offset);
82 struct YMMSplitPtr {
83 void *xmm;
84 void *ymm_hi;
86 std::optional<YMMSplitPtr> GetYMMSplitReg(uint32_t reg);
89 } // namespace process_netbsd
90 } // namespace lldb_private
92 #endif // #ifndef lldb_NativeRegisterContextNetBSD_x86_64_h
94 #endif // defined(__x86_64__)