1 //===-- RegisterContextThreadMemory.h ---------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef lldb_RegisterContextThreadMemory_h_
11 #define lldb_RegisterContextThreadMemory_h_
15 #include "lldb/lldb-private.h"
16 #include "lldb/Target/RegisterContext.h"
17 #include "lldb/Symbol/SymbolContext.h"
19 namespace lldb_private {
21 class RegisterContextThreadMemory : public lldb_private::RegisterContext
24 RegisterContextThreadMemory (Thread &thread,
25 lldb::addr_t register_data_addr);
27 virtual ~RegisterContextThreadMemory();
28 //------------------------------------------------------------------
29 // Subclasses must override these functions
30 //------------------------------------------------------------------
32 InvalidateAllRegisters ();
37 virtual const RegisterInfo *
38 GetRegisterInfoAtIndex (size_t reg);
41 GetRegisterSetCount ();
43 virtual const RegisterSet *
44 GetRegisterSet (size_t reg_set);
47 ReadRegister (const RegisterInfo *reg_info, RegisterValue ®_value);
50 WriteRegister (const RegisterInfo *reg_info, const RegisterValue ®_value);
52 // These two functions are used to implement "push" and "pop" of register states. They are used primarily
53 // for expression evaluation, where we need to push a new state (storing the old one in data_sp) and then
54 // restoring the original state by passing the data_sp we got from ReadAllRegisters to WriteAllRegisterValues.
55 // ReadAllRegisters will do what is necessary to return a coherent set of register values for this thread, which
56 // may mean e.g. interrupting a thread that is sitting in a kernel trap. That is a somewhat disruptive operation,
57 // so these API's should only be used when this behavior is needed.
60 ReadAllRegisterValues (lldb::DataBufferSP &data_sp);
63 WriteAllRegisterValues (const lldb::DataBufferSP &data_sp);
66 CopyFromRegisterContext (lldb::RegisterContextSP context);
69 ConvertRegisterKindToRegisterNumber (uint32_t kind, uint32_t num);
71 //------------------------------------------------------------------
72 // Subclasses can override these functions if desired
73 //------------------------------------------------------------------
75 NumSupportedHardwareBreakpoints ();
78 SetHardwareBreakpoint (lldb::addr_t addr, size_t size);
81 ClearHardwareBreakpoint (uint32_t hw_idx);
84 NumSupportedHardwareWatchpoints ();
87 SetHardwareWatchpoint (lldb::addr_t addr, size_t size, bool read, bool write);
90 ClearHardwareWatchpoint (uint32_t hw_index);
93 HardwareSingleStep (bool enable);
96 ReadRegisterValueFromMemory (const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, uint32_t src_len, RegisterValue ®_value);
99 WriteRegisterValueToMemory (const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, uint32_t dst_len, const RegisterValue ®_value);
103 UpdateRegisterContext ();
105 lldb::ThreadWP m_thread_wp;
106 lldb::RegisterContextSP m_reg_ctx_sp;
107 lldb::addr_t m_register_data_addr;
110 DISALLOW_COPY_AND_ASSIGN (RegisterContextThreadMemory);
112 } // namespace lldb_private
114 #endif // lldb_RegisterContextThreadMemory_h_