diff options
Diffstat (limited to 'lldb/source/Commands/CommandObjectMemory.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectMemory.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index f2fa539..7140333 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -519,14 +519,14 @@ protected: --pointer_count; } - std::optional<uint64_t> size = compiler_type.GetByteSize(nullptr); - if (!size) { + auto size_or_err = compiler_type.GetByteSize(nullptr); + if (!size_or_err) { result.AppendErrorWithFormat( - "unable to get the byte size of the type '%s'\n", - view_as_type_cstr); + "unable to get the byte size of the type '%s'\n%s", + view_as_type_cstr, llvm::toString(size_or_err.takeError()).c_str()); return; } - m_format_options.GetByteSizeValue() = *size; + m_format_options.GetByteSizeValue() = *size_or_err; if (!m_format_options.GetCountValue().OptionWasSet()) m_format_options.GetCountValue() = 1; @@ -639,15 +639,16 @@ protected: if (!m_format_options.GetFormatValue().OptionWasSet()) m_format_options.GetFormatValue().SetCurrentValue(eFormatDefault); - std::optional<uint64_t> size = compiler_type.GetByteSize(nullptr); - if (!size) { - result.AppendError("can't get size of type"); + auto size_or_err = compiler_type.GetByteSize(nullptr); + if (!size_or_err) { + result.AppendError(llvm::toString(size_or_err.takeError())); return; } - bytes_read = *size * m_format_options.GetCountValue().GetCurrentValue(); + auto size = *size_or_err; + bytes_read = size * m_format_options.GetCountValue().GetCurrentValue(); if (argc > 0) - addr = addr + (*size * m_memory_options.m_offset.GetCurrentValue()); + addr = addr + (size * m_memory_options.m_offset.GetCurrentValue()); } else if (m_format_options.GetFormatValue().GetCurrentValue() != eFormatCString) { data_sp = std::make_shared<DataBufferHeap>(total_byte_size, '\0'); @@ -1034,8 +1035,8 @@ protected: frame, result_sp)) && result_sp) { uint64_t value = result_sp->GetValueAsUnsigned(0); - std::optional<uint64_t> size = - result_sp->GetCompilerType().GetByteSize(nullptr); + std::optional<uint64_t> size = llvm::expectedToOptional( + result_sp->GetCompilerType().GetByteSize(nullptr)); if (!size) return; switch (*size) { |