LLDB mainline
RegisterContextPOSIXCore_riscv32.cpp
Go to the documentation of this file.
1//===-- RegisterContextPOSIXCore_riscv32.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
11
12using namespace lldb_private;
13
14std::unique_ptr<RegisterContextCorePOSIX_riscv32>
16 const DataExtractor &gpregset,
17 llvm::ArrayRef<CoreNote> notes) {
19
20 return std::unique_ptr<RegisterContextCorePOSIX_riscv32>(
22 thread,
23 std::make_unique<RegisterInfoPOSIX_riscv32>(arch, opt_regsets),
24 gpregset, notes));
25}
26
28 Thread &thread, std::unique_ptr<RegisterInfoPOSIX_riscv32> register_info,
29 const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
30 : RegisterContextPOSIX_riscv32(thread, std::move(register_info)) {
31
32 m_gpr.SetData(std::make_shared<DataBufferHeap>(gpregset.GetDataStart(),
33 gpregset.GetByteSize()));
34 m_gpr.SetByteOrder(gpregset.GetByteOrder());
35
36 if (m_register_info_up->IsFPPresent()) {
37 ArchSpec arch = m_register_info_up->GetTargetArchitecture();
38 m_fpr = getRegset(notes, arch.GetTriple(), FPR_Desc);
39 }
40}
41
43
45
47
49 assert(false && "Writing registers is not allowed for core dumps");
50 return false;
51}
52
54 assert(false && "Writing registers is not allowed for core dumps");
55 return false;
56}
57
59 const RegisterInfo *reg_info, RegisterValue &value) {
60 const uint8_t *src = nullptr;
61 lldb::offset_t offset = reg_info->byte_offset;
62
63 if (IsGPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
64 src = m_gpr.GetDataStart();
65 } else if (IsFPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
66 src = m_fpr.GetDataStart();
67 offset -= GetGPRSize();
68 } else {
69 return false;
70 }
71
73 value.SetFromMemoryData(*reg_info, src + offset, reg_info->byte_size,
75 return error.Success();
76}
77
79 const RegisterInfo *reg_info, const RegisterValue &value) {
80 return false;
81}
static llvm::raw_ostream & error(Stream &strm)
static std::unique_ptr< RegisterContextCorePOSIX_riscv32 > Create(lldb_private::Thread &thread, const lldb_private::ArchSpec &arch, 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
bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value) override
RegisterContextCorePOSIX_riscv32(lldb_private::Thread &thread, std::unique_ptr< RegisterInfoPOSIX_riscv32 > register_info, const lldb_private::DataExtractor &gpregset, llvm::ArrayRef< lldb_private::CoreNote > notes)
std::unique_ptr< RegisterInfoPOSIX_riscv32 > m_register_info_up
RegisterContextPOSIX_riscv32(lldb_private::Thread &thread, std::unique_ptr< RegisterInfoPOSIX_riscv32 > register_info)
An architecture specification class.
Definition ArchSpec.h:31
An data extractor class.
uint64_t GetByteSize() const
Get the number of bytes contained in this object.
const uint8_t * GetDataStart() const
Get the data start pointer.
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:118
A class that represents a running process on the host machine.
uint64_t offset_t
Definition lldb-types.h:85
@ 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.