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