LLDB  mainline
NativeRegisterContextNetBSD.cpp
Go to the documentation of this file.
1 //===-- NativeRegisterContextNetBSD.cpp -------------------------*- 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 
10 
12 
13 using namespace lldb_private;
14 using namespace lldb_private::process_netbsd;
15 
16 // clang-format off
17 #include <sys/types.h>
18 #include <sys/ptrace.h>
19 // clang-format on
20 
22  NativeThreadProtocol &native_thread,
23  RegisterInfoInterface *reg_info_interface_p)
24  : NativeRegisterContextRegisterInfo(native_thread,
25  reg_info_interface_p) {}
26 
28  void *buf = GetGPRBuffer();
29  if (!buf)
30  return Status("GPR buffer is NULL");
31 
32  return DoReadGPR(buf);
33 }
34 
36  void *buf = GetGPRBuffer();
37  if (!buf)
38  return Status("GPR buffer is NULL");
39 
40  return DoWriteGPR(buf);
41 }
42 
44  void *buf = GetFPRBuffer();
45  if (!buf)
46  return Status("FPR buffer is NULL");
47 
48  return DoReadFPR(buf);
49 }
50 
52  void *buf = GetFPRBuffer();
53  if (!buf)
54  return Status("FPR buffer is NULL");
55 
56  return DoWriteFPR(buf);
57 }
58 
60  void *buf = GetDBRBuffer();
61  if (!buf)
62  return Status("DBR buffer is NULL");
63 
64  return DoReadDBR(buf);
65 }
66 
68  void *buf = GetDBRBuffer();
69  if (!buf)
70  return Status("DBR buffer is NULL");
71 
72  return DoWriteDBR(buf);
73 }
74 
76  return NativeProcessNetBSD::PtraceWrapper(PT_GETREGS, GetProcessPid(), buf,
77  m_thread.GetID());
78 }
79 
81  return NativeProcessNetBSD::PtraceWrapper(PT_SETREGS, GetProcessPid(), buf,
82  m_thread.GetID());
83 }
84 
86  return NativeProcessNetBSD::PtraceWrapper(PT_GETFPREGS, GetProcessPid(), buf,
87  m_thread.GetID());
88 }
89 
91  return NativeProcessNetBSD::PtraceWrapper(PT_SETFPREGS, GetProcessPid(), buf,
92  m_thread.GetID());
93 }
94 
96  return NativeProcessNetBSD::PtraceWrapper(PT_GETDBREGS, GetProcessPid(), buf,
97  m_thread.GetID());
98 }
99 
101  return NativeProcessNetBSD::PtraceWrapper(PT_SETDBREGS, GetProcessPid(), buf,
102  m_thread.GetID());
103 }
104 
106  return static_cast<NativeProcessNetBSD &>(m_thread.GetProcess());
107 }
108 
110  return GetProcess().GetID();
111 }
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
RegisterInfo interface to patch RegisterInfo structure for archs.
static Status PtraceWrapper(int req, lldb::pid_t pid, void *addr=nullptr, int data=0, int *result=nullptr)
NativeProcessProtocol & GetProcess()
Manages communication with the inferior (debugee) process.
NativeRegisterContextNetBSD(NativeThreadProtocol &native_thread, RegisterInfoInterface *reg_info_interface_p)
uint64_t pid_t
Definition: lldb-types.h:85
An error handling class.
Definition: Status.h:44