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 done 20 // using a 64 bit integer that holds a baton/cookie instead of actually having 21 // 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 be 28 // used to store the baton/cookie that refers to the remote saved state. 29 eExpression, 30 // The register checkpoint wants the raw register bytes, so they must be 31 // read into m_data_sp, or the save/restore checkpoint should fail. 32 eDataBackup 33 }; 34 RegisterCheckpoint(Reason reason)35 RegisterCheckpoint(Reason reason) 36 : UserID(0), m_data_sp(), m_reason(reason) {} 37 ~RegisterCheckpoint()38 ~RegisterCheckpoint() {} 39 GetData()40 lldb::DataBufferSP &GetData() { return m_data_sp; } 41 GetData()42 const lldb::DataBufferSP &GetData() const { return m_data_sp; } 43 44 protected: 45 lldb::DataBufferSP m_data_sp; 46 Reason m_reason; 47 48 // Make RegisterCheckpointSP if you wish to share the data in this class. 49 DISALLOW_COPY_AND_ASSIGN(RegisterCheckpoint); 50 }; 51 52 } // namespace lldb_private 53 54 #endif // liblldb_RegisterCheckpoint_h_ 55