LLDB mainline
RegisterContextPOSIXCore_powerpc.cpp
Go to the documentation of this file.
1//===-- RegisterContextPOSIXCore_powerpc.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
17using namespace lldb_private;
18
20 Thread &thread, RegisterInfoInterface *register_info,
21 const DataExtractor &gpregset, llvm::ArrayRef<CoreNote> notes)
22 : RegisterContextPOSIX_powerpc(thread, 0, register_info) {
23 m_gpr_buffer = std::make_shared<DataBufferHeap>(gpregset.GetDataStart(),
24 gpregset.GetByteSize());
27
28 ArchSpec arch = register_info->GetTargetArchitecture();
29 DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc);
30 m_fpr_buffer = std::make_shared<DataBufferHeap>(fpregset.GetDataStart(),
31 fpregset.GetByteSize());
34
35 DataExtractor vregset = getRegset(notes, arch.GetTriple(), PPC_VMX_Desc);
36 m_vec_buffer = std::make_shared<DataBufferHeap>(vregset.GetDataStart(),
37 vregset.GetByteSize());
40}
41
43
45
47
49
51 assert(0);
52 return false;
53}
54
56 assert(0);
57 return false;
58}
59
61 assert(0);
62 return false;
63}
64
66 const RegisterInfo *reg_info, RegisterValue &value) {
67 lldb::offset_t offset = reg_info->byte_offset;
68 if (IsFPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
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 = v;
72 return true;
73 }
74 } else if (IsVMX(reg_info->kinds[lldb::eRegisterKindLLDB])) {
75 uint32_t v[4];
76 offset = m_vec.CopyData(offset, reg_info->byte_size, &v);
77 if (offset == reg_info->byte_size) {
78 value.SetBytes(v, reg_info->byte_size, m_vec.GetByteOrder());
79 return true;
80 }
81 } else {
82 uint64_t v = m_gpr.GetMaxU64(&offset, reg_info->byte_size);
83 if (offset == reg_info->byte_offset + reg_info->byte_size) {
84 if (reg_info->byte_size < sizeof(v))
85 value = (uint32_t)v;
86 else
87 value = v;
88 return true;
89 }
90 }
91 return false;
92}
93
96 return false;
97}
98
100 const RegisterInfo *reg_info, const RegisterValue &value) {
101 return false;
102}
103
105 const lldb::DataBufferSP &data_sp) {
106 return false;
107}
108
110 return false;
111}
bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value) override
RegisterContextCorePOSIX_powerpc(lldb_private::Thread &thread, lldb_private::RegisterInfoInterface *register_info, const lldb_private::DataExtractor &gpregset, llvm::ArrayRef< lldb_private::CoreNote > notes)
bool ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override
bool WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value) override
bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override
An architecture specification class.
Definition: ArchSpec.h:31
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:450
An data extractor class.
Definition: DataExtractor.h:48
lldb::offset_t CopyData(lldb::offset_t offset, lldb::offset_t length, void *dst) const
Copy length bytes from *offset, without swapping bytes.
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
void SetBytes(const void *bytes, size_t length, lldb::ByteOrder byte_order)
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[]
constexpr RegsetDesc PPC_VMX_Desc[]
uint64_t offset_t
Definition: lldb-types.h:85
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:331
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
Definition: lldb-forward.h:332
@ 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.