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
26namespace lldb_private {
27namespace process_freebsd {
28
30
31class NativeRegisterContextFreeBSD_arm64
33 public NativeRegisterContextDBReg_arm64 {
34public:
35 NativeRegisterContextFreeBSD_arm64(const ArchSpec &target_arch,
36 NativeThreadFreeBSD &native_thread);
37
38 uint32_t GetRegisterSetCount() const override;
39
40 uint32_t GetUserRegisterCount() const override;
41
42 const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
43
44 Status ReadRegister(const RegisterInfo *reg_info,
45 RegisterValue &reg_value) override;
46
47 Status WriteRegister(const RegisterInfo *reg_info,
48 const RegisterValue &reg_value) override;
49
50 Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override;
51
52 Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
53
54 llvm::Error
55 CopyHardwareWatchpointsFrom(NativeRegisterContextFreeBSD &source) override;
56
57private:
58 // Due to alignment, FreeBSD reg/fpreg are a few bytes larger than
59 // LLDB's GPR/FPU structs. However, all fields have matching offsets
60 // and sizes, so we do not have to worry about these (and we have
61 // a unittest to assert that).
62 std::array<uint8_t, sizeof(reg) + sizeof(fpreg)> m_reg_data;
63 dbreg m_dbreg;
64 bool m_read_dbreg;
65
66 Status ReadRegisterSet(uint32_t set);
67 Status WriteRegisterSet(uint32_t set);
68
69 llvm::Error ReadHardwareDebugInfo() override;
70 llvm::Error WriteHardwareDebugRegs(DREGType hwbType) override;
71
72 RegisterInfoPOSIX_arm64 &GetRegisterInfo() const;
73};
74
75} // namespace process_freebsd
76} // namespace lldb_private
77
78#endif // #ifndef lldb_NativeRegisterContextFreeBSD_arm64_h
79
80#endif // defined (__aarch64__)
Manages communication with the inferior (debugee) process.
Status WriteHardwareDebugRegs(int hwbType, ::pid_t tid, uint32_t max_supported, const std::array< NativeRegisterContextDBReg::DREG, 16 > &regs)
Status ReadHardwareDebugInfo(::pid_t tid, uint32_t &max_hwp_supported, uint32_t &max_hbp_supported)
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP