LLDB  mainline
RegisterCheckpoint.h
Go to the documentation of this file.
1 //===-- RegisterCheckpoint.h ------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_TARGET_REGISTERCHECKPOINT_H
10 #define LLDB_TARGET_REGISTERCHECKPOINT_H
11 
12 #include "lldb/Target/StackID.h"
13 #include "lldb/Utility/UserID.h"
14 #include "lldb/lldb-private.h"
15 
16 namespace lldb_private {
17 
18 // Inherit from UserID in case pushing/popping all register values can be done
19 // using a 64 bit integer that holds a baton/cookie instead of actually having
20 // to read all register values into a buffer
21 class RegisterCheckpoint : public UserID {
22 public:
23  enum class Reason {
24  // An expression is about to be run on the thread if the protocol that
25  // talks to the debuggee supports checkpointing the registers using a
26  // push/pop then the UserID base class in the RegisterCheckpoint can be
27  // used to store the baton/cookie that refers to the remote saved state.
29  // The register checkpoint wants the raw register bytes, so they must be
30  // read into m_data_sp, or the save/restore checkpoint should fail.
32  };
33 
34  RegisterCheckpoint(Reason reason) : UserID(0), m_reason(reason) {}
35 
36  ~RegisterCheckpoint() = default;
37 
38  lldb::WritableDataBufferSP &GetData() { return m_data_sp; }
39 
40  const lldb::WritableDataBufferSP &GetData() const { return m_data_sp; }
41 
42 protected:
43  lldb::WritableDataBufferSP m_data_sp;
45 
46  // Make RegisterCheckpointSP if you wish to share the data in this class.
47  RegisterCheckpoint(const RegisterCheckpoint &) = delete;
48  const RegisterCheckpoint &operator=(const RegisterCheckpoint &) = delete;
49 };
50 
51 } // namespace lldb_private
52 
53 #endif // LLDB_TARGET_REGISTERCHECKPOINT_H
lldb_private::RegisterCheckpoint::m_data_sp
lldb::WritableDataBufferSP m_data_sp
Definition: RegisterCheckpoint.h:43
lldb_private::RegisterCheckpoint::Reason
Reason
Definition: RegisterCheckpoint.h:23
lldb_private::RegisterCheckpoint::GetData
const lldb::WritableDataBufferSP & GetData() const
Definition: RegisterCheckpoint.h:40
lldb_private::UserID
Definition: UserID.h:31
lldb_private::RegisterCheckpoint::m_reason
Reason m_reason
Definition: RegisterCheckpoint.h:44
StackID.h
lldb_private::RegisterCheckpoint::~RegisterCheckpoint
~RegisterCheckpoint()=default
lldb_private::RegisterCheckpoint::operator=
const RegisterCheckpoint & operator=(const RegisterCheckpoint &)=delete
lldb_private::RegisterCheckpoint::RegisterCheckpoint
RegisterCheckpoint(Reason reason)
Definition: RegisterCheckpoint.h:34
UserID.h
lldb_private::RegisterCheckpoint::GetData
lldb::WritableDataBufferSP & GetData()
Definition: RegisterCheckpoint.h:38
lldb-private.h
lldb_private::RegisterCheckpoint::Reason::eDataBackup
@ eDataBackup
lldb_private::RegisterCheckpoint::Reason::eExpression
@ eExpression
lldb_private::RegisterCheckpoint
Definition: RegisterCheckpoint.h:21
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16