[Lldb-commits] [lldb] r322666 - [lldb][PPC64] Fixed long double variables dump

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 17 07:11:20 PST 2018


Author: labath
Date: Wed Jan 17 07:11:20 2018
New Revision: 322666

URL: http://llvm.org/viewvc/llvm-project?rev=322666&view=rev
Log:
[lldb][PPC64] Fixed long double variables dump

Summary:
LLDB's DumpDataExtractor was not prepared to handle PowerPC's long double type: PPCDoubleDouble.

As it is somewhat special, treating it as other regular float types resulted in getting wrong information about it.
In this particular case, llvm::APFloat::getSizeInBits(PPCDoubleDouble) was returning 0.

This caused the TestSetValues.py test to fail, because lldb would abort on an assertion failure on APInt(), because of the invalid size.

Since in the PPC case the value of item_byte_size was correct and the
getSizeInBits call was only added to support x87DoubleExtended
semantics, this restricts the usage of getSizeInBits to the x87
semantics.

Reviewers: labath, clayborg

Reviewed By: labath

Subscribers: llvm-commits, anajuliapc, alexandreyy, lbianc, lldb-commits

Differential Revision: https://reviews.llvm.org/D42083
Author: Leandro Lupori <leandro.lupori at gmail.com>

Modified:
    lldb/trunk/source/Core/DumpDataExtractor.cpp

Modified: lldb/trunk/source/Core/DumpDataExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DumpDataExtractor.cpp?rev=322666&r1=322665&r2=322666&view=diff
==============================================================================
--- lldb/trunk/source/Core/DumpDataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DumpDataExtractor.cpp Wed Jan 17 07:11:20 2018
@@ -583,8 +583,10 @@ lldb::offset_t lldb_private::DumpDataExt
             } else if (item_bit_size == ast->getTypeSize(ast->LongDoubleTy)) {
               const auto &semantics =
                   ast->getFloatTypeSemantics(ast->LongDoubleTy);
-              const auto byte_size =
-                  (llvm::APFloat::getSizeInBits(semantics) + 7) / 8;
+
+              offset_t byte_size = item_byte_size;
+              if (&semantics == &llvm::APFloatBase::x87DoubleExtended())
+                byte_size = (llvm::APFloat::getSizeInBits(semantics) + 7) / 8;
 
               llvm::APInt apint;
               if (GetAPInt(DE, &offset, byte_size, apint)) {




More information about the lldb-commits mailing list