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 "NativeRegisterContextRegisterInfo.h" 11 #include "lldb/lldb-private-forward.h" 12 #include "lldb/lldb-types.h" 13 14 using namespace lldb_private; 15 NativeRegisterContextRegisterInfo(NativeThreadProtocol & thread,RegisterInfoInterface * register_info_interface)16NativeRegisterContextRegisterInfo::NativeRegisterContextRegisterInfo( 17 NativeThreadProtocol &thread, 18 RegisterInfoInterface *register_info_interface) 19 : NativeRegisterContext(thread), 20 m_register_info_interface_up(register_info_interface) { 21 assert(register_info_interface && "null register_info_interface"); 22 } 23 GetRegisterCount() const24uint32_t NativeRegisterContextRegisterInfo::GetRegisterCount() const { 25 return m_register_info_interface_up->GetRegisterCount(); 26 } 27 GetUserRegisterCount() const28uint32_t NativeRegisterContextRegisterInfo::GetUserRegisterCount() const { 29 return m_register_info_interface_up->GetUserRegisterCount(); 30 } 31 GetRegisterInfoAtIndex(uint32_t reg_index) const32const 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 & GetRegisterInfoInterface() const41NativeRegisterContextRegisterInfo::GetRegisterInfoInterface() const { 42 return *m_register_info_interface_up; 43 } 44