22 #define NT_X86_XSTATE 0x202
25 #define REG_CONTEXT_SIZE (GetGPRSize() + sizeof(FPR))
35 assert(0 &&
"read and write cannot both be false");
41 return (0x1 << 2) | rw;
43 return (0x3 << 2) | rw;
45 return (0x2 << 2) | rw;
47 assert(0 &&
"invalid size, must be one of 1, 2, 4, or 8");
109 #if defined(__FreeBSD__)
122 unsigned reg_to_write = reg;
127 if (reg_info->invalidate_regs &&
130 uint32_t full_reg = reg_info->invalidate_regs[0];
137 uint8_t dst[RegisterValue::kMaxRegisterByteSize];
141 full_reg_info, dst,
sizeof(dst), byte_order,
error);
142 if (
error.Success() && dest_size) {
143 uint8_t src[RegisterValue::kMaxRegisterByteSize];
147 reg_info, src,
sizeof(src), byte_order,
error);
148 if (
error.Success() && src_size && (src_size < dest_size)) {
150 memcpy(dst + (reg_info->byte_offset & 0x1), src, src_size);
153 value_to_write.
SetType(full_reg_info);
154 reg_to_write = full_reg;
161 #if defined(__FreeBSD__)
184 bool is_subreg = reg_info->invalidate_regs &&
189 full_reg = reg_info->invalidate_regs[0];
197 if (is_subreg && (reg_info->byte_offset & 0x1))
215 reg_info->byte_size, byte_order);
218 reg_info->byte_size, byte_order);
221 reg_info->byte_size, byte_order);
227 reg_info->byte_size, byte_order);
231 return value.
GetType() == RegisterValue::eTypeBytes;
249 switch (reg_info->byte_size) {
263 assert(
false &&
"Unhandled data size.");
313 uint8_t *dst = (uint8_t *)&
m_fpr + reg_info->byte_offset -
315 switch (reg_info->byte_size) {
329 assert(
false &&
"Unhandled data size.");
344 DataBufferSP &data_sp) {
345 bool success =
false;
348 uint8_t *dst = data_sp->GetBytes();
377 const DataBufferSP &data_sp) {
378 bool success =
false;
380 uint8_t *src = data_sp->GetBytes();
409 addr_t addr,
size_t size,
bool read,
bool write) {
413 for (hw_index = 0; hw_index < num_hw_watchpoints; ++hw_index) {
427 uint64_t new_dr7_bits =
428 current_dr7_bits.
GetAsUInt64() & ~(3 << (2 * hw_index));
440 enum { TRACE_BIT = 0x100 };
447 if (rflags & TRACE_BIT)
452 if (!(rflags & TRACE_BIT))
455 rflags &= ~TRACE_BIT;
492 assert(
false &&
"Could not initialize watchpoint registers");
501 is_hit = val & (1 << hw_index);
525 return wp_monitor_addr;
530 bool is_vacant =
false;
540 assert(
false &&
"Could not initialize watchpoint registers");
546 is_vacant = (val & (3 << 2 * hw_index)) == 0;
553 addr_t addr,
size_t size,
bool read,
bool write,
uint32_t hw_index) {
556 if (num_hw_watchpoints == 0 || hw_index >= num_hw_watchpoints)
559 if (!(size == 1 || size == 2 || size == 4 || size == 8))
562 if (read ==
false && write ==
false)
591 if (hw_index < num_hw_watchpoints) {
595 uint64_t new_dr7_bits =
597 (1 << (2 * hw_index) |
static llvm::raw_ostream & error(Stream &strm)
static uint32_t size_and_rw_bits(size_t size, bool read, bool write)
bool m_watchpoints_initialized
ProcessMonitor & GetMonitor()
Manages communication with the inferior (debugee) process.
bool ReadRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset)
Reads the specified register set into the specified buffer.
bool WriteDebugRegisterValue(lldb::tid_t tid, unsigned offset, const char *reg_name, const lldb_private::RegisterValue &value)
Writes the given value to the debug register identified by the given (architecture dependent) offset.
bool ReadDebugRegisterValue(lldb::tid_t tid, unsigned offset, const char *reg_name, unsigned size, lldb_private::RegisterValue &value)
Reads the contents from the debug register identified by the given (architecture dependent) offset.
bool WriteGPR(lldb::tid_t tid, void *buf, size_t buf_size)
Writes all general purpose registers into the specified buffer.
bool ReadGPR(lldb::tid_t tid, void *buf, size_t buf_size)
Reads all general purpose registers into the specified buffer.
bool WriteRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset)
Writes the specified register set into the specified buffer.
bool WriteFPR(lldb::tid_t tid, void *buf, size_t buf_size)
Writes all floating point registers into the specified buffer.
bool ReadFPR(lldb::tid_t tid, void *buf, size_t buf_size)
Reads all floating point registers into the specified buffer.
bool WriteRegisterValue(lldb::tid_t tid, unsigned offset, const char *reg_name, const lldb_private::RegisterValue &value)
Writes the given value to the register identified by the given (architecture dependent) offset.
bool ReadRegisterValue(lldb::tid_t tid, unsigned offset, const char *reg_name, unsigned size, lldb_private::RegisterValue &value)
Reads the contents from the register identified by the given (architecture dependent) offset.
bool SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, bool read, bool write, uint32_t hw_index) override
lldb::addr_t GetWatchpointAddress(uint32_t hw_index) override
uint32_t m_fctrl_offset_in_userarea
bool UpdateAfterBreakpoint() override
Updates the register state of the associated thread after hitting a breakpoint (if that make sense fo...
uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read, bool write) override
bool HardwareSingleStep(bool enable) override
bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override
uint32_t NumSupportedHardwareWatchpoints() override
bool IsWatchpointHit(uint32_t hw_index) override
unsigned GetRegisterIndexFromOffset(unsigned offset) override
Determines the index in lldb's register file given a kernel byte offset.
bool WriteRegister(const unsigned reg, const lldb_private::RegisterValue &value)
RegisterContextPOSIXProcessMonitor_x86_64(lldb_private::Thread &thread, uint32_t concrete_frame_idx, lldb_private::RegisterInfoInterface *register_info)
bool ClearWatchpointHits() override
bool ReadRegister(const unsigned reg, lldb_private::RegisterValue &value)
bool ClearHardwareWatchpoint(uint32_t hw_index) override
bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override
ProcessMonitor & GetMonitor()
bool IsWatchpointVacant(uint32_t hw_index) override
const lldb_private::RegisterInfo * GetRegisterInfoAtIndex(size_t reg) override
bool CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order)
lldb_private::YMM m_ymm_set
virtual size_t GetGPRSize()
uint64_t m_gpr_x86_64[lldb_private::k_num_gpr_registers_x86_64]
virtual unsigned GetRegisterOffset(unsigned reg)
virtual const lldb_private::RegisterInfo * GetRegisterInfo()
virtual unsigned GetRegisterSize(unsigned reg)
const char * GetRegisterName(unsigned reg)
bool CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order)
A subclass of DataBuffer that stores a data buffer on the heap.
uint64_t GetPC(uint64_t fail_value=LLDB_INVALID_ADDRESS)
uint64_t ReadRegisterAsUnsigned(uint32_t reg, uint64_t fail_value)
lldb::ProcessSP CalculateProcess() override
bool WriteRegisterFromUnsigned(uint32_t reg, uint64_t uval)
const RegisterInfo * GetRegisterInfoByName(llvm::StringRef reg_name, uint32_t start_idx=0)
virtual lldb::ByteOrder GetByteOrder()
RegisterInfo interface to patch RegisterInfo structure for archs.
uint16_t GetAsUInt16(uint16_t fail_value=UINT16_MAX, bool *success_ptr=nullptr) const
void SetUInt64(uint64_t uint, Type t=eTypeUInt64)
uint8_t GetAsUInt8(uint8_t fail_value=UINT8_MAX, bool *success_ptr=nullptr) const
void SetUInt16(uint16_t uint)
uint64_t GetAsUInt64(uint64_t fail_value=UINT64_MAX, bool *success_ptr=nullptr) const
void SetUInt8(uint8_t uint)
uint32_t GetAsMemoryData(const RegisterInfo *reg_info, void *dst, uint32_t dst_len, lldb::ByteOrder dst_byte_order, Status &error) const
void SetBytes(const void *bytes, size_t length, lldb::ByteOrder byte_order)
const void * GetBytes() const
RegisterValue::Type GetType() const
void SetType(RegisterValue::Type type)
uint32_t GetAsUInt32(uint32_t fail_value=UINT32_MAX, bool *success_ptr=nullptr) const
void SetUInt32(uint32_t uint, Type t=eTypeUInt32)
uint32_t GetByteSize() const
#define LLDB_INVALID_INDEX32
#define LLDB_INVALID_ADDRESS
Invalid value definitions.
#define LLDB_INVALID_REGNUM
A class that represents a running process on the host machine.
@ eEncodingVector
vector registers
ByteOrder
Byte ordering definitions.
@ eRegisterKindLLDB
lldb's internal register numbers
lldb::user_id_t GetID() const
Get accessor for the user ID.