LLDB  mainline
RegisterContextPOSIXProcessMonitor_x86.cpp
Go to the documentation of this file.
1 //===-- RegisterContextPOSIXProcessMonitor_x86.cpp --------------*- C++ -*-===//
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 
9 #include "lldb/Target/Thread.h"
12 
16 
17 using namespace lldb_private;
18 using namespace lldb;
19 
20 // Support ptrace extensions even when compiled without required kernel support
21 #ifndef NT_X86_XSTATE
22 #define NT_X86_XSTATE 0x202
23 #endif
24 
25 #define REG_CONTEXT_SIZE (GetGPRSize() + sizeof(FPR))
26 
27 static uint32_t size_and_rw_bits(size_t size, bool read, bool write) {
28  uint32_t rw;
29 
30  if (read)
31  rw = 0x3; // READ or READ/WRITE
32  else if (write)
33  rw = 0x1; // WRITE
34  else
35  assert(0 && "read and write cannot both be false");
36 
37  switch (size) {
38  case 1:
39  return rw;
40  case 2:
41  return (0x1 << 2) | rw;
42  case 4:
43  return (0x3 << 2) | rw;
44  case 8:
45  return (0x2 << 2) | rw;
46  default:
47  assert(0 && "invalid size, must be one of 1, 2, 4, or 8");
48  return 0; // Unreachable. Just to silence compiler.
49  }
50 }
51 
54  Thread &thread, uint32_t concrete_frame_idx,
56  : RegisterContextPOSIX_x86(thread, concrete_frame_idx, register_info) {
57  // Store byte offset of fctrl (i.e. first register of FPR) wrt 'UserArea'
58  const RegisterInfo *reg_info_fctrl = GetRegisterInfoByName("fctrl");
59  m_fctrl_offset_in_userarea = reg_info_fctrl->byte_offset;
60 
61  m_iovec.iov_base = &m_fpr.xsave;
62  m_iovec.iov_len = sizeof(m_fpr.xsave);
63 }
64 
65 ProcessMonitor &RegisterContextPOSIXProcessMonitor_x86_64::GetMonitor() {
66  ProcessSP base = CalculateProcess();
67  ProcessFreeBSD *process = static_cast<ProcessFreeBSD *>(base.get());
68  return process->GetMonitor();
69 }
70 
72  ProcessMonitor &monitor = GetMonitor();
73  return monitor.ReadGPR(m_thread.GetID(), &m_gpr_x86_64, GetGPRSize());
74 }
75 
77  ProcessMonitor &monitor = GetMonitor();
78  if (GetFPRType() == eFXSAVE)
79  return monitor.ReadFPR(m_thread.GetID(), &m_fpr.fxsave,
80  sizeof(m_fpr.fxsave));
81 
82  if (GetFPRType() == eXSAVE)
83  return monitor.ReadRegisterSet(m_thread.GetID(), &m_iovec,
84  sizeof(m_fpr.xsave), NT_X86_XSTATE);
85  return false;
86 }
87 
89  ProcessMonitor &monitor = GetMonitor();
90  return monitor.WriteGPR(m_thread.GetID(), &m_gpr_x86_64, GetGPRSize());
91 }
92 
94  ProcessMonitor &monitor = GetMonitor();
95  if (GetFPRType() == eFXSAVE)
96  return monitor.WriteFPR(m_thread.GetID(), &m_fpr.fxsave,
97  sizeof(m_fpr.fxsave));
98 
99  if (GetFPRType() == eXSAVE)
100  return monitor.WriteRegisterSet(m_thread.GetID(), &m_iovec,
101  sizeof(m_fpr.xsave), NT_X86_XSTATE);
102  return false;
103 }
104 
106  const unsigned reg, RegisterValue &value) {
107  ProcessMonitor &monitor = GetMonitor();
108 
109 #if defined(__FreeBSD__)
110  if (reg >= m_reg_info.first_dr)
111  return monitor.ReadDebugRegisterValue(
113  GetRegisterSize(reg), value);
114 #endif
115  return monitor.ReadRegisterValue(m_thread.GetID(), GetRegisterOffset(reg),
116  GetRegisterName(reg), GetRegisterSize(reg),
117  value);
118 }
119 
121  const unsigned reg, const RegisterValue &value) {
122  unsigned reg_to_write = reg;
123  RegisterValue value_to_write = value;
124 
125  // Check if this is a subregister of a full register.
126  const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg);
127  if (reg_info->invalidate_regs &&
128  (reg_info->invalidate_regs[0] != LLDB_INVALID_REGNUM)) {
129  RegisterValue full_value;
130  uint32_t full_reg = reg_info->invalidate_regs[0];
131  const RegisterInfo *full_reg_info = GetRegisterInfoAtIndex(full_reg);
132 
133  // Read the full register.
134  if (ReadRegister(full_reg_info, full_value)) {
135  Status error;
136  ByteOrder byte_order = GetByteOrder();
137  uint8_t dst[RegisterValue::kMaxRegisterByteSize];
138 
139  // Get the bytes for the full register.
140  const uint32_t dest_size = full_value.GetAsMemoryData(
141  full_reg_info, dst, sizeof(dst), byte_order, error);
142  if (error.Success() && dest_size) {
143  uint8_t src[RegisterValue::kMaxRegisterByteSize];
144 
145  // Get the bytes for the source data.
146  const uint32_t src_size = value.GetAsMemoryData(
147  reg_info, src, sizeof(src), byte_order, error);
148  if (error.Success() && src_size && (src_size < dest_size)) {
149  // Copy the src bytes to the destination.
150  memcpy(dst + (reg_info->byte_offset & 0x1), src, src_size);
151  // Set this full register as the value to write.
152  value_to_write.SetBytes(dst, full_value.GetByteSize(), byte_order);
153  value_to_write.SetType(full_reg_info);
154  reg_to_write = full_reg;
155  }
156  }
157  }
158  }
159 
160  ProcessMonitor &monitor = GetMonitor();
161 #if defined(__FreeBSD__)
162  if (reg >= m_reg_info.first_dr)
163  return monitor.WriteDebugRegisterValue(
164  m_thread.GetID(), GetRegisterOffset(reg_to_write),
165  GetRegisterName(reg_to_write), value_to_write);
166 #endif
167  return monitor.WriteRegisterValue(
168  m_thread.GetID(), GetRegisterOffset(reg_to_write),
169  GetRegisterName(reg_to_write), value_to_write);
170 }
171 
173  const RegisterInfo *reg_info, RegisterValue &value) {
174  if (!reg_info)
175  return false;
176 
177  const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
178 
179  if (IsFPR(reg, GetFPRType())) {
180  if (!ReadFPR())
181  return false;
182  } else {
183  uint32_t full_reg = reg;
184  bool is_subreg = reg_info->invalidate_regs &&
185  (reg_info->invalidate_regs[0] != LLDB_INVALID_REGNUM);
186 
187  if (is_subreg) {
188  // Read the full aligned 64-bit register.
189  full_reg = reg_info->invalidate_regs[0];
190  }
191 
192  bool success = ReadRegister(full_reg, value);
193 
194  if (success) {
195  // If our read was not aligned (for ah,bh,ch,dh), shift our returned
196  // value one byte to the right.
197  if (is_subreg && (reg_info->byte_offset & 0x1))
198  value.SetUInt64(value.GetAsUInt64() >> 8);
199 
200  // If our return byte size was greater than the return value reg size,
201  // then use the type specified by reg_info rather than the uint64_t
202  // default
203  if (value.GetByteSize() > reg_info->byte_size)
204  value.SetType(reg_info);
205  }
206  return success;
207  }
208 
209  if (reg_info->encoding == eEncodingVector) {
210  ByteOrder byte_order = GetByteOrder();
211 
212  if (byte_order != ByteOrder::eByteOrderInvalid) {
213  if (reg >= m_reg_info.first_st && reg <= m_reg_info.last_st)
215  reg_info->byte_size, byte_order);
216  if (reg >= m_reg_info.first_mm && reg <= m_reg_info.last_mm)
218  reg_info->byte_size, byte_order);
219  if (reg >= m_reg_info.first_xmm && reg <= m_reg_info.last_xmm)
221  reg_info->byte_size, byte_order);
222  if (reg >= m_reg_info.first_ymm && reg <= m_reg_info.last_ymm) {
223  // Concatenate ymm using the register halves in xmm.bytes and
224  // ymmh.bytes
225  if (GetFPRType() == eXSAVE && CopyXSTATEtoYMM(reg, byte_order))
227  reg_info->byte_size, byte_order);
228  else
229  return false;
230  }
231  return value.GetType() == RegisterValue::eTypeBytes;
232  }
233  return false;
234  }
235 
236  // Get pointer to m_fpr.fxsave variable and set the data from it. Byte
237  // offsets of all registers are calculated wrt 'UserArea' structure. However,
238  // ReadFPR() reads fpu registers {using ptrace(PT_GETFPREGS,..)} and stores
239  // them in 'm_fpr' (of type FPR structure). To extract values of fpu
240  // registers, m_fpr should be read at byte offsets calculated wrt to FPR
241  // structure.
242 
243  // Since, FPR structure is also one of the member of UserArea structure.
244  // byte_offset(fpu wrt FPR) = byte_offset(fpu wrt UserArea) -
245  // byte_offset(fctrl wrt UserArea)
246  assert((reg_info->byte_offset - m_fctrl_offset_in_userarea) < sizeof(m_fpr));
247  uint8_t *src =
248  (uint8_t *)&m_fpr + reg_info->byte_offset - m_fctrl_offset_in_userarea;
249  switch (reg_info->byte_size) {
250  case 1:
251  value.SetUInt8(*(uint8_t *)src);
252  return true;
253  case 2:
254  value.SetUInt16(*(uint16_t *)src);
255  return true;
256  case 4:
257  value.SetUInt32(*(uint32_t *)src);
258  return true;
259  case 8:
260  value.SetUInt64(*(uint64_t *)src);
261  return true;
262  default:
263  assert(false && "Unhandled data size.");
264  return false;
265  }
266 }
267 
269  const RegisterInfo *reg_info, const RegisterValue &value) {
270  const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
271 
272  if (IsGPR(reg))
273  return WriteRegister(reg, value);
274 
275  if (IsFPR(reg, GetFPRType())) {
276  if (reg_info->encoding == eEncodingVector) {
277  if (reg >= m_reg_info.first_st && reg <= m_reg_info.last_st)
278  ::memcpy(m_fpr.fxsave.stmm[reg - m_reg_info.first_st].bytes,
279  value.GetBytes(), value.GetByteSize());
280 
281  if (reg >= m_reg_info.first_mm && reg <= m_reg_info.last_mm)
282  ::memcpy(m_fpr.fxsave.stmm[reg - m_reg_info.first_mm].bytes,
283  value.GetBytes(), value.GetByteSize());
284 
285  if (reg >= m_reg_info.first_xmm && reg <= m_reg_info.last_xmm)
286  ::memcpy(m_fpr.fxsave.xmm[reg - m_reg_info.first_xmm].bytes,
287  value.GetBytes(), value.GetByteSize());
288 
289  if (reg >= m_reg_info.first_ymm && reg <= m_reg_info.last_ymm) {
290  if (GetFPRType() != eXSAVE)
291  return false; // the target processor does not support AVX
292 
293  // Store ymm register content, and split into the register halves in
294  // xmm.bytes and ymmh.bytes
295  ::memcpy(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes,
296  value.GetBytes(), value.GetByteSize());
297  if (false == CopyYMMtoXSTATE(reg, GetByteOrder()))
298  return false;
299  }
300  } else {
301  // Get pointer to m_fpr.fxsave variable and set the data to it. Byte
302  // offsets of all registers are calculated wrt 'UserArea' structure.
303  // However, WriteFPR() takes m_fpr (of type FPR structure) and writes
304  // only fpu registers using ptrace(PT_SETFPREGS,..) API. Hence fpu
305  // registers should be written in m_fpr at byte offsets calculated wrt
306  // FPR structure.
307 
308  // Since, FPR structure is also one of the member of UserArea structure.
309  // byte_offset(fpu wrt FPR) = byte_offset(fpu wrt UserArea) -
310  // byte_offset(fctrl wrt UserArea)
311  assert((reg_info->byte_offset - m_fctrl_offset_in_userarea) <
312  sizeof(m_fpr));
313  uint8_t *dst = (uint8_t *)&m_fpr + reg_info->byte_offset -
314  m_fctrl_offset_in_userarea;
315  switch (reg_info->byte_size) {
316  case 1:
317  *(uint8_t *)dst = value.GetAsUInt8();
318  break;
319  case 2:
320  *(uint16_t *)dst = value.GetAsUInt16();
321  break;
322  case 4:
323  *(uint32_t *)dst = value.GetAsUInt32();
324  break;
325  case 8:
326  *(uint64_t *)dst = value.GetAsUInt64();
327  break;
328  default:
329  assert(false && "Unhandled data size.");
330  return false;
331  }
332  }
333 
334  if (WriteFPR()) {
335  if (IsAVX(reg))
336  return CopyYMMtoXSTATE(reg, GetByteOrder());
337  return true;
338  }
339  }
340  return false;
341 }
342 
344  DataBufferSP &data_sp) {
345  bool success = false;
346  data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
347  if (data_sp && ReadGPR() && ReadFPR()) {
348  uint8_t *dst = data_sp->GetBytes();
349  success = dst != 0;
350 
351  if (success) {
352  ::memcpy(dst, &m_gpr_x86_64, GetGPRSize());
353  dst += GetGPRSize();
354  if (GetFPRType() == eFXSAVE)
355  ::memcpy(dst, &m_fpr.fxsave, sizeof(m_fpr.fxsave));
356  }
357 
358  if (GetFPRType() == eXSAVE) {
359  ByteOrder byte_order = GetByteOrder();
360 
361  // Assemble the YMM register content from the register halves.
362  for (uint32_t reg = m_reg_info.first_ymm;
363  success && reg <= m_reg_info.last_ymm; ++reg)
364  success = CopyXSTATEtoYMM(reg, byte_order);
365 
366  if (success) {
367  // Copy the extended register state including the assembled ymm
368  // registers.
369  ::memcpy(dst, &m_fpr, sizeof(m_fpr));
370  }
371  }
372  }
373  return success;
374 }
375 
377  const DataBufferSP &data_sp) {
378  bool success = false;
379  if (data_sp && data_sp->GetByteSize() == REG_CONTEXT_SIZE) {
380  uint8_t *src = data_sp->GetBytes();
381  if (src) {
382  ::memcpy(&m_gpr_x86_64, src, GetGPRSize());
383 
384  if (WriteGPR()) {
385  src += GetGPRSize();
386  if (GetFPRType() == eFXSAVE)
387  ::memcpy(&m_fpr.fxsave, src, sizeof(m_fpr.fxsave));
388  if (GetFPRType() == eXSAVE)
389  ::memcpy(&m_fpr.xsave, src, sizeof(m_fpr.xsave));
390 
391  success = WriteFPR();
392  if (success) {
393  if (GetFPRType() == eXSAVE) {
394  ByteOrder byte_order = GetByteOrder();
395 
396  // Parse the YMM register content from the register halves.
397  for (uint32_t reg = m_reg_info.first_ymm;
398  success && reg <= m_reg_info.last_ymm; ++reg)
399  success = CopyYMMtoXSTATE(reg, byte_order);
400  }
401  }
402  }
403  }
404  }
405  return success;
406 }
407 
409  addr_t addr, size_t size, bool read, bool write) {
410  const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
411  uint32_t hw_index;
412 
413  for (hw_index = 0; hw_index < num_hw_watchpoints; ++hw_index) {
414  if (IsWatchpointVacant(hw_index))
415  return SetHardwareWatchpointWithIndex(addr, size, read, write, hw_index);
416  }
417 
418  return LLDB_INVALID_INDEX32;
419 }
420 
422  uint32_t hw_index) {
423  if (hw_index < NumSupportedHardwareWatchpoints()) {
424  RegisterValue current_dr7_bits;
425 
426  if (ReadRegister(m_reg_info.first_dr + 7, current_dr7_bits)) {
427  uint64_t new_dr7_bits =
428  current_dr7_bits.GetAsUInt64() & ~(3 << (2 * hw_index));
429 
430  if (WriteRegister(m_reg_info.first_dr + 7, RegisterValue(new_dr7_bits)))
431  return true;
432  }
433  }
434 
435  return false;
436 }
437 
439  bool enable) {
440  enum { TRACE_BIT = 0x100 };
441  uint64_t rflags;
442 
443  if ((rflags = ReadRegisterAsUnsigned(m_reg_info.gpr_flags, -1UL)) == -1UL)
444  return false;
445 
446  if (enable) {
447  if (rflags & TRACE_BIT)
448  return true;
449 
450  rflags |= TRACE_BIT;
451  } else {
452  if (!(rflags & TRACE_BIT))
453  return false;
454 
455  rflags &= ~TRACE_BIT;
456  }
457 
459 }
460 
462  // PC points one byte past the int3 responsible for the breakpoint.
464 
465  if ((pc = GetPC()) == LLDB_INVALID_ADDRESS)
466  return false;
467 
468  SetPC(pc - 1);
469  return true;
470 }
471 
473  unsigned offset) {
474  unsigned reg;
475  for (reg = 0; reg < m_reg_info.num_registers; reg++) {
476  if (GetRegisterInfo()[reg].byte_offset == offset)
477  break;
478  }
479  assert(reg < m_reg_info.num_registers && "Invalid register offset.");
480  return reg;
481 }
482 
484  uint32_t hw_index) {
485  bool is_hit = false;
486 
487  if (m_watchpoints_initialized == false) {
488  // Reset the debug status and debug control registers
489  RegisterValue zero_bits = RegisterValue(uint64_t(0));
490  if (!WriteRegister(m_reg_info.first_dr + 6, zero_bits) ||
491  !WriteRegister(m_reg_info.first_dr + 7, zero_bits))
492  assert(false && "Could not initialize watchpoint registers");
494  }
495 
496  if (hw_index < NumSupportedHardwareWatchpoints()) {
497  RegisterValue value;
498 
499  if (ReadRegister(m_reg_info.first_dr + 6, value)) {
500  uint64_t val = value.GetAsUInt64();
501  is_hit = val & (1 << hw_index);
502  }
503  }
504 
505  return is_hit;
506 }
507 
509  return WriteRegister(m_reg_info.first_dr + 6, RegisterValue((uint64_t)0));
510 }
511 
513  uint32_t hw_index) {
514  addr_t wp_monitor_addr = LLDB_INVALID_ADDRESS;
515 
516  if (hw_index < NumSupportedHardwareWatchpoints()) {
517  if (!IsWatchpointVacant(hw_index)) {
518  RegisterValue value;
519 
520  if (ReadRegister(m_reg_info.first_dr + hw_index, value))
521  wp_monitor_addr = value.GetAsUInt64();
522  }
523  }
524 
525  return wp_monitor_addr;
526 }
527 
529  uint32_t hw_index) {
530  bool is_vacant = false;
531  RegisterValue value;
532 
533  assert(hw_index < NumSupportedHardwareWatchpoints());
534 
535  if (m_watchpoints_initialized == false) {
536  // Reset the debug status and debug control registers
537  RegisterValue zero_bits = RegisterValue(uint64_t(0));
538  if (!WriteRegister(m_reg_info.first_dr + 6, zero_bits) ||
539  !WriteRegister(m_reg_info.first_dr + 7, zero_bits))
540  assert(false && "Could not initialize watchpoint registers");
542  }
543 
544  if (ReadRegister(m_reg_info.first_dr + 7, value)) {
545  uint64_t val = value.GetAsUInt64();
546  is_vacant = (val & (3 << 2 * hw_index)) == 0;
547  }
548 
549  return is_vacant;
550 }
551 
553  addr_t addr, size_t size, bool read, bool write, uint32_t hw_index) {
554  const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
555 
556  if (num_hw_watchpoints == 0 || hw_index >= num_hw_watchpoints)
557  return false;
558 
559  if (!(size == 1 || size == 2 || size == 4 || size == 8))
560  return false;
561 
562  if (read == false && write == false)
563  return false;
564 
565  if (!IsWatchpointVacant(hw_index))
566  return false;
567 
568  // Set both dr7 (debug control register) and dri (debug address register).
569 
570  // dr7{7-0} encodes the local/global enable bits:
571  // global enable --. .-- local enable
572  // | |
573  // v v
574  // dr0 -> bits{1-0}
575  // dr1 -> bits{3-2}
576  // dr2 -> bits{5-4}
577  // dr3 -> bits{7-6}
578  //
579  // dr7{31-16} encodes the rw/len bits:
580  // b_x+3, b_x+2, b_x+1, b_x
581  // where bits{x+1, x} => rw
582  // 0b00: execute, 0b01: write, 0b11: read-or-write,
583  // 0b10: io read-or-write (unused)
584  // and bits{x+3, x+2} => len
585  // 0b00: 1-byte, 0b01: 2-byte, 0b11: 4-byte, 0b10: 8-byte
586  //
587  // dr0 -> bits{19-16}
588  // dr1 -> bits{23-20}
589  // dr2 -> bits{27-24}
590  // dr3 -> bits{31-28}
591  if (hw_index < num_hw_watchpoints) {
592  RegisterValue current_dr7_bits;
593 
594  if (ReadRegister(m_reg_info.first_dr + 7, current_dr7_bits)) {
595  uint64_t new_dr7_bits =
596  current_dr7_bits.GetAsUInt64() |
597  (1 << (2 * hw_index) |
598  size_and_rw_bits(size, read, write) << (16 + 4 * hw_index));
599 
600  if (WriteRegister(m_reg_info.first_dr + hw_index, RegisterValue(addr)) &&
601  WriteRegister(m_reg_info.first_dr + 7, RegisterValue(new_dr7_bits)))
602  return true;
603  }
604  }
605 
606  return false;
607 }
608 
609 uint32_t
611  // Available debug address registers: dr0, dr1, dr2, dr3
612  return 4;
613 }
virtual unsigned GetRegisterOffset(unsigned reg)
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
virtual const lldb_private::RegisterInfo * GetRegisterInfo()
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 ReadRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset)
Reads the specified register set into the specified buffer.
uint64_t ReadRegisterAsUnsigned(uint32_t reg, uint64_t fail_value)
RegisterInfo interface to patch RegisterInfo structure for archs.
uint32_t GetAsMemoryData(const RegisterInfo *reg_info, void *dst, uint32_t dst_len, lldb::ByteOrder dst_byte_order, Status &error) const
lldb::user_id_t GetID() const
Get accessor for the user ID.
Definition: UserID.h:49
bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp)
void SetUInt8(uint8_t uint)
bool UpdateAfterBreakpoint()
Updates the register state of the associated thread after hitting a breakpoint (if that make sense fo...
uint64_t GetAsUInt64(uint64_t fail_value=UINT64_MAX, bool *success_ptr=nullptr) const
A subclass of DataBuffer that stores a data buffer on the heap.
void SetUInt64(uint64_t uint, Type t=eTypeUInt64)
bool ReadRegister(const unsigned reg, lldb_private::RegisterValue &value)
void SetUInt16(uint16_t uint)
bool ReadFPR(lldb::tid_t tid, void *buf, size_t buf_size)
Reads all floating point registers into the specified buffer.
Manages communication with the inferior (debugee) process.
unsigned GetRegisterIndexFromOffset(unsigned offset)
Determines the index in lldb&#39;s register file given a kernel byte offset.
virtual unsigned GetRegisterSize(unsigned reg)
#define LLDB_INVALID_ADDRESS
Invalid value definitions.
Definition: lldb-defines.h:85
#define LLDB_INVALID_INDEX32
Definition: lldb-defines.h:86
uint16_t GetAsUInt16(uint16_t fail_value=UINT16_MAX, bool *success_ptr=nullptr) const
uint64_t GetPC(uint64_t fail_value=LLDB_INVALID_ADDRESS)
const char * GetRegisterName(unsigned reg)
ProcessMonitor & GetMonitor()
const void * GetBytes() const
static uint32_t size_and_rw_bits(size_t size, bool read, bool write)
const RegisterInfo * GetRegisterInfoByName(llvm::StringRef reg_name, uint32_t start_idx=0)
RegisterValue::Type GetType() const
Definition: RegisterValue.h:79
bool Success() const
Test for success condition.
Definition: Status.cpp:287
void SetUInt32(uint32_t uint, Type t=eTypeUInt32)
bool WriteRegisterFromUnsigned(uint32_t reg, uint64_t uval)
bool WriteRegister(const unsigned reg, const lldb_private::RegisterValue &value)
uint32_t GetAsUInt32(uint32_t fail_value=UINT32_MAX, bool *success_ptr=nullptr) const
uint64_t m_gpr_x86_64[lldb_private::k_num_gpr_registers_x86_64]
bool WriteFPR(lldb::tid_t tid, void *buf, size_t buf_size)
Writes all floating point registers into the specified buffer.
uint64_t addr_t
Definition: lldb-types.h:83
bool CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order)
Definition: SBAddress.h:15
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...
void SetBytes(const void *bytes, size_t length, lldb::ByteOrder byte_order)
uint8_t GetAsUInt8(uint8_t fail_value=UINT8_MAX, bool *success_ptr=nullptr) const
lldb::ProcessSP CalculateProcess() override
const lldb_private::RegisterInfo * GetRegisterInfoAtIndex(size_t reg) override
RegisterContextPOSIXProcessMonitor_x86_64(lldb_private::Thread &thread, uint32_t concrete_frame_idx, lldb_private::RegisterInfoInterface *register_info)
uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read, bool write)
void SetType(RegisterValue::Type type)
Definition: RegisterValue.h:83
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 ReadGPR(lldb::tid_t tid, void *buf, size_t buf_size)
Reads all general purpose 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 SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, bool read, bool write, uint32_t hw_index)
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...
An error handling class.
Definition: Status.h:44
bool CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order)
bool WriteGPR(lldb::tid_t tid, void *buf, size_t buf_size)
Writes all general purpose registers into the specified buffer.
#define LLDB_INVALID_REGNUM
Definition: lldb-defines.h:90