LLDB  mainline
RegisterContextPOSIX_arm.cpp
Go to the documentation of this file.
1 //===-- RegisterContextPOSIX_arm.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 
28 bool RegisterContextPOSIX_arm::IsGPR(unsigned reg) {
29  if (m_register_info_up->GetRegisterSetFromRegisterIndex(reg) ==
31  return true;
32  return false;
33 }
34 
35 bool RegisterContextPOSIX_arm::IsFPR(unsigned reg) {
36  if (m_register_info_up->GetRegisterSetFromRegisterIndex(reg) ==
38  return true;
39  return false;
40 }
41 
43  lldb_private::Thread &thread,
44  std::unique_ptr<RegisterInfoPOSIX_arm> register_info)
45  : lldb_private::RegisterContext(thread, 0),
46  m_register_info_up(std::move(register_info)) {}
47 
49 
51 
53 
55  return m_register_info_up->GetRegisterInfo()[reg].byte_offset;
56 }
57 
59  return m_register_info_up->GetRegisterInfo()[reg].byte_size;
60 }
61 
63  return m_register_info_up->GetRegisterCount();
64 }
65 
67  return m_register_info_up->GetGPRSize();
68 }
69 
70 const lldb_private::RegisterInfo *RegisterContextPOSIX_arm::GetRegisterInfo() {
71  // Commonly, this method is overridden and g_register_infos is copied and
72  // specialized. So, use GetRegisterInfo() rather than g_register_infos in
73  // this scope.
74  return m_register_info_up->GetRegisterInfo();
75 }
76 
77 const lldb_private::RegisterInfo *
79  if (reg < GetRegisterCount())
80  return &GetRegisterInfo()[reg];
81 
82  return nullptr;
83 }
84 
86  return m_register_info_up->GetRegisterSetCount();
87 }
88 
89 const lldb_private::RegisterSet *
91  return m_register_info_up->GetRegisterSet(set);
92 }
93 
94 const char *RegisterContextPOSIX_arm::GetRegisterName(unsigned reg) {
95  if (reg < GetRegisterCount())
96  return GetRegisterInfo()[reg].name;
97  return nullptr;
98 }
Scalar.h
RegisterContextPOSIX_arm::GetRegisterSet
const lldb_private::RegisterSet * GetRegisterSet(size_t set) override
Definition: RegisterContextPOSIX_arm.cpp:90
RegisterContextPOSIX_arm::GetRegisterSize
virtual unsigned GetRegisterSize(unsigned reg)
Definition: RegisterContextPOSIX_arm.cpp:58
RegisterContextPOSIX_arm.h
RegisterContextPOSIX_arm::IsFPR
bool IsFPR(unsigned reg)
Definition: RegisterContextPOSIX_arm.cpp:35
RegisterValue.h
RegisterContextPOSIX_arm::GetRegisterSetCount
size_t GetRegisterSetCount() override
Definition: RegisterContextPOSIX_arm.cpp:85
Process.h
RegisterContextPOSIX_arm::GetRegisterInfo
virtual const lldb_private::RegisterInfo * GetRegisterInfo()
Definition: RegisterContextPOSIX_arm.cpp:70
RegisterContextPOSIX_arm::GetGPRSize
virtual size_t GetGPRSize()
Definition: RegisterContextPOSIX_arm.cpp:66
Target.h
lldb_private::Thread
Definition: Thread.h:60
RegisterInfoPOSIX_arm::FPRegSet
@ FPRegSet
Definition: RegisterInfoPOSIX_arm.h:18
RegisterContextPOSIX_arm::RegisterContextPOSIX_arm
RegisterContextPOSIX_arm(lldb_private::Thread &thread, std::unique_ptr< RegisterInfoPOSIX_arm > register_info)
Definition: RegisterContextPOSIX_arm.cpp:42
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
Thread.h
lldb_private::RegisterContext
Definition: RegisterContext.h:17
RegisterContextPOSIX_arm::GetRegisterCount
size_t GetRegisterCount() override
Definition: RegisterContextPOSIX_arm.cpp:62
RegisterContextPOSIX_arm::Invalidate
void Invalidate()
Definition: RegisterContextPOSIX_arm.cpp:50
RegisterContextPOSIX_arm::InvalidateAllRegisters
void InvalidateAllRegisters() override
Definition: RegisterContextPOSIX_arm.cpp:52
RegisterContextPOSIX_arm::IsGPR
bool IsGPR(unsigned reg)
Definition: RegisterContextPOSIX_arm.cpp:28
RegisterContextPOSIX_arm::GetRegisterOffset
virtual unsigned GetRegisterOffset(unsigned reg)
Definition: RegisterContextPOSIX_arm.cpp:54
DataExtractor.h
RegisterInfoPOSIX_arm::GPRegSet
@ GPRegSet
Definition: RegisterInfoPOSIX_arm.h:18
RegisterContextPOSIX_arm::m_register_info_up
std::unique_ptr< RegisterInfoPOSIX_arm > m_register_info_up
Definition: RegisterContextPOSIX_arm.h:46
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
RegisterContextPOSIX_arm::~RegisterContextPOSIX_arm
~RegisterContextPOSIX_arm() override
lldb
Definition: SBAddress.h:15
Endian.h
RegisterContextPOSIX_arm::GetRegisterInfoAtIndex
const lldb_private::RegisterInfo * GetRegisterInfoAtIndex(size_t reg) override
Definition: RegisterContextPOSIX_arm.cpp:78
DataBufferHeap.h
RegisterContextPOSIX_arm::GetRegisterName
const char * GetRegisterName(unsigned reg)
Definition: RegisterContextPOSIX_arm.cpp:94