19#include "llvm/ADT/ArrayRef.h" 
   20#include "llvm/ADT/StringRef.h" 
   47        "invalid register value type for register {0}", reg_info.
name);
 
   51  const uint32_t src_len = reg_info.
byte_size;
 
   61  const uint32_t bytes_copied =
 
   67  if (bytes_copied == 0)
 
   69        "failed to copy data for register write of %s", reg_info.
name);
 
 
   75                                          const void *src, uint32_t src_len,
 
   94  const uint32_t dst_len = reg_info.
byte_size;
 
   96  if (src_len > dst_len) {
 
   98        "%u bytes is too big to store in register %s (%u bytes)", src_len,
 
   99        reg_info.
name, dst_len);
 
 
  148    assert(
error.Success() && 
"Expected SetValueFromData to succeed.");
 
 
  158                                       bool partial_data_ok) {
 
  173  if (!partial_data_ok && (src_len < reg_info.
byte_size)) {
 
  200      uint64_t data1 = src.
GetU64(&src_offset);
 
  201      uint64_t data2 = src.
GetU64(&src_offset);
 
  215    else if (reg_info.
byte_size == 
sizeof(
double))
 
  217    else if (reg_info.
byte_size == 
sizeof(
long double))
 
  233          "failed to copy data for register write of %s", reg_info.
name);
 
  241        "invalid register value type for register %s", reg_info.
name);
 
 
  247                                llvm::StringRef vector_str,
 
  248                                const uint32_t byte_size,
 
  252  vector_str = vector_str.trim();
 
  253  vector_str.consume_front(
"{");
 
  254  vector_str.consume_back(
"}");
 
  255  vector_str = vector_str.trim();
 
  263  llvm::StringRef cdr = vector_str;
 
  264  std::tie(car, cdr) = vector_str.split(Sep);
 
  265  std::vector<uint8_t> bytes;
 
  271  while (!car.getAsInteger(0, 
byte) && bytes.size() < byte_size) {
 
  272    bytes.push_back(
byte);
 
  273    std::tie(car, cdr) = cdr.split(Sep);
 
  277  if (bytes.size() != byte_size)
 
 
  285                                          size_t total_byte_size) {
 
  286  if (total_byte_size > 8)
 
  289  if (total_byte_size == 8)
 
  293      (
static_cast<uint64_t
>(1) << 
static_cast<uint64_t
>(total_byte_size * 8)) -
 
  295  return uval64 <= max;
 
 
  299                                          size_t total_byte_size) {
 
  300  if (total_byte_size > 8)
 
  303  if (total_byte_size == 8)
 
  306  const int64_t max = (
static_cast<int64_t
>(1)
 
  307                       << 
static_cast<uint64_t
>(total_byte_size * 8 - 1)) -
 
  309  const int64_t min = ~(max);
 
  310  return min <= sval64 && sval64 <= max;
 
 
  314                                         llvm::StringRef value_str) {
 
  316  if (reg_info == 
nullptr) {
 
  322  if (value_str.empty()) {
 
  326  const uint32_t byte_size = reg_info->
byte_size;
 
  332  long double ldbl_val;
 
  339    if (byte_size > 
sizeof(uint64_t)) {
 
  341          "unsupported unsigned integer byte size: %u", byte_size);
 
  344    if (value_str.getAsInteger(0, uval64)) {
 
  346          "'{0}' is not a valid unsigned integer string value", value_str);
 
  353          " is too large to fit in a %u byte unsigned integer value",
 
  360          "unsupported unsigned integer byte size: %u", byte_size);
 
  366    if (byte_size > 
sizeof(
long long)) {
 
  368          "unsupported signed integer byte size: %u", byte_size);
 
  372    if (value_str.getAsInteger(0, ival64)) {
 
  374          "'{0}' is not a valid signed integer string value", value_str);
 
  381          " is too large to fit in a %u byte signed integer value",
 
  388          "unsupported signed integer byte size: %u", byte_size);
 
  394    std::string value_string = std::string(value_str);
 
  395    if (byte_size == 
sizeof(
float)) {
 
  396      if (::sscanf(value_string.c_str(), 
"%f", &flt_val) != 1) {
 
  398            "'%s' is not a valid float string value", value_string.c_str());
 
  403    } 
else if (byte_size == 
sizeof(
double)) {
 
  404      if (::sscanf(value_string.c_str(), 
"%lf", &dbl_val) != 1) {
 
  406            "'%s' is not a valid float string value", value_string.c_str());
 
  411    } 
else if (byte_size == 
sizeof(
long double)) {
 
  412      if (::sscanf(value_string.c_str(), 
"%Lf", &ldbl_val) != 1) {
 
  414            "'%s' is not a valid float string value", value_string.c_str());
 
  421          "unsupported float byte size: %u", byte_size);
 
 
  446    return m_scalar.SignExtend(sign_bitpos);
 
 
  483                                    bool *success_ptr)
 const {
 
  494    switch (
buffer.bytes.size()) {
 
  499      return *
reinterpret_cast<const uint16_t *
>(
buffer.bytes.data());
 
  504    *success_ptr = 
false;
 
 
  509                                    bool *success_ptr)
 const {
 
  523    switch (
buffer.bytes.size()) {
 
  529      return *
reinterpret_cast<const uint32_t *
>(
buffer.bytes.data());
 
  534    *success_ptr = 
false;
 
 
  539                                    bool *success_ptr)
 const {
 
  552    return m_scalar.ULongLong(fail_value);
 
  554    switch (
buffer.bytes.size()) {
 
  558      return *(
const uint8_t *)
buffer.bytes.data();
 
  560      return *
reinterpret_cast<const uint16_t *
>(
buffer.bytes.data());
 
  562      return *
reinterpret_cast<const uint32_t *
>(
buffer.bytes.data());
 
  564      return *
reinterpret_cast<const uint64_t *
>(
buffer.bytes.data());
 
  569    *success_ptr = 
false;
 
 
  574                                        bool *success_ptr)
 const {
 
  588    return m_scalar.UInt128(fail_value);
 
  590    switch (
buffer.bytes.size()) {
 
  600          (
reinterpret_cast<const type128 *
>(
buffer.bytes.data()))->x);
 
  605    *success_ptr = 
false;
 
 
  624    *success_ptr = 
false;
 
 
  644    *success_ptr = 
false;
 
 
  649                                           bool *success_ptr)
 const {
 
  665    *success_ptr = 
false;
 
 
  682    return buffer.bytes.data();
 
  684    return buffer.bytes.data();
 
 
  705    return buffer.bytes.size();
 
 
  711  if (byte_size == 0) {
 
  713  } 
else if (byte_size == 1) {
 
  715  } 
else if (byte_size <= 2) {
 
  717  } 
else if (byte_size <= 4) {
 
  719  } 
else if (byte_size <= 8) {
 
  721  } 
else if (byte_size <= 16) {
 
 
  730  if (bytes && length > 0) {
 
  732    buffer.bytes.resize(length);
 
  733    memcpy(
buffer.bytes.data(), bytes, length);
 
  734    buffer.byte_order = byte_order;
 
 
  763  return !(*
this == rhs);
 
 
  791        byte_idx = 
buffer.bytes.size() - (
bit / 8) - 1;
 
  795      const uint32_t byte_bit = 
bit % 8;
 
  796      if (byte_idx < 
buffer.bytes.size()) {
 
  797        buffer.bytes[byte_idx] &= ~(1u << byte_bit);
 
 
  831        byte_idx = 
buffer.bytes.size() - (
bit / 8) - 1;
 
  835      const uint32_t byte_bit = 
bit % 8;
 
  836      if (byte_idx < 
buffer.bytes.size()) {
 
  837        buffer.bytes[byte_idx] |= (1u << byte_bit);
 
 
static llvm::raw_ostream & error(Stream &strm)
static bool ParseVectorEncoding(const RegisterInfo *reg_info, llvm::StringRef vector_str, const uint32_t byte_size, RegisterValue *reg_value)
static bool UInt64ValueIsValidForByteSize(uint64_t uval64, size_t total_byte_size)
static bool SInt64ValueIsValidForByteSize(int64_t sval64, size_t total_byte_size)
#define NUM_OF_WORDS_INT128
bool operator==(const RegisterValue &rhs) const
RegisterValue::Type m_type
uint16_t GetAsUInt16(uint16_t fail_value=UINT16_MAX, bool *success_ptr=nullptr) const
bool SignExtend(uint32_t sign_bitpos)
uint32_t SetFromMemoryData(const RegisterInfo ®_info, const void *src, uint32_t src_len, lldb::ByteOrder src_byte_order, Status &error)
long double GetAsLongDouble(long double fail_value=0.0, bool *success_ptr=nullptr) const
bool GetData(DataExtractor &data) const
void SetUInt64(uint64_t uint, Type t=eTypeUInt64)
void SetUInt16(uint16_t uint)
double GetAsDouble(double fail_value=0.0, bool *success_ptr=nullptr) const
bool ClearBit(uint32_t bit)
bool SetUInt(uint64_t uint, uint32_t byte_size)
Status SetValueFromString(const RegisterInfo *reg_info, llvm::StringRef value_str)
uint32_t GetAsMemoryData(const RegisterInfo ®_info, void *dst, uint32_t dst_len, lldb::ByteOrder dst_byte_order, Status &error) const
uint64_t GetAsUInt64(uint64_t fail_value=UINT64_MAX, bool *success_ptr=nullptr) const
float GetAsFloat(float fail_value=0.0f, bool *success_ptr=nullptr) const
void SetUInt8(uint8_t uint)
llvm::APInt GetAsUInt128(const llvm::APInt &fail_value, bool *success_ptr=nullptr) const
struct lldb_private::RegisterValue::RegisterValueBuffer buffer
void SetBytes(const void *bytes, size_t length, lldb::ByteOrder byte_order)
bool GetScalarValue(Scalar &scalar) const
const void * GetBytes() const
RegisterValue::Type GetType() const
void SetLongDouble(long double f)
void SetUInt128(llvm::APInt uint)
bool operator!=(const RegisterValue &rhs) const
Status SetValueFromData(const RegisterInfo ®_info, DataExtractor &data, lldb::offset_t offset, bool partial_data_ok)
void SetType(RegisterValue::Type type)
bool SetBit(uint32_t bit)
uint32_t GetAsUInt32(uint32_t fail_value=UINT32_MAX, bool *success_ptr=nullptr) const
bool CopyValue(const RegisterValue &rhs)
void SetUInt32(uint32_t uint, Type t=eTypeUInt32)
uint32_t GetByteSize() const
lldb::ByteOrder GetByteOrder() const
Status SetValueFromData(const DataExtractor &data, lldb::Encoding encoding, size_t byte_size)
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
bool Success() const
Test for success condition.
#define UNUSED_IF_ASSERT_DISABLED(x)
A class that represents a running process on the host machine.
static uint32_t bit(const uint32_t val, const uint32_t msbit)
@ eEncodingVector
vector registers
@ eEncodingUint
unsigned integer
@ eEncodingSint
signed integer
ByteOrder
Byte ordering definitions.
Every register is described in detail including its name, alternate name (optional),...
lldb::Encoding encoding
Encoding of the register bits.
uint32_t byte_size
Size in bytes of the register.
const char * name
Name of this register, can't be NULL.
lldb::ByteOrder byte_order