]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/llvm/tools/lldb/include/lldb/Target/RegisterCheckpoint.h
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / llvm / tools / lldb / include / lldb / Target / RegisterCheckpoint.h
1 //===-- RegisterCheckpoint.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 liblldb_RegisterCheckpoint_h_
11 #define liblldb_RegisterCheckpoint_h_
12
13 #include "lldb/lldb-private.h"
14 #include "lldb/Core/UserID.h"
15 #include "lldb/Target/StackID.h"
16
17 namespace lldb_private {
18
19     // Inherit from UserID in case pushing/popping all register values can be
20     // done using a 64 bit integer that holds a baton/cookie instead of actually
21     // having to read all register values into a buffer
22     class RegisterCheckpoint : public UserID
23     {
24     public:
25         
26         enum class Reason {
27             // An expression is about to be run on the thread if the protocol that
28             // talks to the debuggee supports checkpointing the registers using a
29             // push/pop then the UserID base class in the RegisterCheckpoint can
30             // be used to store the baton/cookie that refers to the remote saved
31             // state.
32             eExpression,
33             // The register checkpoint wants the raw register bytes, so they must
34             // be read into m_data_sp, or the save/restore checkpoint should fail.
35             eDataBackup
36         };
37         
38         RegisterCheckpoint(Reason reason) :
39             UserID(0),
40             m_data_sp (),
41             m_reason(reason)
42         {
43         }
44         
45         ~RegisterCheckpoint()
46         {
47         }
48         
49         lldb::DataBufferSP &
50         GetData()
51         {
52             return m_data_sp;
53         }
54         
55         const lldb::DataBufferSP &
56         GetData() const
57         {
58             return m_data_sp;
59         }
60         
61     protected:
62         lldb::DataBufferSP m_data_sp;
63         Reason m_reason;
64         
65         // Make RegisterCheckpointSP if you wish to share the data in this class.
66         DISALLOW_COPY_AND_ASSIGN(RegisterCheckpoint);
67     };
68     
69 } // namespace lldb_private
70
71 #endif  // liblldb_RegisterCheckpoint_h_