LLDB  mainline
RegisterContextThreadMemory.h
Go to the documentation of this file.
1 //===-- RegisterContextThreadMemory.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_RegisterContextThreadMemory_h_
10 #define lldb_RegisterContextThreadMemory_h_
11 
12 #include <vector>
13 
16 #include "lldb/lldb-private.h"
17 
18 namespace lldb_private {
19 
21 public:
22  RegisterContextThreadMemory(Thread &thread, lldb::addr_t register_data_addr);
23 
25 
26  void InvalidateAllRegisters() override;
27 
28  size_t GetRegisterCount() override;
29 
30  const RegisterInfo *GetRegisterInfoAtIndex(size_t reg) override;
31 
32  size_t GetRegisterSetCount() override;
33 
34  const RegisterSet *GetRegisterSet(size_t reg_set) override;
35 
36  bool ReadRegister(const RegisterInfo *reg_info,
37  RegisterValue &reg_value) override;
38 
39  bool WriteRegister(const RegisterInfo *reg_info,
40  const RegisterValue &reg_value) override;
41 
42  // These two functions are used to implement "push" and "pop" of register
43  // states. They are used primarily
44  // for expression evaluation, where we need to push a new state (storing the
45  // old one in data_sp) and then
46  // restoring the original state by passing the data_sp we got from
47  // ReadAllRegisters to WriteAllRegisterValues.
48  // ReadAllRegisters will do what is necessary to return a coherent set of
49  // register values for this thread, which
50  // may mean e.g. interrupting a thread that is sitting in a kernel trap. That
51  // is a somewhat disruptive operation,
52  // so these API's should only be used when this behavior is needed.
53 
54  bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override;
55 
56  bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
57 
58  bool CopyFromRegisterContext(lldb::RegisterContextSP context);
59 
61  uint32_t num) override;
62 
64 
65  uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override;
66 
67  bool ClearHardwareBreakpoint(uint32_t hw_idx) override;
68 
70 
71  uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read,
72  bool write) override;
73 
74  bool ClearHardwareWatchpoint(uint32_t hw_index) override;
75 
76  bool HardwareSingleStep(bool enable) override;
77 
78  Status ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info,
79  lldb::addr_t src_addr, uint32_t src_len,
80  RegisterValue &reg_value) override;
81 
82  Status WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info,
83  lldb::addr_t dst_addr, uint32_t dst_len,
84  const RegisterValue &reg_value) override;
85 
86 protected:
87  void UpdateRegisterContext();
88 
89  lldb::ThreadWP m_thread_wp;
90  lldb::RegisterContextSP m_reg_ctx_sp;
93 
94 private:
95  DISALLOW_COPY_AND_ASSIGN(RegisterContextThreadMemory);
96 };
97 
98 } // namespace lldb_private
99 
100 #endif // lldb_RegisterContextThreadMemory_h_
const RegisterSet * GetRegisterSet(size_t reg_set) override
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
const RegisterInfo * GetRegisterInfoAtIndex(size_t reg) override
uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read, bool write) override
bool CopyFromRegisterContext(lldb::RegisterContextSP context)
bool ReadRegister(const RegisterInfo *reg_info, RegisterValue &reg_value) override
bool ClearHardwareWatchpoint(uint32_t hw_index) override
Status ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, uint32_t src_len, RegisterValue &reg_value) override
uint64_t addr_t
Definition: lldb-types.h:83
Status WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, uint32_t dst_len, const RegisterValue &reg_value) override
uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override
bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override
RegisterContextThreadMemory(Thread &thread, lldb::addr_t register_data_addr)
bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override
uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override
Convert from a given register numbering scheme to the lldb register numbering scheme.
bool WriteRegister(const RegisterInfo *reg_info, const RegisterValue &reg_value) override
An error handling class.
Definition: Status.h:44