LLDB mainline
RegisterContextPOSIXCore_riscv64.cpp
Go to the documentation of this file.
1//===-- RegisterContextPOSIXCore_riscv64.cpp ------------------------------===//
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
10
12
13using namespace lldb_private;
14
15std::unique_ptr<RegisterContextCorePOSIX_riscv64>
17 const DataExtractor &gpregset,
18 llvm::ArrayRef<CoreNote> notes) {
19 return std::unique_ptr<RegisterContextCorePOSIX_riscv64>(
21 thread, std::make_unique<RegisterInfoPOSIX_riscv64>(arch, Flags()),
22 gpregset, notes));
23}
24
26 Thread &thread, std::unique_ptr<RegisterInfoPOSIX_riscv64> register_info,
27 const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
28 : RegisterContextPOSIX_riscv64(thread, std::move(register_info)) {
29
30 m_gpr_buffer = std::make_shared<DataBufferHeap>(gpregset.GetDataStart(),
31 gpregset.GetByteSize());
34
35 ArchSpec arch = m_register_info_up->GetTargetArchitecture();
36 DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc);
37 m_fpr_buffer = std::make_shared<DataBufferHeap>(fpregset.GetDataStart(),
38 fpregset.GetByteSize());
41}
42
44
46
48
50 assert(false && "Writing registers is not allowed for core dumps");
51 return false;
52}
53
55 assert(false && "Writing registers is not allowed for core dumps");
56 return false;
57}
58
60 const RegisterInfo *reg_info, RegisterValue &value) {
61 const uint8_t *src = nullptr;
62 lldb::offset_t offset = reg_info->byte_offset;
63
64 if (IsGPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
65 src = m_gpr.GetDataStart();
66 } else if (IsFPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
67 src = m_fpr.GetDataStart();
68 offset -= GetGPRSize();
69 } else {
70 return false;
71 }
72
74 value.SetFromMemoryData(*reg_info, src + offset, reg_info->byte_size,
76 return error.Success();
77}
78
80 const RegisterInfo *reg_info, const RegisterValue &value) {
81 return false;
82}
static llvm::raw_ostream & error(Stream &strm)
RegisterContextCorePOSIX_riscv64(lldb_private::Thread &thread, std::unique_ptr< RegisterInfoPOSIX_riscv64 > register_info, const lldb_private::DataExtractor &gpregset, llvm::ArrayRef< lldb_private::CoreNote > notes)
bool WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value) override
static std::unique_ptr< RegisterContextCorePOSIX_riscv64 > Create(lldb_private::Thread &thread, const lldb_private::ArchSpec &arch, const lldb_private::DataExtractor &gpregset, llvm::ArrayRef< lldb_private::CoreNote > notes)
bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value) override
std::unique_ptr< RegisterInfoPOSIX_riscv64 > m_register_info_up
An architecture specification class.
Definition: ArchSpec.h:31
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:450
An data extractor class.
Definition: DataExtractor.h:48
void SetByteOrder(lldb::ByteOrder byte_order)
Set the byte_order value.
uint64_t GetByteSize() const
Get the number of bytes contained in this object.
const uint8_t * GetDataStart() const
Get the data start pointer.
lldb::offset_t SetData(const void *bytes, lldb::offset_t length, lldb::ByteOrder byte_order)
Set data with a buffer that is caller owned.
lldb::ByteOrder GetByteOrder() const
Get the current byte order value.
A class to manage flags.
Definition: Flags.h:22
uint32_t SetFromMemoryData(const RegisterInfo &reg_info, const void *src, uint32_t src_len, lldb::ByteOrder src_byte_order, Status &error)
An error handling class.
Definition: Status.h:44
A class that represents a running process on the host machine.
DataExtractor getRegset(llvm::ArrayRef< CoreNote > Notes, const llvm::Triple &Triple, llvm::ArrayRef< RegsetDesc > RegsetDescs)
constexpr RegsetDesc FPR_Desc[]
uint64_t offset_t
Definition: lldb-types.h:85
@ eByteOrderLittle
@ eRegisterKindLLDB
lldb's internal register numbers
Every register is described in detail including its name, alternate name (optional),...
uint32_t byte_offset
The byte offset in the register context data where this register's value is found.
uint32_t byte_size
Size in bytes of the register.
uint32_t kinds[lldb::kNumRegisterKinds]
Holds all of the various register numbers for all register kinds.