LLDB  mainline
RegisterContextMemory.h
Go to the documentation of this file.
1 //===-- RegisterContextMemory.h ---------------------------------*- C++ -*-===//
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 #ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERCONTEXTMEMORY_H
10 #define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERCONTEXTMEMORY_H
11 
12 #include <vector>
13 
17 #include "lldb/lldb-private.h"
18 
20 public:
22  uint32_t concrete_frame_idx,
24  lldb::addr_t reg_data_addr);
25 
26  ~RegisterContextMemory() override;
27 
28  void InvalidateAllRegisters() override;
29 
30  size_t GetRegisterCount() override;
31 
32  const lldb_private::RegisterInfo *GetRegisterInfoAtIndex(size_t reg) override;
33 
34  size_t GetRegisterSetCount() override;
35 
36  const lldb_private::RegisterSet *GetRegisterSet(size_t reg_set) override;
37 
39  uint32_t num) override;
40 
41  // If all of the thread register are in a contiguous buffer in
42  // memory, then the default ReadRegister/WriteRegister and
43  // ReadAllRegisterValues/WriteAllRegisterValues will work. If thread
44  // registers are not contiguous, clients will want to subclass this
45  // class and modify the read/write functions as needed.
46 
47  bool ReadRegister(const lldb_private::RegisterInfo *reg_info,
48  lldb_private::RegisterValue &reg_value) override;
49 
50  bool WriteRegister(const lldb_private::RegisterInfo *reg_info,
51  const lldb_private::RegisterValue &reg_value) override;
52 
53  bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override;
54 
55  bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
56 
57  void SetAllRegisterData(const lldb::DataBufferSP &data_sp);
58 
59 protected:
60  void SetAllRegisterValid(bool b);
61 
63  std::vector<bool> m_reg_valid;
65  lldb::addr_t m_reg_data_addr; // If this is valid, then we have a register
66  // context that is stored in memmory
67 
68 private:
70  const RegisterContextMemory &
71  operator=(const RegisterContextMemory &) = delete;
72 };
73 
74 #endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERCONTEXTMEMORY_H
RegisterContextMemory::GetRegisterSet
const lldb_private::RegisterSet * GetRegisterSet(size_t reg_set) override
Definition: RegisterContextMemory.cpp:66
RegisterContextMemory::ReadAllRegisterValues
bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override
Definition: RegisterContextMemory.cpp:102
lldb_private::RegisterValue
Definition: RegisterValue.h:28
RegisterContextMemory::ConvertRegisterKindToRegisterNumber
uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override
Convert from a given register numbering scheme to the lldb register numbering scheme.
Definition: RegisterContextMemory.cpp:70
RegisterContextMemory::SetAllRegisterValid
void SetAllRegisterValid(bool b)
Definition: RegisterContextMemory.cpp:48
DynamicRegisterInfo.h
RegisterContextMemory::SetAllRegisterData
void SetAllRegisterData(const lldb::DataBufferSP &data_sp)
Definition: RegisterContextMemory.cpp:134
RegisterContextMemory::ReadRegister
bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &reg_value) override
Definition: RegisterContextMemory.cpp:75
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
RegisterContextMemory::operator=
const RegisterContextMemory & operator=(const RegisterContextMemory &)=delete
lldb_private::DataExtractor
Definition: DataExtractor.h:48
lldb_private::Thread
Definition: Thread.h:60
lldb_private::RegisterContext
Definition: RegisterContext.h:17
RegisterContextMemory::GetRegisterSetCount
size_t GetRegisterSetCount() override
Definition: RegisterContextMemory.cpp:62
lldb::RegisterKind
RegisterKind
Register numbering types.
Definition: lldb-enumerations.h:227
lldb-private.h
RegisterContextMemory::WriteRegister
bool WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &reg_value) override
Definition: RegisterContextMemory.cpp:89
RegisterContextMemory
Definition: RegisterContextMemory.h:19
uint32_t
RegisterContextMemory::m_reg_data
lldb_private::DataExtractor m_reg_data
Definition: RegisterContextMemory.h:64
RegisterContextMemory::InvalidateAllRegisters
void InvalidateAllRegisters() override
Definition: RegisterContextMemory.cpp:43
RegisterContextMemory::WriteAllRegisterValues
bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override
Definition: RegisterContextMemory.cpp:118
DataExtractor.h
RegisterContextMemory::GetRegisterCount
size_t GetRegisterCount() override
Definition: RegisterContextMemory.cpp:54
RegisterContextMemory::RegisterContextMemory
RegisterContextMemory(lldb_private::Thread &thread, uint32_t concrete_frame_idx, lldb_private::DynamicRegisterInfo &reg_info, lldb::addr_t reg_data_addr)
Definition: RegisterContextMemory.cpp:21
RegisterContextMemory::~RegisterContextMemory
~RegisterContextMemory() override
lldb_private::DynamicRegisterInfo
Definition: DynamicRegisterInfo.h:21
RegisterContext.h
RegisterContextMemory::m_reg_valid
std::vector< bool > m_reg_valid
Definition: RegisterContextMemory.h:63
RegisterContextMemory::m_reg_data_addr
lldb::addr_t m_reg_data_addr
Definition: RegisterContextMemory.h:65
RegisterContextMemory::m_reg_infos
lldb_private::DynamicRegisterInfo & m_reg_infos
Definition: RegisterContextMemory.h:62
RegisterContextMemory::GetRegisterInfoAtIndex
const lldb_private::RegisterInfo * GetRegisterInfoAtIndex(size_t reg) override
Definition: RegisterContextMemory.cpp:58