LLDB  mainline
RegisterContextPOSIX_arm64.cpp
Go to the documentation of this file.
1 //===-- RegisterContextPOSIX_arm64.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 <cerrno>
10 #include <cstdint>
11 #include <cstring>
12 
13 #include "lldb/Target/Process.h"
14 #include "lldb/Target/Target.h"
15 #include "lldb/Target/Thread.h"
18 #include "lldb/Utility/Endian.h"
20 #include "lldb/Utility/Scalar.h"
21 #include "llvm/Support/Compiler.h"
22 
24 
25 using namespace lldb;
26 using namespace lldb_private;
27 
29  if (m_register_info_up->GetRegisterSetFromRegisterIndex(reg) ==
31  return true;
32  return false;
33 }
34 
36  if (m_register_info_up->GetRegisterSetFromRegisterIndex(reg) ==
38  return true;
39  return false;
40 }
41 
42 bool RegisterContextPOSIX_arm64::IsSVE(unsigned reg) const {
43  return m_register_info_up->IsSVEReg(reg);
44 }
45 
46 bool RegisterContextPOSIX_arm64::IsPAuth(unsigned reg) const {
47  return m_register_info_up->IsPAuthReg(reg);
48 }
49 
51  lldb_private::Thread &thread,
52  std::unique_ptr<RegisterInfoPOSIX_arm64> register_info)
53  : lldb_private::RegisterContext(thread, 0),
54  m_register_info_up(std::move(register_info)) {}
55 
57 
59 
61 
63  return m_register_info_up->GetRegisterInfo()[reg].byte_offset;
64 }
65 
67  return m_register_info_up->GetRegisterInfo()[reg].byte_size;
68 }
69 
71  return m_register_info_up->GetRegisterCount();
72 }
73 
75  return m_register_info_up->GetGPRSize();
76 }
77 
78 const lldb_private::RegisterInfo *
80  // Commonly, this method is overridden and g_register_infos is copied and
81  // specialized. So, use GetRegisterInfo() rather than g_register_infos in
82  // this scope.
83  return m_register_info_up->GetRegisterInfo();
84 }
85 
86 const lldb_private::RegisterInfo *
88  if (reg < GetRegisterCount())
89  return &GetRegisterInfo()[reg];
90 
91  return nullptr;
92 }
93 
95  return m_register_info_up->GetRegisterSetCount();
96 }
97 
98 const lldb_private::RegisterSet *
100  return m_register_info_up->GetRegisterSet(set);
101 }
102 
104  if (reg < GetRegisterCount())
105  return GetRegisterInfo()[reg].name;
106  return nullptr;
107 }
RegisterInfoPOSIX_arm64::GPRegSet
@ GPRegSet
Definition: RegisterInfoPOSIX_arm64.h:23
Scalar.h
RegisterContextPOSIX_arm64::GetRegisterInfo
virtual const lldb_private::RegisterInfo * GetRegisterInfo()
Definition: RegisterContextPOSIX_arm64.cpp:79
RegisterContextPOSIX_arm64::IsSVE
bool IsSVE(unsigned reg) const
Definition: RegisterContextPOSIX_arm64.cpp:42
RegisterContextPOSIX_arm64::RegisterContextPOSIX_arm64
RegisterContextPOSIX_arm64(lldb_private::Thread &thread, std::unique_ptr< RegisterInfoPOSIX_arm64 > register_info)
Definition: RegisterContextPOSIX_arm64.cpp:50
RegisterValue.h
RegisterContextPOSIX_arm64::Invalidate
void Invalidate()
Definition: RegisterContextPOSIX_arm64.cpp:58
RegisterContextPOSIX_arm64::GetRegisterSize
virtual unsigned GetRegisterSize(unsigned reg)
Definition: RegisterContextPOSIX_arm64.cpp:66
RegisterContextPOSIX_arm64::GetRegisterSetCount
size_t GetRegisterSetCount() override
Definition: RegisterContextPOSIX_arm64.cpp:94
Process.h
RegisterContextPOSIX_arm64::GetRegisterInfoAtIndex
const lldb_private::RegisterInfo * GetRegisterInfoAtIndex(size_t reg) override
Definition: RegisterContextPOSIX_arm64.cpp:87
Target.h
RegisterContextPOSIX_arm64::IsFPR
bool IsFPR(unsigned reg)
Definition: RegisterContextPOSIX_arm64.cpp:35
lldb_private::Thread
Definition: Thread.h:62
set
set(option_framework FRAMEWORK) endif() if(LLDB_ENABLE_PYTHON) get_target_property(python_bindings_dir swig_wrapper_python BINARY_DIR) set(lldb_python_wrapper $
Definition: API/CMakeLists.txt:9
RegisterContextPOSIX_arm64::m_register_info_up
std::unique_ptr< RegisterInfoPOSIX_arm64 > m_register_info_up
Definition: RegisterContextPOSIX_arm64.h:46
Thread.h
lldb_private::RegisterContext
Definition: RegisterContext.h:17
RegisterContextPOSIX_arm64::GetRegisterName
const char * GetRegisterName(unsigned reg)
Definition: RegisterContextPOSIX_arm64.cpp:103
RegisterContextPOSIX_arm64::GetGPRSize
virtual size_t GetGPRSize()
Definition: RegisterContextPOSIX_arm64.cpp:74
RegisterInfoPOSIX_arm64::FPRegSet
@ FPRegSet
Definition: RegisterInfoPOSIX_arm64.h:23
RegisterContextPOSIX_arm64::IsPAuth
bool IsPAuth(unsigned reg) const
Definition: RegisterContextPOSIX_arm64.cpp:46
RegisterContextPOSIX_arm64.h
RegisterContextPOSIX_arm64::IsGPR
bool IsGPR(unsigned reg)
Definition: RegisterContextPOSIX_arm64.cpp:28
RegisterContextPOSIX_arm64::InvalidateAllRegisters
void InvalidateAllRegisters() override
Definition: RegisterContextPOSIX_arm64.cpp:60
DataExtractor.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
RegisterContextPOSIX_arm64::GetRegisterCount
size_t GetRegisterCount() override
Definition: RegisterContextPOSIX_arm64.cpp:70
RegisterContextPOSIX_arm64::~RegisterContextPOSIX_arm64
~RegisterContextPOSIX_arm64() override
lldb
Definition: SBAddress.h:15
Endian.h
RegisterContextPOSIX_arm64::GetRegisterSet
const lldb_private::RegisterSet * GetRegisterSet(size_t set) override
Definition: RegisterContextPOSIX_arm64.cpp:99
DataBufferHeap.h
RegisterContextPOSIX_arm64::GetRegisterOffset
virtual unsigned GetRegisterOffset(unsigned reg)
Definition: RegisterContextPOSIX_arm64.cpp:62