xref: /freebsd-src/contrib/llvm-project/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
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 
9 #include "NativeRegisterContextNetBSD.h"
10 
11 #include "lldb/Host/common/NativeProcessProtocol.h"
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 
21 NativeRegisterContextNetBSD::NativeRegisterContextNetBSD(
22     NativeThreadProtocol &native_thread,
23     RegisterInfoInterface *reg_info_interface_p)
24     : NativeRegisterContextRegisterInfo(native_thread,
25                                         reg_info_interface_p) {}
26 
27 Status NativeRegisterContextNetBSD::DoRegisterSet(int ptrace_req, void *buf) {
28   return NativeProcessNetBSD::PtraceWrapper(ptrace_req, GetProcessPid(), buf,
29                                             m_thread.GetID());
30 }
31 
32 NativeProcessNetBSD &NativeRegisterContextNetBSD::GetProcess() {
33   return static_cast<NativeProcessNetBSD &>(m_thread.GetProcess());
34 }
35 
36 ::pid_t NativeRegisterContextNetBSD::GetProcessPid() {
37   return GetProcess().GetID();
38 }
39