]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/llvm/tools/lldb/source/Plugins/Process/Utility/RegisterContextMemory.h
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / llvm / tools / lldb / source / Plugins / Process / Utility / RegisterContextMemory.h
1 //===-- RegisterContextMemory.h ---------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef lldb_RegisterContextMemory_h_
11 #define lldb_RegisterContextMemory_h_
12
13 // C Includes
14 // C++ Includes
15 #include <vector>
16
17 // Other libraries and framework includes
18 // Project includes
19 #include "lldb/lldb-private.h"
20 #include "lldb/Core/DataExtractor.h"
21 #include "lldb/Target/RegisterContext.h"
22
23 class DynamicRegisterInfo;
24
25 class RegisterContextMemory : public lldb_private::RegisterContext
26 {
27 public:
28     //------------------------------------------------------------------
29     // Constructors and Destructors
30     //------------------------------------------------------------------
31     RegisterContextMemory (lldb_private::Thread &thread,
32                             uint32_t concrete_frame_idx,
33                             DynamicRegisterInfo &reg_info,
34                             lldb::addr_t reg_data_addr);
35
36     virtual
37     ~RegisterContextMemory ();
38
39     //------------------------------------------------------------------
40     // Subclasses must override these functions
41     //------------------------------------------------------------------
42     virtual void
43     InvalidateAllRegisters ();
44
45     virtual size_t
46     GetRegisterCount ();
47
48     virtual const lldb_private::RegisterInfo *
49     GetRegisterInfoAtIndex (size_t reg);
50
51     virtual size_t
52     GetRegisterSetCount ();
53
54     virtual const lldb_private::RegisterSet *
55     GetRegisterSet (size_t reg_set);
56
57     virtual uint32_t
58     ConvertRegisterKindToRegisterNumber (uint32_t kind, uint32_t num);
59
60     
61     //------------------------------------------------------------------
62     // If all of the thread register are in a contiguous buffer in 
63     // memory, then the default ReadRegister/WriteRegister and
64     // ReadAllRegisterValues/WriteAllRegisterValues will work. If thread
65     // registers are not contiguous, clients will want to subclass this
66     // class and modify the read/write functions as needed.
67     //------------------------------------------------------------------
68
69     virtual bool
70     ReadRegister (const lldb_private::RegisterInfo *reg_info, 
71                   lldb_private::RegisterValue &reg_value);
72     
73     virtual bool
74     WriteRegister (const lldb_private::RegisterInfo *reg_info, 
75                    const lldb_private::RegisterValue &reg_value);
76     
77     virtual bool
78     ReadAllRegisterValues (lldb::DataBufferSP &data_sp);
79     
80     virtual bool
81     WriteAllRegisterValues (const lldb::DataBufferSP &data_sp);
82
83     void
84     SetAllRegisterData  (const lldb::DataBufferSP &data_sp);
85 protected:
86     
87     void
88     SetAllRegisterValid (bool b);
89
90     DynamicRegisterInfo &m_reg_infos;
91     std::vector<bool> m_reg_valid;
92     lldb_private::DataExtractor m_reg_data;
93     lldb::addr_t m_reg_data_addr; // If this is valid, then we have a register context that is stored in memmory
94
95 private:
96     //------------------------------------------------------------------
97     // For RegisterContextMemory only
98     //------------------------------------------------------------------
99     DISALLOW_COPY_AND_ASSIGN (RegisterContextMemory);
100 };
101
102 #endif  // lldb_RegisterContextMemory_h_