1178476Sjb//===-- RegisterCheckpoint.h ------------------------------------*- C++ -*-===// 2178476Sjb// 3178476Sjb// The LLVM Compiler Infrastructure 4178476Sjb// 5178476Sjb// This file is distributed under the University of Illinois Open Source 6178476Sjb// License. See LICENSE.TXT for details. 7178476Sjb// 8178476Sjb//===----------------------------------------------------------------------===// 9178476Sjb 10178476Sjb#ifndef liblldb_RegisterCheckpoint_h_ 11178476Sjb#define liblldb_RegisterCheckpoint_h_ 12178476Sjb 13178476Sjb#include "lldb/lldb-private.h" 14178476Sjb#include "lldb/Core/UserID.h" 15178476Sjb#include "lldb/Target/StackID.h" 16178476Sjb 17178476Sjbnamespace lldb_private { 18178476Sjb 19178476Sjb // Inherit from UserID in case pushing/popping all register values can be 20178476Sjb // done using a 64 bit integer that holds a baton/cookie instead of actually 21178476Sjb // having to read all register values into a buffer 22178476Sjb class RegisterCheckpoint : public UserID 23178476Sjb { 24178476Sjb public: 25178476Sjb 26178476Sjb enum class Reason { 27178476Sjb // An expression is about to be run on the thread if the protocol that 28178476Sjb // talks to the debuggee supports checkpointing the registers using a 29178476Sjb // push/pop then the UserID base class in the RegisterCheckpoint can 30178476Sjb // be used to store the baton/cookie that refers to the remote saved 31178476Sjb // state. 32178476Sjb eExpression, 33178476Sjb // The register checkpoint wants the raw register bytes, so they must 34178476Sjb // be read into m_data_sp, or the save/restore checkpoint should fail. 35178476Sjb eDataBackup 36178476Sjb }; 37178476Sjb 38178476Sjb RegisterCheckpoint(Reason reason) : 39178476Sjb UserID(0), 40178476Sjb m_data_sp (), 41178476Sjb m_reason(reason) 42178476Sjb { 43178476Sjb } 44178476Sjb 45178476Sjb ~RegisterCheckpoint() 46178476Sjb { 47178476Sjb } 48178476Sjb 49178476Sjb lldb::DataBufferSP & 50178476Sjb GetData() 51178476Sjb { 52178476Sjb return m_data_sp; 53178476Sjb } 54178476Sjb 55178476Sjb const lldb::DataBufferSP & 56178476Sjb GetData() const 57178476Sjb { 58178476Sjb return m_data_sp; 59178476Sjb } 60178476Sjb 61178476Sjb protected: 62178476Sjb lldb::DataBufferSP m_data_sp; 63178476Sjb Reason m_reason; 64178476Sjb 65178476Sjb // Make RegisterCheckpointSP if you wish to share the data in this class. 66178476Sjb DISALLOW_COPY_AND_ASSIGN(RegisterCheckpoint); 67178476Sjb }; 68178476Sjb 69178476Sjb} // namespace lldb_private 70178476Sjb 71178476Sjb#endif // liblldb_RegisterCheckpoint_h_ 72178476Sjb