1 //===-- NativeRegisterContex.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/lldb-types.h" 11 #include "lldb/lldb-private-forward.h" 12 #include "lldb/Host/common/NativeRegisterContextRegisterInfo.h" 13 14 using namespace lldb_private; 15 NativeRegisterContextRegisterInfo(NativeThreadProtocol & thread,uint32_t concrete_frame_idx,RegisterInfoInterface * register_info_interface)16NativeRegisterContextRegisterInfo::NativeRegisterContextRegisterInfo (NativeThreadProtocol &thread, 17 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 { 22 assert (register_info_interface && "null register_info_interface"); 23 } 24 25 uint32_t GetRegisterCount() const26NativeRegisterContextRegisterInfo::GetRegisterCount () const 27 { 28 return m_register_info_interface_up->GetRegisterCount (); 29 } 30 31 uint32_t GetUserRegisterCount() const32NativeRegisterContextRegisterInfo::GetUserRegisterCount () const 33 { 34 return m_register_info_interface_up->GetUserRegisterCount (); 35 } 36 37 const RegisterInfo * GetRegisterInfoAtIndex(uint32_t reg_index) const38NativeRegisterContextRegisterInfo::GetRegisterInfoAtIndex (uint32_t reg_index) const 39 { 40 if (reg_index <= GetRegisterCount ()) 41 return m_register_info_interface_up->GetRegisterInfo () + reg_index; 42 else 43 return nullptr; 44 } 45 46 const RegisterInfoInterface& GetRegisterInfoInterface() const47NativeRegisterContextRegisterInfo::GetRegisterInfoInterface () const 48 { 49 return *m_register_info_interface_up; 50 } 51