1 //===-- RegisterContextPOSIXProcessMonitor_mips64.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_mips64_H_
11 #define liblldb_RegisterContextPOSIXProcessMonitor_mips64_H_
12 
13 #include "Plugins/Process/Utility/RegisterContextPOSIX_mips64.h"
14 #include "Plugins/Process/Utility/lldb-mips-freebsd-register-enums.h"
15 #include "RegisterContextPOSIX.h"
16 
17 class RegisterContextPOSIXProcessMonitor_mips64
18     : public RegisterContextPOSIX_mips64,
19       public POSIXBreakpointProtocol {
20 public:
21   RegisterContextPOSIXProcessMonitor_mips64(
22       lldb_private::Thread &thread, uint32_t concrete_frame_idx,
23       lldb_private::RegisterInfoInterface *register_info);
24 
25 protected:
26   bool ReadGPR();
27 
28   bool ReadFPR();
29 
30   bool WriteGPR();
31 
32   bool WriteFPR();
33 
34   // lldb_private::RegisterContext
35   bool ReadRegister(const unsigned reg, lldb_private::RegisterValue &value);
36 
37   bool WriteRegister(const unsigned reg,
38                      const lldb_private::RegisterValue &value);
39 
40   bool ReadRegister(const lldb_private::RegisterInfo *reg_info,
41                     lldb_private::RegisterValue &value);
42 
43   bool WriteRegister(const lldb_private::RegisterInfo *reg_info,
44                      const lldb_private::RegisterValue &value);
45 
46   bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp);
47 
48   bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);
49 
50   uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read,
51                                  bool write);
52 
53   bool ClearHardwareWatchpoint(uint32_t hw_index);
54 
55   bool HardwareSingleStep(bool enable);
56 
57   // POSIXBreakpointProtocol
58   bool UpdateAfterBreakpoint();
59 
60   unsigned GetRegisterIndexFromOffset(unsigned offset);
61 
62   bool IsWatchpointHit(uint32_t hw_index);
63 
64   bool ClearWatchpointHits();
65 
66   lldb::addr_t GetWatchpointAddress(uint32_t hw_index);
67 
68   bool IsWatchpointVacant(uint32_t hw_index);
69 
70   bool SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, bool read,
71                                       bool write, uint32_t hw_index);
72 
73   uint32_t NumSupportedHardwareWatchpoints();
74 
75 private:
76   uint64_t
77   m_gpr_mips64[k_num_gpr_registers_mips64]; // general purpose registers.
78   ProcessMonitor &GetMonitor();
79 };
80 
81 #endif
82