22#include <sys/ptrace.h>
31NativeRegisterContextFreeBSD::CreateHostNativeRegisterContextFreeBSD(
33 return new NativeRegisterContextFreeBSD_arm(target_arch, native_thread);
36NativeRegisterContextFreeBSD_arm::NativeRegisterContextFreeBSD_arm(
42NativeRegisterContextFreeBSD_arm::GetRegisterInfo()
const {
46uint32_t NativeRegisterContextFreeBSD_arm::GetRegisterSetCount()
const {
51NativeRegisterContextFreeBSD_arm::GetRegisterSet(uint32_t set_index)
const {
52 return GetRegisterInfo().GetRegisterSet(set_index);
55uint32_t NativeRegisterContextFreeBSD_arm::GetUserRegisterCount()
const {
57 for (uint32_t set_index = 0; set_index < GetRegisterSetCount(); ++set_index)
62Status NativeRegisterContextFreeBSD_arm::ReadRegisterSet(uint32_t set) {
65 return NativeProcessFreeBSD::PtraceWrapper(PT_GETREGS, m_thread.GetID(),
68 return NativeProcessFreeBSD::PtraceWrapper(
69 PT_GETVFPREGS, m_thread.GetID(),
72 llvm_unreachable(
"NativeRegisterContextFreeBSD_arm::ReadRegisterSet");
75Status NativeRegisterContextFreeBSD_arm::WriteRegisterSet(uint32_t set) {
78 return NativeProcessFreeBSD::PtraceWrapper(PT_SETREGS, m_thread.GetID(),
81 return NativeProcessFreeBSD::PtraceWrapper(
82 PT_SETVFPREGS, m_thread.GetID(),
85 llvm_unreachable(
"NativeRegisterContextFreeBSD_arm::WriteRegisterSet");
89NativeRegisterContextFreeBSD_arm::ReadRegister(
const RegisterInfo *reg_info,
94 error.SetErrorString(
"reg_info NULL");
101 return Status(
"no lldb regnum for %s", reg_info && reg_info->
name
103 :
"<unknown register>");
105 uint32_t set = GetRegisterInfo().GetRegisterSetFromRegisterIndex(reg);
106 error = ReadRegisterSet(set);
112 reg_info->
byte_size, endian::InlHostByteOrder());
116Status NativeRegisterContextFreeBSD_arm::WriteRegister(
121 return Status(
"reg_info NULL");
126 return Status(
"no lldb regnum for %s", reg_info && reg_info->
name
128 :
"<unknown register>");
130 uint32_t set = GetRegisterInfo().GetRegisterSetFromRegisterIndex(reg);
131 error = ReadRegisterSet(set);
139 return WriteRegisterSet(set);
142Status NativeRegisterContextFreeBSD_arm::ReadAllRegisterValues(
155 uint8_t *dst = data_sp->GetBytes();
156 ::memcpy(dst, m_reg_data.data(), m_reg_data.size());
161Status NativeRegisterContextFreeBSD_arm::WriteAllRegisterValues(
166 error.SetErrorStringWithFormat(
167 "NativeRegisterContextFreeBSD_arm::%s invalid data_sp provided",
172 if (data_sp->GetByteSize() != m_reg_data.size()) {
173 error.SetErrorStringWithFormat(
174 "NativeRegisterContextFreeBSD_arm::%s data_sp contained mismatched "
175 "data size, expected %" PRIu64
", actual %" PRIu64,
176 __FUNCTION__, m_reg_data.size(), data_sp->GetByteSize());
180 const uint8_t *src = data_sp->GetBytes();
181 if (src ==
nullptr) {
182 error.SetErrorStringWithFormat(
"NativeRegisterContextFreeBSD_arm::%s "
183 "DataBuffer::GetBytes() returned a null "
188 ::memcpy(m_reg_data.data(), src, m_reg_data.size());
197llvm::Error NativeRegisterContextFreeBSD_arm::CopyHardwareWatchpointsFrom(
199 return llvm::Error::success();
static llvm::raw_ostream & error(Stream &strm)
size_t GetRegisterSetCount() const override
An architecture specification class.
A subclass of DataBuffer that stores a data buffer on the heap.
void SetBytes(const void *bytes, size_t length, lldb::ByteOrder byte_order)
const void * GetBytes() const
#define LLDB_INVALID_REGNUM
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
@ 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.
const char * name
Name of this register, can't be NULL.
Registers are grouped into register sets.
size_t num_registers
The number of registers in REGISTERS array below.