bool RegisterContextCorePOSIX_s390x::ReadRegister(const RegisterInfo *reg_info, RegisterValue &value) { const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB]; if (reg == LLDB_INVALID_REGNUM) return false; if (IsGPR(reg)) { lldb::offset_t offset = reg_info->byte_offset; uint64_t v = m_gpr.GetMaxU64(&offset, reg_info->byte_size); if (offset == reg_info->byte_offset + reg_info->byte_size) { value.SetUInt(v, reg_info->byte_size); return true; } } if (IsFPR(reg)) { lldb::offset_t offset = reg_info->byte_offset; uint64_t v = m_fpr.GetMaxU64(&offset, reg_info->byte_size); if (offset == reg_info->byte_offset + reg_info->byte_size) { value.SetUInt(v, reg_info->byte_size); return true; } } return false; }
bool RegisterContext::WriteRegisterFromUnsigned(const RegisterInfo *reg_info, uint64_t uval) { if (reg_info) { RegisterValue value; if (value.SetUInt(uval, reg_info->byte_size)) return WriteRegister(reg_info, value); } return false; }
bool UnwindAssemblyInstEmulation::GetRegisterValue(const RegisterInfo ®_info, RegisterValue ®_value) { const uint64_t reg_id = MakeRegisterKindValuePair(reg_info); RegisterValueMap::const_iterator pos = m_register_values.find(reg_id); if (pos != m_register_values.end()) { reg_value = pos->second; return true; // We had a real value that comes from an opcode that wrote // to it... } // We are making up a value that is recognizable... reg_value.SetUInt(reg_id, reg_info.byte_size); return false; }
Status NativeRegisterContextLinux_mips64::Read_SR_Config(uint32_t offset, const char *reg_name, uint32_t size, RegisterValue &value) { GPR_linux_mips regs; ::memset(®s, 0, sizeof(GPR_linux_mips)); Status error = NativeProcessLinux::PtraceWrapper( PTRACE_GETREGS, m_thread.GetID(), NULL, ®s, sizeof regs); if (error.Success()) { const lldb_private::ArchSpec &arch = m_thread.GetProcess().GetArchitecture(); void *target_address = ((uint8_t *)®s) + offset + 4 * (arch.GetMachine() == llvm::Triple::mips); value.SetUInt(*(uint32_t *)target_address, size); } return error; }
bool RegisterContextMacOSXFrameBackchain::ReadRegister (const RegisterInfo *reg_info, RegisterValue &value) { if (!m_cursor_is_valid) return false; uint64_t reg_value = LLDB_INVALID_ADDRESS; switch (reg_info->kinds[eRegisterKindGeneric]) { case LLDB_REGNUM_GENERIC_PC: if (m_cursor.pc == LLDB_INVALID_ADDRESS) return false; reg_value = m_cursor.pc; break; case LLDB_REGNUM_GENERIC_FP: if (m_cursor.fp == LLDB_INVALID_ADDRESS) return false; reg_value = m_cursor.fp; break; default: return false; } switch (reg_info->encoding) { case eEncodingInvalid: case eEncodingVector: break; case eEncodingUint: case eEncodingSint: value.SetUInt(reg_value, reg_info->byte_size); return true; case eEncodingIEEE754: switch (reg_info->byte_size) { case sizeof (float): if (sizeof (float) == sizeof(uint32_t)) { value.SetUInt32(reg_value, RegisterValue::eTypeFloat); return true; } else if (sizeof (float) == sizeof(uint64_t)) { value.SetUInt64(reg_value, RegisterValue::eTypeFloat); return true; } break; case sizeof (double): if (sizeof (double) == sizeof(uint32_t)) { value.SetUInt32(reg_value, RegisterValue::eTypeDouble); return true; } else if (sizeof (double) == sizeof(uint64_t)) { value.SetUInt64(reg_value, RegisterValue::eTypeDouble); return true; } break; // TOOD: need a better way to detect when "long double" types are // the same bytes size as "double" #if !defined(__arm__) case sizeof (long double): if (sizeof (long double) == sizeof(uint32_t)) { value.SetUInt32(reg_value, RegisterValue::eTypeLongDouble); return true; } else if (sizeof (long double) == sizeof(uint64_t)) { value.SetUInt64(reg_value, RegisterValue::eTypeLongDouble); return true; } break; #endif } break; } return false; }