]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Target/RegisterCheckpoint.h
openssh: cherry-pick OpenSSL 1.1.1 compatibility
[FreeBSD/FreeBSD.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/Target/StackID.h"
14 #include "lldb/Utility/UserID.h"
15 #include "lldb/lldb-private.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 public:
24   enum class Reason {
25     // An expression is about to be run on the thread if the protocol that
26     // talks to the debuggee supports checkpointing the registers using a
27     // push/pop then the UserID base class in the RegisterCheckpoint can
28     // be used to store the baton/cookie that refers to the remote saved
29     // state.
30     eExpression,
31     // The register checkpoint wants the raw register bytes, so they must
32     // be read into m_data_sp, or the save/restore checkpoint should fail.
33     eDataBackup
34   };
35
36   RegisterCheckpoint(Reason reason)
37       : UserID(0), m_data_sp(), m_reason(reason) {}
38
39   ~RegisterCheckpoint() {}
40
41   lldb::DataBufferSP &GetData() { return m_data_sp; }
42
43   const lldb::DataBufferSP &GetData() const { return m_data_sp; }
44
45 protected:
46   lldb::DataBufferSP m_data_sp;
47   Reason m_reason;
48
49   // Make RegisterCheckpointSP if you wish to share the data in this class.
50   DISALLOW_COPY_AND_ASSIGN(RegisterCheckpoint);
51 };
52
53 } // namespace lldb_private
54
55 #endif // liblldb_RegisterCheckpoint_h_