NativeRegisterContextNetBSD.cpp revision 360784
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 "Plugins/Process/NetBSD/NativeProcessNetBSD.h"
12
13#include "lldb/Host/common/NativeProcessProtocol.h"
14
15using namespace lldb_private;
16using namespace lldb_private::process_netbsd;
17
18// clang-format off
19#include <sys/types.h>
20#include <sys/ptrace.h>
21// clang-format on
22
23NativeRegisterContextNetBSD::NativeRegisterContextNetBSD(
24    NativeThreadProtocol &native_thread,
25    RegisterInfoInterface *reg_info_interface_p)
26    : NativeRegisterContextRegisterInfo(native_thread,
27                                        reg_info_interface_p) {}
28
29Status NativeRegisterContextNetBSD::DoRegisterSet(int ptrace_req, void *buf) {
30  return NativeProcessNetBSD::PtraceWrapper(ptrace_req, GetProcessPid(), buf,
31                                            m_thread.GetID());
32}
33
34NativeProcessNetBSD &NativeRegisterContextNetBSD::GetProcess() {
35  return static_cast<NativeProcessNetBSD &>(m_thread.GetProcess());
36}
37
38::pid_t NativeRegisterContextNetBSD::GetProcessPid() {
39  return GetProcess().GetID();
40}
41