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_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERCONTEXTTHREADMEMORY_H
10#define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERCONTEXTTHREADMEMORY_H
11
12#include <vector>
13
16#include "lldb/lldb-private.h"
17
18namespace lldb_private {
19
21public:
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
55
56 bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
57
59
61 uint32_t num) override;
62
63 uint32_t NumSupportedHardwareBreakpoints() override;
64
65 uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override;
66
67 bool ClearHardwareBreakpoint(uint32_t hw_idx) override;
68
69 uint32_t NumSupportedHardwareWatchpoints() override;
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
79 lldb::addr_t src_addr, uint32_t src_len,
80 RegisterValue &reg_value) override;
81
83 lldb::addr_t dst_addr, uint32_t dst_len,
84 const RegisterValue &reg_value) override;
85
86protected:
88
92 uint32_t m_stop_id;
93
94private:
98};
99
100} // namespace lldb_private
101
102#endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERCONTEXTTHREADMEMORY_H
bool WriteRegister(const RegisterInfo *reg_info, const RegisterValue &reg_value) override
const RegisterInfo * GetRegisterInfoAtIndex(size_t reg) override
bool ClearHardwareWatchpoint(uint32_t hw_index) override
bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override
RegisterContextThreadMemory(const RegisterContextThreadMemory &)=delete
uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read, bool write) override
Status ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, uint32_t src_len, RegisterValue &reg_value) override
bool CopyFromRegisterContext(lldb::RegisterContextSP context)
bool ReadRegister(const RegisterInfo *reg_info, RegisterValue &reg_value) override
uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override
Status WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, uint32_t dst_len, const RegisterValue &reg_value) override
const RegisterSet * GetRegisterSet(size_t reg_set) override
const RegisterContextThreadMemory & operator=(const RegisterContextThreadMemory &)=delete
bool ReadAllRegisterValues(lldb::WritableDataBufferSP &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.
An error handling class.
Definition: Status.h:44
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:328
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
Definition: lldb-forward.h:329
uint64_t addr_t
Definition: lldb-types.h:80
std::weak_ptr< lldb_private::Thread > ThreadWP
Definition: lldb-forward.h:439
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
Definition: lldb-forward.h:386
RegisterKind
Register numbering types.
Every register is described in detail including its name, alternate name (optional),...
Registers are grouped into register sets.