1 //===-- NativeRegisterContextNetBSD.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 lldb_NativeRegisterContextNetBSD_h
11 #define lldb_NativeRegisterContextNetBSD_h
12 
13 #include "lldb/Host/common/NativeThreadProtocol.h"
14 
15 #include "Plugins/Process/NetBSD/NativeProcessNetBSD.h"
16 #include "Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h"
17 
18 namespace lldb_private {
19 namespace process_netbsd {
20 
21 class NativeRegisterContextNetBSD : public NativeRegisterContextRegisterInfo {
22 public:
23   NativeRegisterContextNetBSD(NativeThreadProtocol &native_thread,
24                               uint32_t concrete_frame_idx,
25                               RegisterInfoInterface *reg_info_interface_p);
26 
27   // This function is implemented in the NativeRegisterContextNetBSD_*
28   // subclasses to create a new instance of the host specific
29   // NativeRegisterContextNetBSD. The implementations can't collide as only one
30   // NativeRegisterContextNetBSD_* variant should be compiled into the final
31   // executable.
32   static NativeRegisterContextNetBSD *
33   CreateHostNativeRegisterContextNetBSD(const ArchSpec &target_arch,
34                                         NativeThreadProtocol &native_thread,
35                                         uint32_t concrete_frame_idx);
36 
37 protected:
38   virtual Error ReadGPR();
39   virtual Error WriteGPR();
40 
41   virtual Error ReadFPR();
42   virtual Error WriteFPR();
43 
44   virtual Error ReadDBR();
45   virtual Error WriteDBR();
46 
47   virtual void *GetGPRBuffer() { return nullptr; }
48   virtual size_t GetGPRSize() {
49     return GetRegisterInfoInterface().GetGPRSize();
50   }
51 
52   virtual void *GetFPRBuffer() { return nullptr; }
53   virtual size_t GetFPRSize() { return 0; }
54 
55   virtual void *GetDBRBuffer() { return nullptr; }
56   virtual size_t GetDBRSize() { return 0; }
57 
58   virtual Error DoReadGPR(void *buf);
59   virtual Error DoWriteGPR(void *buf);
60 
61   virtual Error DoReadFPR(void *buf);
62   virtual Error DoWriteFPR(void *buf);
63 
64   virtual Error DoReadDBR(void *buf);
65   virtual Error DoWriteDBR(void *buf);
66 
67   virtual NativeProcessNetBSD &GetProcess();
68   virtual ::pid_t GetProcessPid();
69 };
70 
71 } // namespace process_netbsd
72 } // namespace lldb_private
73 
74 #endif // #ifndef lldb_NativeRegisterContextNetBSD_h
75