diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h --- a/lldb/include/lldb/Symbol/CompilerType.h +++ b/lldb/include/lldb/Symbol/CompilerType.h @@ -357,14 +357,6 @@ bool GetValueAsScalar(const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size, Scalar &value) const; - bool SetValueFromScalar(const Scalar &value, Stream &strm); - - bool ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t addr, - AddressType address_type, DataExtractor &data); - - bool WriteToMemory(ExecutionContext *exe_ctx, lldb::addr_t addr, - AddressType address_type, StreamString &new_value); - void Clear() { m_type = nullptr; m_type_system = nullptr; diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp --- a/lldb/source/Symbol/CompilerType.cpp +++ b/lldb/source/Symbol/CompilerType.cpp @@ -874,173 +874,6 @@ return false; } -bool CompilerType::SetValueFromScalar(const Scalar &value, Stream &strm) { - if (!IsValid()) - return false; - - // Aggregate types don't have scalar values - if (!IsAggregateType()) { - strm.GetFlags().Set(Stream::eBinary); - uint64_t count = 0; - lldb::Encoding encoding = GetEncoding(count); - - if (encoding == lldb::eEncodingInvalid || count != 1) - return false; - - llvm::Optional bit_width = GetBitSize(nullptr); - if (!bit_width) - return false; - - // This function doesn't currently handle non-byte aligned assignments - if ((*bit_width % 8) != 0) - return false; - - const uint64_t byte_size = (*bit_width + 7) / 8; - switch (encoding) { - case lldb::eEncodingInvalid: - break; - case lldb::eEncodingVector: - break; - case lldb::eEncodingUint: - switch (byte_size) { - case 1: - strm.PutHex8(value.UInt()); - return true; - case 2: - strm.PutHex16(value.UInt()); - return true; - case 4: - strm.PutHex32(value.UInt()); - return true; - case 8: - strm.PutHex64(value.ULongLong()); - return true; - default: - break; - } - break; - - case lldb::eEncodingSint: - switch (byte_size) { - case 1: - strm.PutHex8(value.SInt()); - return true; - case 2: - strm.PutHex16(value.SInt()); - return true; - case 4: - strm.PutHex32(value.SInt()); - return true; - case 8: - strm.PutHex64(value.SLongLong()); - return true; - default: - break; - } - break; - - case lldb::eEncodingIEEE754: - if (byte_size <= sizeof(long double)) { - if (byte_size == sizeof(float)) { - strm.PutFloat(value.Float()); - return true; - } else if (byte_size == sizeof(double)) { - strm.PutDouble(value.Double()); - return true; - } else if (byte_size == sizeof(long double)) { - strm.PutDouble(value.LongDouble()); - return true; - } - } - break; - } - } - return false; -} - -bool CompilerType::ReadFromMemory(lldb_private::ExecutionContext *exe_ctx, - lldb::addr_t addr, AddressType address_type, - lldb_private::DataExtractor &data) { - if (!IsValid()) - return false; - - // Can't convert a file address to anything valid without more context (which - // Module it came from) - if (address_type == eAddressTypeFile) - return false; - - if (!GetCompleteType()) - return false; - - auto byte_size = - GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr); - if (!byte_size) - return false; - - if (data.GetByteSize() < *byte_size) { - lldb::DataBufferSP data_sp(new DataBufferHeap(*byte_size, '\0')); - data.SetData(data_sp); - } - - uint8_t *dst = const_cast(data.PeekData(0, *byte_size)); - if (dst != nullptr) { - if (address_type == eAddressTypeHost) { - if (addr == 0) - return false; - // The address is an address in this process, so just copy it - memcpy(dst, reinterpret_cast(addr), *byte_size); - return true; - } else { - Process *process = nullptr; - if (exe_ctx) - process = exe_ctx->GetProcessPtr(); - if (process) { - Status error; - return process->ReadMemory(addr, dst, *byte_size, error) == *byte_size; - } - } - } - return false; -} - -bool CompilerType::WriteToMemory(lldb_private::ExecutionContext *exe_ctx, - lldb::addr_t addr, AddressType address_type, - StreamString &new_value) { - if (!IsValid()) - return false; - - // Can't convert a file address to anything valid without more context (which - // Module it came from) - if (address_type == eAddressTypeFile) - return false; - - if (!GetCompleteType()) - return false; - - auto byte_size = - GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr); - if (!byte_size) - return false; - - if (*byte_size > 0) { - if (address_type == eAddressTypeHost) { - // The address is an address in this process, so just copy it - memcpy((void *)addr, new_value.GetData(), *byte_size); - return true; - } else { - Process *process = nullptr; - if (exe_ctx) - process = exe_ctx->GetProcessPtr(); - if (process) { - Status error; - return process->WriteMemory(addr, new_value.GetData(), *byte_size, - error) == *byte_size; - } - } - } - return false; -} - bool lldb_private::operator==(const lldb_private::CompilerType &lhs, const lldb_private::CompilerType &rhs) { return lhs.GetTypeSystem() == rhs.GetTypeSystem() &&