Status NativeRegisterContextLinux_mips64::WriteAllRegisterValues( const lldb::DataBufferSP &data_sp) { Status error; if (!data_sp) { error.SetErrorStringWithFormat( "NativeRegisterContextLinux_mips64::%s invalid data_sp provided", __FUNCTION__); return error; } if (data_sp->GetByteSize() != REG_CONTEXT_SIZE) { error.SetErrorStringWithFormat( "NativeRegisterContextLinux_mips64::%s data_sp contained mismatched " "data size, expected %" PRIu64 ", actual %" PRIu64, __FUNCTION__, REG_CONTEXT_SIZE, data_sp->GetByteSize()); return error; } uint8_t *src = data_sp->GetBytes(); if (src == nullptr) { error.SetErrorStringWithFormat("NativeRegisterContextLinux_mips64::%s " "DataBuffer::GetBytes() returned a null " "pointer", __FUNCTION__); return error; } ::memcpy(&m_gpr, src, GetRegisterInfoInterface().GetGPRSize()); src += GetRegisterInfoInterface().GetGPRSize(); ::memcpy(&m_fpr, src, GetFPRSize()); src += GetFPRSize(); ::memcpy(&m_msa, src, sizeof(MSA_linux_mips)); error = WriteGPR(); if (!error.Success()) { error.SetErrorStringWithFormat( "NativeRegisterContextLinux_mips64::%s WriteGPR() failed", __FUNCTION__); return error; } error = WriteCP1(); if (!error.Success()) { error.SetErrorStringWithFormat( "NativeRegisterContextLinux_mips64::%s WriteCP1() failed", __FUNCTION__); return error; } return error; }
Status NativeRegisterContextLinux_s390x::WriteAllRegisterValues( const lldb::DataBufferSP &data_sp) { Status error; if (!data_sp) { error.SetErrorStringWithFormat( "NativeRegisterContextLinux_s390x::%s invalid data_sp provided", __FUNCTION__); return error; } if (data_sp->GetByteSize() != REG_CONTEXT_SIZE) { error.SetErrorStringWithFormat( "NativeRegisterContextLinux_s390x::%s data_sp contained mismatched " "data size, expected %" PRIu64 ", actual %" PRIu64, __FUNCTION__, REG_CONTEXT_SIZE, data_sp->GetByteSize()); return error; } uint8_t *src = data_sp->GetBytes(); if (src == nullptr) { error.SetErrorStringWithFormat("NativeRegisterContextLinux_s390x::%s " "DataBuffer::GetBytes() returned a null " "pointer", __FUNCTION__); return error; } error = DoWriteGPR(src, sizeof(s390_regs)); src += sizeof(s390_regs); if (error.Fail()) return error; error = DoWriteFPR(src, sizeof(s390_fp_regs)); src += sizeof(s390_fp_regs); if (error.Fail()) return error; // Ignore errors if the regset is unsupported (happens on older kernels). DoWriteRegisterSet(NT_S390_SYSTEM_CALL, src, 4); src += 4; return error; }
bool RegisterContextWindows_x86::WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) { assert(data_sp->GetByteSize() >= sizeof(m_context)); memcpy(&m_context, data_sp->GetBytes(), sizeof(m_context)); TargetThreadWindows &wthread = static_cast<TargetThreadWindows &>(m_thread); if (!::SetThreadContext(wthread.GetHostThread().GetNativeThread().GetSystemHandle(), &m_context)) return false; return true; }
bool RegisterContextWindows_x86::ReadAllRegisterValues(lldb::DataBufferSP &data_sp) { if (!CacheAllRegisterValues()) return false; if (data_sp->GetByteSize() < sizeof(m_context)) { data_sp.reset(new DataBufferHeap(sizeof(CONTEXT), 0)); } memcpy(data_sp->GetBytes(), &m_context, sizeof(m_context)); return true; }
bool RegisterContextPOSIXProcessMonitor_arm64::WriteAllRegisterValues( const lldb::DataBufferSP &data_sp) { bool success = false; if (data_sp && data_sp->GetByteSize() == REG_CONTEXT_SIZE) { uint8_t *src = data_sp->GetBytes(); if (src) { ::memcpy(&m_gpr_arm64, src, GetGPRSize()); if (WriteGPR()) { src += GetGPRSize(); ::memcpy(&m_fpr, src, sizeof m_fpr); success = WriteFPR(); } } } return success; }
bool RegisterContextDarwin_arm64::WriteAllRegisterValues( const lldb::DataBufferSP &data_sp) { if (data_sp && data_sp->GetByteSize() == REG_CONTEXT_SIZE) { const uint8_t *src = data_sp->GetBytes(); ::memcpy(&gpr, src, sizeof(gpr)); src += sizeof(gpr); ::memcpy(&fpu, src, sizeof(fpu)); src += sizeof(gpr); ::memcpy(&exc, src, sizeof(exc)); uint32_t success_count = 0; if (WriteGPR() == KERN_SUCCESS) ++success_count; if (WriteFPU() == KERN_SUCCESS) ++success_count; if (WriteEXC() == KERN_SUCCESS) ++success_count; return success_count == 3; } return false; }
size_t ObjectContainerUniversalMachO::GetModuleSpecifications( const lldb_private::FileSpec &file, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, lldb::offset_t file_offset, lldb::offset_t file_size, lldb_private::ModuleSpecList &specs) { const size_t initial_count = specs.GetSize(); DataExtractor data; data.SetData(data_sp, data_offset, data_sp->GetByteSize()); if (ObjectContainerUniversalMachO::MagicBytesMatch(data)) { llvm::MachO::fat_header header; std::vector<llvm::MachO::fat_arch> fat_archs; if (ParseHeader(data, header, fat_archs)) { for (const llvm::MachO::fat_arch &fat_arch : fat_archs) { const lldb::offset_t slice_file_offset = fat_arch.offset + file_offset; if (fat_arch.offset < file_size && file_size > slice_file_offset) { ObjectFile::GetModuleSpecifications( file, slice_file_offset, file_size - slice_file_offset, specs); } } } } return specs.GetSize() - initial_count; }