Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:54

0001 //===-- RegisterCheckpoint.h ------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_TARGET_REGISTERCHECKPOINT_H
0010 #define LLDB_TARGET_REGISTERCHECKPOINT_H
0011 
0012 #include "lldb/Target/StackID.h"
0013 #include "lldb/Utility/UserID.h"
0014 #include "lldb/lldb-private.h"
0015 
0016 namespace lldb_private {
0017 
0018 // Inherit from UserID in case pushing/popping all register values can be done
0019 // using a 64 bit integer that holds a baton/cookie instead of actually having
0020 // to read all register values into a buffer
0021 class RegisterCheckpoint : public UserID {
0022 public:
0023   enum class Reason {
0024     // An expression is about to be run on the thread if the protocol that
0025     // talks to the debuggee supports checkpointing the registers using a
0026     // push/pop then the UserID base class in the RegisterCheckpoint can be
0027     // used to store the baton/cookie that refers to the remote saved state.
0028     eExpression,
0029     // The register checkpoint wants the raw register bytes, so they must be
0030     // read into m_data_sp, or the save/restore checkpoint should fail.
0031     eDataBackup
0032   };
0033 
0034   RegisterCheckpoint(Reason reason) : UserID(0), m_reason(reason) {}
0035 
0036   ~RegisterCheckpoint() = default;
0037 
0038   lldb::WritableDataBufferSP &GetData() { return m_data_sp; }
0039 
0040   const lldb::WritableDataBufferSP &GetData() const { return m_data_sp; }
0041 
0042 protected:
0043   lldb::WritableDataBufferSP m_data_sp;
0044   Reason m_reason;
0045 
0046   // Make RegisterCheckpointSP if you wish to share the data in this class.
0047   RegisterCheckpoint(const RegisterCheckpoint &) = delete;
0048   const RegisterCheckpoint &operator=(const RegisterCheckpoint &) = delete;
0049 };
0050 
0051 } // namespace lldb_private
0052 
0053 #endif // LLDB_TARGET_REGISTERCHECKPOINT_H