LLDB  mainline
RegisterContextPOSIXCore_s390x.cpp
Go to the documentation of this file.
1 //===-- RegisterContextPOSIXCore_s390x.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"
14 
15 #include <memory>
16 
17 using namespace lldb_private;
18 
20  Thread &thread, RegisterInfoInterface *register_info,
21  const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
22  : RegisterContextPOSIX_s390x(thread, 0, register_info) {
23  m_gpr_buffer = std::make_shared<DataBufferHeap>(gpregset.GetDataStart(),
24  gpregset.GetByteSize());
26  m_gpr.SetByteOrder(gpregset.GetByteOrder());
27 
28  DataExtractor fpregset = getRegset(
29  notes, register_info->GetTargetArchitecture().GetTriple(), FPR_Desc);
30  m_fpr_buffer = std::make_shared<DataBufferHeap>(fpregset.GetDataStart(),
31  fpregset.GetByteSize());
33  m_fpr.SetByteOrder(fpregset.GetByteOrder());
34 }
35 
37 
39 
41 
43  assert(0);
44  return false;
45 }
46 
48  assert(0);
49  return false;
50 }
51 
52 bool RegisterContextCorePOSIX_s390x::ReadRegister(const RegisterInfo *reg_info,
53  RegisterValue &value) {
54  const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB];
55  if (reg == LLDB_INVALID_REGNUM)
56  return false;
57 
58  if (IsGPR(reg)) {
59  lldb::offset_t offset = reg_info->byte_offset;
60  uint64_t v = m_gpr.GetMaxU64(&offset, reg_info->byte_size);
61  if (offset == reg_info->byte_offset + reg_info->byte_size) {
62  value.SetUInt(v, reg_info->byte_size);
63  return true;
64  }
65  }
66 
67  if (IsFPR(reg)) {
68  lldb::offset_t offset = reg_info->byte_offset;
69  uint64_t v = m_fpr.GetMaxU64(&offset, reg_info->byte_size);
70  if (offset == reg_info->byte_offset + reg_info->byte_size) {
71  value.SetUInt(v, reg_info->byte_size);
72  return true;
73  }
74  }
75 
76  return false;
77 }
78 
80  lldb::DataBufferSP &data_sp) {
81  return false;
82 }
83 
84 bool RegisterContextCorePOSIX_s390x::WriteRegister(const RegisterInfo *reg_info,
85  const RegisterValue &value) {
86  return false;
87 }
88 
90  const lldb::DataBufferSP &data_sp) {
91  return false;
92 }
93 
95  return false;
96 }
RegisterContextCorePOSIX_s390x::WriteAllRegisterValues
bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override
Definition: RegisterContextPOSIXCore_s390x.cpp:89
RegisterContextCorePOSIX_s390x::HardwareSingleStep
bool HardwareSingleStep(bool enable) override
Definition: RegisterContextPOSIXCore_s390x.cpp:94
LLDB_INVALID_REGNUM
#define LLDB_INVALID_REGNUM
Definition: lldb-defines.h:91
lldb_private::RegisterValue
Definition: RegisterValue.h:28
lldb_private::FPR_Desc
constexpr RegsetDesc FPR_Desc[]
Definition: RegisterUtilities.h:102
RegisterContextCorePOSIX_s390x::RegisterContextCorePOSIX_s390x
RegisterContextCorePOSIX_s390x(lldb_private::Thread &thread, lldb_private::RegisterInfoInterface *register_info, const lldb_private::DataExtractor &gpregset, llvm::ArrayRef< lldb_private::CoreNote > notes)
Definition: RegisterContextPOSIXCore_s390x.cpp:19
lldb_private::RegisterInfoInterface
Definition: RegisterInfoInterface.h:21
lldb_private::RegisterInfoInterface::GetTargetArchitecture
const lldb_private::ArchSpec & GetTargetArchitecture() const
Definition: RegisterInfoInterface.h:40
RegisterContextCorePOSIX_s390x::ReadGPR
bool ReadGPR() override
Definition: RegisterContextPOSIXCore_s390x.cpp:38
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
RegisterValue.h
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:444
RegisterContextCorePOSIX_s390x::WriteFPR
bool WriteFPR() override
Definition: RegisterContextPOSIXCore_s390x.cpp:47
RegisterContextCorePOSIX_s390x::WriteGPR
bool WriteGPR() override
Definition: RegisterContextPOSIXCore_s390x.cpp:42
RegisterContextPOSIX_s390x::IsGPR
bool IsGPR(unsigned reg)
Definition: RegisterContextPOSIX_s390x.cpp:72
RegisterContextCorePOSIX_s390x::ReadAllRegisterValues
bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override
Definition: RegisterContextPOSIXCore_s390x.cpp:79
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
lldb_private::DataExtractor::SetByteOrder
void SetByteOrder(lldb::ByteOrder byte_order)
Set the byte_order value.
Definition: DataExtractor.h:920
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
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_s390x::~RegisterContextCorePOSIX_s390x
~RegisterContextCorePOSIX_s390x() override
RegisterContextPOSIX_s390x
Definition: RegisterContextPOSIX_s390x.h:18
Thread.h
RegisterContextCorePOSIX_s390x::ReadRegister
bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value) override
Definition: RegisterContextPOSIXCore_s390x.cpp:52
RegisterContextPOSIX_s390x::IsFPR
bool IsFPR(unsigned reg)
Definition: RegisterContextPOSIX_s390x.cpp:76
lldb_private::getRegset
DataExtractor getRegset(llvm::ArrayRef< CoreNote > Notes, const llvm::Triple &Triple, llvm::ArrayRef< RegsetDesc > RegsetDescs)
Definition: RegisterUtilities.cpp:28
RegisterContextCorePOSIX_s390x::m_fpr
lldb_private::DataExtractor m_fpr
Definition: RegisterContextPOSIXCore_s390x.h:52
RegisterContextCorePOSIX_s390x::m_gpr
lldb_private::DataExtractor m_gpr
Definition: RegisterContextPOSIXCore_s390x.h:49
uint32_t
lldb_private::RegisterValue::SetUInt
bool SetUInt(uint64_t uint, uint32_t byte_size)
Definition: RegisterValue.cpp:734
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
RegisterContextPOSIXCore_s390x.h
RegisterContextCorePOSIX_s390x::ReadFPR
bool ReadFPR() override
Definition: RegisterContextPOSIXCore_s390x.cpp:40
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
RegisterContextCorePOSIX_s390x::m_gpr_buffer
lldb::DataBufferSP m_gpr_buffer
Definition: RegisterContextPOSIXCore_s390x.h:48
lldb_private::DataExtractor::GetByteSize
uint64_t GetByteSize() const
Get the number of bytes contained in this object.
Definition: DataExtractor.h:259
RegisterContextCorePOSIX_s390x::m_fpr_buffer
lldb::DataBufferSP m_fpr_buffer
Definition: RegisterContextPOSIXCore_s390x.h:51
DataBufferHeap.h
RegisterContextCorePOSIX_s390x::WriteRegister
bool WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value) override
Definition: RegisterContextPOSIXCore_s390x.cpp:84