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) {
20
21 DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc);
22 if (fpregset.GetByteSize() >= sizeof(uint64_t)) {
24 }
25
26 return std::unique_ptr<RegisterContextCorePOSIX_riscv64>(
28 thread,
29 std::make_unique<RegisterInfoPOSIX_riscv64>(arch, opt_regsets),
30 gpregset, notes));
31}
32
34 Thread &thread, std::unique_ptr<RegisterInfoPOSIX_riscv64> register_info,
35 const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
36 : RegisterContextPOSIX_riscv64(thread, std::move(register_info)) {
37
38 m_gpr.SetData(std::make_shared<DataBufferHeap>(gpregset.GetDataStart(),
39 gpregset.GetByteSize()));
41
42 if (m_register_info_up->IsFPPresent()) {
43 ArchSpec arch = m_register_info_up->GetTargetArchitecture();
44 m_fpr = getRegset(notes, arch.GetTriple(), FPR_Desc);
45 }
46}
47
49
51
53
55 assert(false && "Writing registers is not allowed for core dumps");
56 return false;
57}
58
60 assert(false && "Writing registers is not allowed for core dumps");
61 return false;
62}
63
65 const RegisterInfo *reg_info, RegisterValue &value) {
66 const uint8_t *src = nullptr;
67 lldb::offset_t offset = reg_info->byte_offset;
68
69 if (IsGPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
70 src = m_gpr.GetDataStart();
71 } else if (IsFPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
72 src = m_fpr.GetDataStart();
73 offset -= GetGPRSize();
74 } else {
75 return false;
76 }
77
79 value.SetFromMemoryData(*reg_info, src + offset, reg_info->byte_size,
81 return error.Success();
82}
83
85 const RegisterInfo *reg_info, const RegisterValue &value) {
86 return false;
87}
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:461
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
ValueType Set(ValueType mask)
Set one or more flags by logical OR'ing mask with the current flags.
Definition: Flags.h:73
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:115
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.