LLDB mainline
RegisterContextPOSIXCore_mips64.cpp
Go to the documentation of this file.
1//===-- RegisterContextPOSIXCore_mips64.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
11#include "lldb/Target/Thread.h"
13
14#include <memory>
15
16using namespace lldb_private;
17
19 Thread &thread, RegisterInfoInterface *register_info,
20 const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
21 : RegisterContextPOSIX_mips64(thread, 0, register_info) {
22 m_gpr_buffer = std::make_shared<DataBufferHeap>(gpregset.GetDataStart(),
23 gpregset.GetByteSize());
26
27 DataExtractor fpregset = getRegset(
28 notes, register_info->GetTargetArchitecture().GetTriple(), FPR_Desc);
29 m_fpr_buffer = std::make_shared<DataBufferHeap>(fpregset.GetDataStart(),
30 fpregset.GetByteSize());
33}
34
36
38
40
42 assert(0);
43 return false;
44}
45
47 assert(0);
48 return false;
49}
50
52 RegisterValue &value) {
53
54 lldb::offset_t offset = reg_info->byte_offset;
55 lldb_private::ArchSpec arch = m_register_info_up->GetTargetArchitecture();
56 uint64_t v;
57 if (IsGPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
58 if (reg_info->byte_size == 4 && !(arch.GetMachine() == llvm::Triple::mips64el))
59 // In case of 32bit core file, the register data are placed at 4 byte
60 // offset.
61 offset = offset / 2;
62 v = m_gpr.GetMaxU64(&offset, reg_info->byte_size);
63 value = v;
64 return true;
65 } else if (IsFPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
66 offset = offset - sizeof(GPR_linux_mips);
67 v =m_fpr.GetMaxU64(&offset, reg_info->byte_size);
68 value = v;
69 return true;
70 }
71 return false;
72}
73
76 return false;
77}
78
80 const RegisterInfo *reg_info, const RegisterValue &value) {
81 return false;
82}
83
85 const lldb::DataBufferSP &data_sp) {
86 return false;
87}
88
90 return false;
91}
bool WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value) override
bool ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override
RegisterContextCorePOSIX_mips64(lldb_private::Thread &thread, lldb_private::RegisterInfoInterface *register_info, const lldb_private::DataExtractor &gpregset, llvm::ArrayRef< lldb_private::CoreNote > notes)
bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value) override
bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override
std::unique_ptr< lldb_private::RegisterInfoInterface > m_register_info_up
An architecture specification class.
Definition: ArchSpec.h:31
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:461
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition: ArchSpec.cpp:701
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.
uint64_t GetMaxU64(lldb::offset_t *offset_ptr, size_t byte_size) const
Extract an unsigned integer of size byte_size from *offset_ptr.
lldb::ByteOrder GetByteOrder() const
Get the current byte order value.
RegisterInfo interface to patch RegisterInfo structure for archs.
const lldb_private::ArchSpec & GetTargetArchitecture() const
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
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:336
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
Definition: lldb-forward.h:337
@ 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.