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 
16 using 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());
25  m_gpr.SetByteOrder(gpregset.GetByteOrder());
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());
32  m_fpr.SetByteOrder(fpregset.GetByteOrder());
33 }
34 
36 
38 
40 
42  assert(0);
43  return false;
44 }
45 
47  assert(0);
48  return false;
49 }
50 
51 bool RegisterContextCorePOSIX_mips64::ReadRegister(const RegisterInfo *reg_info,
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 
75  lldb::DataBufferSP &data_sp) {
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 }
lldb_private::ArchSpec
Definition: ArchSpec.h:33
RegisterContextCorePOSIX_mips64::m_fpr
lldb_private::DataExtractor m_fpr
Definition: RegisterContextPOSIXCore_mips64.h:52
lldb_private::ArchSpec::GetMachine
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition: ArchSpec.cpp:667
lldb_private::RegisterValue
Definition: RegisterValue.h:28
RegisterContextPOSIX_mips64
Definition: RegisterContextPOSIX_mips64.h:17
lldb_private::FPR_Desc
constexpr RegsetDesc FPR_Desc[]
Definition: RegisterUtilities.h:102
lldb_private::RegisterInfoInterface
Definition: RegisterInfoInterface.h:21
RegisterContextPOSIX_mips64::IsGPR
bool IsGPR(unsigned reg)
Definition: RegisterContextPOSIX_mips64.cpp:29
lldb_private::RegisterInfoInterface::GetTargetArchitecture
const lldb_private::ArchSpec & GetTargetArchitecture() const
Definition: RegisterInfoInterface.h:40
RegisterContextPOSIXCore_mips64.h
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
RegisterValue.h
RegisterContextCorePOSIX_mips64::HardwareSingleStep
bool HardwareSingleStep(bool enable) override
Definition: RegisterContextPOSIXCore_mips64.cpp:89
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:444
RegisterContextCorePOSIX_mips64::m_fpr_buffer
lldb::DataBufferSP m_fpr_buffer
Definition: RegisterContextPOSIXCore_mips64.h:50
lldb_private::DataExtractor::SetData
lldb::offset_t SetData(const void *bytes, lldb::offset_t length, lldb::ByteOrder byte_order)
Set data with a buffer that is caller owned.
Definition: DataExtractor.cpp:225
RegisterContextCorePOSIX_mips64::ReadAllRegisterValues
bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override
Definition: RegisterContextPOSIXCore_mips64.cpp:74
lldb_private::DataExtractor::SetByteOrder
void SetByteOrder(lldb::ByteOrder byte_order)
Set the byte_order value.
Definition: DataExtractor.h:920
RegisterContextCorePOSIX_mips64::ReadRegister
bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value) override
Definition: RegisterContextPOSIXCore_mips64.cpp:51
lldb::eRegisterKindLLDB
@ eRegisterKindLLDB
lldb's internal register numbers
Definition: lldb-enumerations.h:234
lldb_private::DataExtractor
Definition: DataExtractor.h:48
lldb_private::Thread
Definition: Thread.h:62
RegisterContextCorePOSIX_mips64::ReadGPR
bool ReadGPR() override
Definition: RegisterContextPOSIXCore_mips64.cpp:37
RegisterContextCorePOSIX_mips64::m_gpr
lldb_private::DataExtractor m_gpr
Definition: RegisterContextPOSIXCore_mips64.h:51
lldb_private::DataExtractor::GetDataStart
const uint8_t * GetDataStart() const
Get the data start pointer.
Definition: DataExtractor.h:411
lldb_private::DataExtractor::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Get the current byte order value.
Definition: DataExtractor.h:583
RegisterContextCorePOSIX_mips64::WriteRegister
bool WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value) override
Definition: RegisterContextPOSIXCore_mips64.cpp:79
Thread.h
lldb_private::getRegset
DataExtractor getRegset(llvm::ArrayRef< CoreNote > Notes, const llvm::Triple &Triple, llvm::ArrayRef< RegsetDesc > RegsetDescs)
Definition: RegisterUtilities.cpp:28
RegisterContextCorePOSIX_mips64::m_gpr_buffer
lldb::DataBufferSP m_gpr_buffer
Definition: RegisterContextPOSIXCore_mips64.h:49
RegisterContextPOSIX_mips64::m_register_info_up
std::unique_ptr< lldb_private::RegisterInfoInterface > m_register_info_up
Definition: RegisterContextPOSIX_mips64.h:60
RegisterContextCorePOSIX_mips64::RegisterContextCorePOSIX_mips64
RegisterContextCorePOSIX_mips64(lldb_private::Thread &thread, lldb_private::RegisterInfoInterface *register_info, const lldb_private::DataExtractor &gpregset, llvm::ArrayRef< lldb_private::CoreNote > notes)
Definition: RegisterContextPOSIXCore_mips64.cpp:18
RegisterContextCorePOSIX_mips64::WriteAllRegisterValues
bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override
Definition: RegisterContextPOSIXCore_mips64.cpp:84
lldb_private::DataExtractor::GetMaxU64
uint64_t GetMaxU64(lldb::offset_t *offset_ptr, size_t byte_size) const
Extract an unsigned integer of size byte_size from *offset_ptr.
Definition: DataExtractor.cpp:526
RegisterContextCorePOSIX_mips64::~RegisterContextCorePOSIX_mips64
~RegisterContextCorePOSIX_mips64() override
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
RegisterContextCorePOSIX_mips64::ReadFPR
bool ReadFPR() override
Definition: RegisterContextPOSIXCore_mips64.cpp:39
GPR_linux_mips
Definition: RegisterContext_mips.h:244
lldb_private::DataExtractor::GetByteSize
uint64_t GetByteSize() const
Get the number of bytes contained in this object.
Definition: DataExtractor.h:259
RegisterContextCorePOSIX_mips64::WriteGPR
bool WriteGPR() override
Definition: RegisterContextPOSIXCore_mips64.cpp:41
RegisterContextCorePOSIX_mips64::WriteFPR
bool WriteFPR() override
Definition: RegisterContextPOSIXCore_mips64.cpp:46
RegisterContextPOSIX_mips64::IsFPR
bool IsFPR(unsigned reg)
Definition: RegisterContextPOSIX_mips64.cpp:33