]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - source/Host/common/NativeRegisterContextRegisterInfo.cpp
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / source / Host / common / NativeRegisterContextRegisterInfo.cpp
1 //===-- NativeRegisterContextRegisterInfo.cpp -------------------*- 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 #include "lldb/Host/common/NativeRegisterContextRegisterInfo.h"
11 #include "lldb/lldb-private-forward.h"
12 #include "lldb/lldb-types.h"
13
14 using namespace lldb_private;
15
16 NativeRegisterContextRegisterInfo::NativeRegisterContextRegisterInfo(
17     NativeThreadProtocol &thread, uint32_t concrete_frame_idx,
18     RegisterInfoInterface *register_info_interface)
19     : NativeRegisterContext(thread, concrete_frame_idx),
20       m_register_info_interface_up(register_info_interface) {
21   assert(register_info_interface && "null register_info_interface");
22 }
23
24 uint32_t NativeRegisterContextRegisterInfo::GetRegisterCount() const {
25   return m_register_info_interface_up->GetRegisterCount();
26 }
27
28 uint32_t NativeRegisterContextRegisterInfo::GetUserRegisterCount() const {
29   return m_register_info_interface_up->GetUserRegisterCount();
30 }
31
32 const RegisterInfo *NativeRegisterContextRegisterInfo::GetRegisterInfoAtIndex(
33     uint32_t reg_index) const {
34   if (reg_index <= GetRegisterCount())
35     return m_register_info_interface_up->GetRegisterInfo() + reg_index;
36   else
37     return nullptr;
38 }
39
40 const RegisterInfoInterface &
41 NativeRegisterContextRegisterInfo::GetRegisterInfoInterface() const {
42   return *m_register_info_interface_up;
43 }