https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/132079
These allow for more efficient saving/restoring state after an expression is evaluated. >From e619ec8d09fec2e0567ad6194f60968e89e40627 Mon Sep 17 00:00:00 2001 From: Felipe de Azevedo Piovezan <fpiove...@apple.com> Date: Wed, 19 Mar 2025 15:30:53 -0300 Subject: [PATCH] [lldb] Add RegisterCheckpoint overload for register methods in RegisterContextThreadMemory These allow for more efficient saving/restoring state after an expression is evaluated. --- .../Utility/RegisterContextThreadMemory.cpp | 16 ++++++++++++++++ .../Utility/RegisterContextThreadMemory.h | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp index abddae5d9ced4..75438550ce914 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp @@ -114,6 +114,14 @@ bool RegisterContextThreadMemory::ReadAllRegisterValues( return false; } +bool RegisterContextThreadMemory::ReadAllRegisterValues( + lldb_private::RegisterCheckpoint ®_checkpoint) { + UpdateRegisterContext(); + if (m_reg_ctx_sp) + return m_reg_ctx_sp->ReadAllRegisterValues(reg_checkpoint); + return false; +} + bool RegisterContextThreadMemory::WriteAllRegisterValues( const lldb::DataBufferSP &data_sp) { UpdateRegisterContext(); @@ -122,6 +130,14 @@ bool RegisterContextThreadMemory::WriteAllRegisterValues( return false; } +bool RegisterContextThreadMemory::WriteAllRegisterValues( + const lldb_private::RegisterCheckpoint ®_checkpoint) { + UpdateRegisterContext(); + if (m_reg_ctx_sp) + return m_reg_ctx_sp->WriteAllRegisterValues(reg_checkpoint); + return false; +} + bool RegisterContextThreadMemory::CopyFromRegisterContext( lldb::RegisterContextSP reg_ctx_sp) { UpdateRegisterContext(); diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.h b/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.h index 0a7314528f0ae..23f675508cf38 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.h +++ b/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.h @@ -52,8 +52,12 @@ class RegisterContextThreadMemory : public lldb_private::RegisterContext { // so these API's should only be used when this behavior is needed. bool ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override; + bool ReadAllRegisterValues( + lldb_private::RegisterCheckpoint ®_checkpoint) override; bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; + bool WriteAllRegisterValues( + const lldb_private::RegisterCheckpoint ®_checkpoint) override; bool CopyFromRegisterContext(lldb::RegisterContextSP context); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits