LLDB mainline
RegisterContextPOSIXCore_loongarch64.cpp
Go to the documentation of this file.
1//===-- RegisterContextPOSIXCore_loongarch64.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_loongarch64>
17 const ArchSpec &arch,
18 const DataExtractor &gpregset,
19 llvm::ArrayRef<CoreNote> notes) {
20 return std::unique_ptr<RegisterContextCorePOSIX_loongarch64>(
22 thread,
23 std::make_unique<RegisterInfoPOSIX_loongarch64>(arch, Flags()),
24 gpregset, notes));
25}
26
28 Thread &thread,
29 std::unique_ptr<RegisterInfoPOSIX_loongarch64> register_info,
30 const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
31 : RegisterContextPOSIX_loongarch64(thread, std::move(register_info)) {
32
33 m_gpr.SetData(std::make_shared<DataBufferHeap>(gpregset.GetDataStart(),
34 gpregset.GetByteSize()));
36
37 ArchSpec arch = m_register_info_up->GetTargetArchitecture();
38 DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc);
39 m_fpr.SetData(std::make_shared<DataBufferHeap>(fpregset.GetDataStart(),
40 fpregset.GetByteSize()));
42}
43
45 default;
46
48
50
52 assert(false && "Writing registers is not allowed for core dumps");
53 return false;
54}
55
57 assert(false && "Writing registers is not allowed for core dumps");
58 return false;
59}
60
62 const RegisterInfo *reg_info, RegisterValue &value) {
63 const uint8_t *src = nullptr;
64 lldb::offset_t offset = reg_info->byte_offset;
65
66 if (IsGPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
67 src = m_gpr.GetDataStart();
68 } else if (IsFPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
69 src = m_fpr.GetDataStart();
70 offset -= GetGPRSize();
71 } else {
72 return false;
73 }
74
76 value.SetFromMemoryData(*reg_info, src + offset, reg_info->byte_size,
78 return error.Success();
79}
80
82 const RegisterInfo *reg_info, const RegisterValue &value) {
83 return false;
84}
static llvm::raw_ostream & error(Stream &strm)
static std::unique_ptr< RegisterContextCorePOSIX_loongarch64 > Create(lldb_private::Thread &thread, const lldb_private::ArchSpec &arch, const lldb_private::DataExtractor &gpregset, llvm::ArrayRef< lldb_private::CoreNote > notes)
RegisterContextCorePOSIX_loongarch64(lldb_private::Thread &thread, std::unique_ptr< RegisterInfoPOSIX_loongarch64 > 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
bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value) override
std::unique_ptr< RegisterInfoPOSIX_loongarch64 > 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
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.