[Lldb-commits] [lldb] r183755 - Remove eFormatHalfFloat as it isn't needed. eFormatFloat should be used and the byte size will tell us how to display it.

Greg Clayton gclayton at apple.com
Tue Jun 11 10:32:06 PDT 2013


Author: gclayton
Date: Tue Jun 11 12:32:06 2013
New Revision: 183755

URL: http://llvm.org/viewvc/llvm-project?rev=183755&view=rev
Log:
Remove eFormatHalfFloat as it isn't needed. eFormatFloat should be used and the byte size will tell us how to display it.


Modified:
    lldb/trunk/include/lldb/lldb-enumerations.h
    lldb/trunk/source/Commands/CommandObjectMemory.cpp
    lldb/trunk/source/Core/DataExtractor.cpp
    lldb/trunk/source/DataFormatters/FormatManager.cpp

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=183755&r1=183754&r2=183755&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Tue Jun 11 12:32:06 2013
@@ -125,7 +125,6 @@ namespace lldb {
         eFormatAddressInfo,         // Describe what an address points to (func + offset with file/line, symbol + offset, data, etc)
         eFormatHexFloat,            // ISO C99 hex float string
         eFormatInstruction,         // Disassemble an opcode
-        eFormatHalfFloat,           // Half-floats (IEEE-754-2008 binary16 interchange format)
         eFormatVoid,                // Do not print this
         kNumFormats
     } Format;

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=183755&r1=183754&r2=183755&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Tue Jun 11 12:32:06 2013
@@ -180,15 +180,12 @@ public:
             case eFormatUnicode32:
             case eFormatUnsigned:
             case eFormatHexFloat:
-            case eFormatHalfFloat:
                 if (!byte_size_option_set)
                     byte_size_value = 4;
                 if (!num_per_line_option_set)
                     m_num_per_line = 1;
                 if (!count_option_set)
                     format_options.GetCountValue() = 8;
-                if (format_options.GetFormat() == eFormatFloat && byte_size_option_set && byte_size_value == 2)
-                    format_options.GetFormatValue().SetCurrentValue(eFormatHalfFloat);
                 break;
             
             case eFormatBytes:
@@ -1173,7 +1170,6 @@ protected:
             case eFormatComplexInteger:
             case eFormatAddressInfo:
             case eFormatHexFloat:
-            case eFormatHalfFloat:
             case eFormatInstruction:
             case eFormatVoid:
                 result.AppendError("unsupported format for writing memory");

Modified: lldb/trunk/source/Core/DataExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=183755&r1=183754&r2=183755&view=diff
==============================================================================
--- lldb/trunk/source/Core/DataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DataExtractor.cpp Tue Jun 11 12:32:06 2013
@@ -1703,10 +1703,20 @@ DataExtractor::Dump (Stream *s,
         case eFormatFloat:
             {
                 std::ostringstream ss;
-                if (item_byte_size == sizeof(float))
+                if (item_byte_size == sizeof(float) || item_byte_size == 2)
                 {
+                    float f;
+                    if (item_byte_size == 2)
+                    {
+                        uint16_t half = this->GetU16(&offset);
+                        f = half2float(half);
+                    }
+                    else
+                    {
+                        f = GetFloat (&offset);
+                    }
                     ss.precision(std::numeric_limits<float>::digits10);
-                    ss << GetFloat(&offset);
+                    ss << f;
                 } 
                 else if (item_byte_size == sizeof(double))
                 {
@@ -1728,24 +1738,6 @@ DataExtractor::Dump (Stream *s,
             }
             break;
 
-        case eFormatHalfFloat:
-            {
-                std::ostringstream ss;
-                if (item_byte_size == 2)
-                {
-                    uint16_t half = this->GetU16(&offset);
-                    float half_converted = half2float(half);
-                    ss << half_converted;
-                }
-                else
-                {
-                    s->Printf("error: unsupported byte size (%zu) for half-float format", item_byte_size);
-                    return offset;
-                }
-                ss.flush();
-                s->Printf("%s", ss.str().c_str());
-            }
-            break;
         case eFormatUnicode16:
             s->Printf("U+%4.4x", GetU16 (&offset));
             break;

Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=183755&r1=183754&r2=183755&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Tue Jun 11 12:32:06 2013
@@ -72,7 +72,6 @@ g_format_infos[] =
     { eFormatCharArray      , 'a'   , "character array"     },
     { eFormatAddressInfo    , 'A'   , "address"             },
     { eFormatHexFloat       , '\0'  , "hex float"           },
-    { eFormatHalfFloat      , '\0'  , "half float"          },
     { eFormatInstruction    , 'i'   , "instruction"         },
     { eFormatVoid           , 'v'   , "void"                }
 };





More information about the lldb-commits mailing list