1 //===-- RegisterContextPOSIXProcessMonitor_arm64.h --------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef liblldb_RegisterContextPOSIXProcessMonitor_arm64_H_
11 #define liblldb_RegisterContextPOSIXProcessMonitor_arm64_H_
12 
13 #include "Plugins/Process/Utility/RegisterContextPOSIX_arm64.h"
14 #include "RegisterContextPOSIX.h"
15 
16 class RegisterContextPOSIXProcessMonitor_arm64
17     : public RegisterContextPOSIX_arm64,
18       public POSIXBreakpointProtocol {
19 public:
20   RegisterContextPOSIXProcessMonitor_arm64(
21       lldb_private::Thread &thread, uint32_t concrete_frame_idx,
22       lldb_private::RegisterInfoInterface *register_info);
23 
24 protected:
25   bool ReadGPR();
26 
27   bool ReadFPR();
28 
29   bool WriteGPR();
30 
31   bool WriteFPR();
32 
33   // lldb_private::RegisterContext
34   bool ReadRegister(const unsigned reg, lldb_private::RegisterValue &value);
35 
36   bool WriteRegister(const unsigned reg,
37                      const lldb_private::RegisterValue &value);
38 
39   bool ReadRegister(const lldb_private::RegisterInfo *reg_info,
40                     lldb_private::RegisterValue &value);
41 
42   bool WriteRegister(const lldb_private::RegisterInfo *reg_info,
43                      const lldb_private::RegisterValue &value);
44 
45   bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp);
46 
47   bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);
48 
49   uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read,
50                                  bool write);
51 
52   bool ClearHardwareWatchpoint(uint32_t hw_index);
53 
54   bool HardwareSingleStep(bool enable);
55 
56   // POSIXBreakpointProtocol
57   bool UpdateAfterBreakpoint();
58 
59   unsigned GetRegisterIndexFromOffset(unsigned offset);
60 
61   bool IsWatchpointHit(uint32_t hw_index);
62 
63   bool ClearWatchpointHits();
64 
65   lldb::addr_t GetWatchpointAddress(uint32_t hw_index);
66 
67   bool IsWatchpointVacant(uint32_t hw_index);
68 
69   bool SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, bool read,
70                                       bool write, uint32_t hw_index);
71 
72   uint32_t NumSupportedHardwareWatchpoints();
73 
74 private:
75   ProcessMonitor &GetMonitor();
76 };
77 
78 #endif
79