================
@@ -0,0 +1,84 @@
+//===-- RegisterContextPOSIXCore_riscv64.cpp 
------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "RegisterContextPOSIXCore_riscv64.h"
+
+#include "lldb/Utility/DataBufferHeap.h"
+
+using namespace lldb_private;
+
+std::unique_ptr<RegisterContextCorePOSIX_riscv64>
+RegisterContextCorePOSIX_riscv64::Create(
+    lldb_private::Thread &thread, const lldb_private::ArchSpec &arch,
+    const lldb_private::DataExtractor &gpregset,
+    llvm::ArrayRef<lldb_private::CoreNote> notes) {
+  Flags flags = 0;
+
+  auto register_info_up =
+      std::make_unique<RegisterInfoPOSIX_riscv64>(arch, flags);
+  return std::unique_ptr<RegisterContextCorePOSIX_riscv64>(
+      new RegisterContextCorePOSIX_riscv64(thread, std::move(register_info_up),
+                                           gpregset, notes));
+}
+
+RegisterContextCorePOSIX_riscv64::RegisterContextCorePOSIX_riscv64(
+    Thread &thread, std::unique_ptr<RegisterInfoPOSIX_riscv64> register_info,
+    const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
+    : RegisterContextPOSIX_riscv64(thread, std::move(register_info)) {
+
+  m_gpr_buffer = std::make_shared<DataBufferHeap>(gpregset.GetDataStart(),
+                                                  gpregset.GetByteSize());
+  m_gpr.SetData(m_gpr_buffer);
+  m_gpr.SetByteOrder(gpregset.GetByteOrder());
+
+  ArchSpec arch = m_register_info_up->GetTargetArchitecture();
+  DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc);
+  m_fpr_buffer = std::make_shared<DataBufferHeap>(fpregset.GetDataStart(),
+                                                  fpregset.GetByteSize());
+  m_fpr.SetData(m_fpr_buffer);
+  m_fpr.SetByteOrder(fpregset.GetByteOrder());
+}
+
+RegisterContextCorePOSIX_riscv64::~RegisterContextCorePOSIX_riscv64() = 
default;
+
+bool RegisterContextCorePOSIX_riscv64::ReadGPR() { return true; }
+
+bool RegisterContextCorePOSIX_riscv64::ReadFPR() { return true; }
+
+bool RegisterContextCorePOSIX_riscv64::WriteGPR() {
+  assert(0);
----------------
AlexeyMerzlyakov wrote:

Done in latest 
[commit](https://github.com/llvm/llvm-project/pull/93297/commits/7239f6293ee088a7cde8fa2e6feee00aedf7ac9a#diff-e10987e6f6d77043ea40e6564367e979569651da252148e82ce3e99ab4f44ae3R57).
 If I understood well, the work with coredumps is not implied register changing 
(all core plugins for other architectures are also having `assert(0)` 
construction in their register writing routines), so these methods are not 
going to be implemented in future. I've changed the assertion message to 
`Writing registers is not allowed for core dumps`. Please correct me, if I 
wrong.

https://github.com/llvm/llvm-project/pull/93297
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to