1 //===-- NativeRegisterContextDBReg_arm64.h ----------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef lldb_NativeRegisterContextDBReg_arm64_h
10 #define lldb_NativeRegisterContextDBReg_arm64_h
12 #include "Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h"
16 namespace lldb_private
{
18 class NativeRegisterContextDBReg_arm64
19 : public virtual NativeRegisterContextRegisterInfo
{
21 uint32_t NumSupportedHardwareBreakpoints() override
;
23 uint32_t SetHardwareBreakpoint(lldb::addr_t addr
, size_t size
) override
;
25 bool ClearHardwareBreakpoint(uint32_t hw_idx
) override
;
27 Status
ClearAllHardwareBreakpoints() override
;
29 Status
GetHardwareBreakHitIndex(uint32_t &bp_index
,
30 lldb::addr_t trap_addr
) override
;
32 bool BreakpointIsEnabled(uint32_t bp_index
);
34 uint32_t NumSupportedHardwareWatchpoints() override
;
36 uint32_t SetHardwareWatchpoint(lldb::addr_t addr
, size_t size
,
37 uint32_t watch_flags
) override
;
39 bool ClearHardwareWatchpoint(uint32_t hw_index
) override
;
41 Status
ClearAllHardwareWatchpoints() override
;
43 Status
GetWatchpointHitIndex(uint32_t &wp_index
,
44 lldb::addr_t trap_addr
) override
;
46 lldb::addr_t
GetWatchpointHitAddress(uint32_t wp_index
) override
;
48 lldb::addr_t
GetWatchpointAddress(uint32_t wp_index
) override
;
50 uint32_t GetWatchpointSize(uint32_t wp_index
);
52 bool WatchpointIsEnabled(uint32_t wp_index
);
54 // Debug register type select
55 enum DREGType
{ eDREGTypeWATCH
= 0, eDREGTypeBREAK
};
58 /// Debug register info for hardware breakpoints and watchpoints management.
59 /// Watchpoints: For a user requested size 4 at addr 0x1004, where BAS
60 /// watchpoints are at doubleword (8-byte) alignment.
61 /// \a real_addr is 0x1004
62 /// \a address is 0x1000
64 /// If a one-byte write to 0x1006 is the most recent watchpoint trap,
65 /// \a hit_addr is 0x1006
67 lldb::addr_t address
; // Breakpoint/watchpoint address value.
68 lldb::addr_t hit_addr
; // Address at which last watchpoint trigger exception
70 lldb::addr_t real_addr
; // Address value that should cause target to stop.
71 uint32_t control
; // Breakpoint/watchpoint control value.
74 std::array
<struct DREG
, 16> m_hbp_regs
; // hardware breakpoints
75 std::array
<struct DREG
, 16> m_hwp_regs
; // hardware watchpoints
77 uint32_t m_max_hbp_supported
;
78 uint32_t m_max_hwp_supported
;
80 virtual llvm::Error
ReadHardwareDebugInfo() = 0;
81 virtual llvm::Error
WriteHardwareDebugRegs(DREGType hwbType
) = 0;
82 virtual lldb::addr_t
FixWatchpointHitAddress(lldb::addr_t hit_addr
) {
87 } // namespace lldb_private
89 #endif // #ifndef lldb_NativeRegisterContextDBReg_arm64_h