LLDB mainline
NativeRegisterContextFreeBSD_arm64.h
Go to the documentation of this file.
1//===-- NativeRegisterContextFreeBSD_arm64.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(__aarch64__)
10
11#ifndef lldb_NativeRegisterContextFreeBSD_arm64_h
12#define lldb_NativeRegisterContextFreeBSD_arm64_h
13
14// clang-format off
15#include <sys/types.h>
16#include <sys/param.h>
17#include <machine/reg.h>
18// clang-format on
19
23
24#include <array>
25
26#if __FreeBSD_version >= 1300139
27# define LLDB_HAS_FREEBSD_WATCHPOINT 1
28#endif
29
30namespace lldb_private {
31namespace process_freebsd {
32
33class NativeProcessFreeBSD;
34
35class NativeRegisterContextFreeBSD_arm64
36 : public NativeRegisterContextFreeBSD,
37 public NativeRegisterContextDBReg_arm64 {
38public:
39 NativeRegisterContextFreeBSD_arm64(const ArchSpec &target_arch,
40 NativeThreadProtocol &native_thread);
41
42 uint32_t GetRegisterSetCount() const override;
43
44 uint32_t GetUserRegisterCount() const override;
45
46 const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
47
48 Status ReadRegister(const RegisterInfo *reg_info,
49 RegisterValue &reg_value) override;
50
51 Status WriteRegister(const RegisterInfo *reg_info,
52 const RegisterValue &reg_value) override;
53
54 Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override;
55
56 Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
57
58 llvm::Error
59 CopyHardwareWatchpointsFrom(NativeRegisterContextFreeBSD &source) override;
60
61private:
62 // Due to alignment, FreeBSD reg/fpreg are a few bytes larger than
63 // LLDB's GPR/FPU structs. However, all fields have matching offsets
64 // and sizes, so we do not have to worry about these (and we have
65 // a unittest to assert that).
66 std::array<uint8_t, sizeof(reg) + sizeof(fpreg)> m_reg_data;
67#ifdef LLDB_HAS_FREEBSD_WATCHPOINT
68 dbreg m_dbreg;
69 bool m_read_dbreg;
70#endif
71
72 Status ReadRegisterSet(uint32_t set);
73 Status WriteRegisterSet(uint32_t set);
74
75 llvm::Error ReadHardwareDebugInfo() override;
76 llvm::Error WriteHardwareDebugRegs(DREGType hwbType) override;
77
78 RegisterInfoPOSIX_arm64 &GetRegisterInfo() const;
79};
80
81} // namespace process_freebsd
82} // namespace lldb_private
83
84#endif // #ifndef lldb_NativeRegisterContextFreeBSD_arm64_h
85
86#endif // defined (__aarch64__)
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:328
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
Definition: lldb-forward.h:329