[Lldb-commits] [lldb] r192267 - Fixed a bug where variables' byte sizes would not

Sean Callanan scallanan at apple.com
Tue Oct 8 19:32:37 PDT 2013


Author: spyffe
Date: Tue Oct  8 21:32:37 2013
New Revision: 192267

URL: http://llvm.org/viewvc/llvm-project?rev=192267&view=rev
Log:
Fixed a bug where variables' byte sizes would not
respect their Clang types if the variables' values
were represented by DWARF constu values.

<rdar://problem/14636499>

Modified:
    lldb/trunk/source/Core/Value.cpp
    lldb/trunk/source/Core/ValueObjectVariable.cpp

Modified: lldb/trunk/source/Core/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=192267&r1=192266&r2=192267&view=diff
==============================================================================
--- lldb/trunk/source/Core/Value.cpp (original)
+++ lldb/trunk/source/Core/Value.cpp Tue Oct  8 21:32:37 2013
@@ -339,16 +339,30 @@ Value::GetValueAsData (ExecutionContext
         break;
 
     case eValueTypeScalar:
-        data.SetByteOrder (lldb::endian::InlHostByteOrder());
-        if (ast_type.IsValid())
-            data.SetAddressByteSize (ast_type.GetPointerByteSize());
-        else
-            data.SetAddressByteSize(sizeof(void *));
-        if (m_value.GetData (data))
-            return error;   // Success;
-        error.SetErrorStringWithFormat("extracting data from value failed");
-        break;
+        {
+            data.SetByteOrder (lldb::endian::InlHostByteOrder());
+            if (ast_type.IsValid())
+                data.SetAddressByteSize (ast_type.GetPointerByteSize());
+            else
+                data.SetAddressByteSize(sizeof(void *));
 
+            uint32_t limit_byte_size = UINT32_MAX;
+            
+            if (ast_type.IsValid() && ast_type.IsScalarType())
+            {
+                uint64_t type_encoding_count = 0;
+                lldb::Encoding type_encoding = ast_type.GetEncoding(type_encoding_count);
+                
+                if (type_encoding == eEncodingUint || type_encoding == eEncodingSint)
+                    limit_byte_size = ast_type.GetByteSize();
+            }
+            
+            if (m_value.GetData (data, limit_byte_size))
+                return error;   // Success;
+            
+            error.SetErrorStringWithFormat("extracting data from value failed");
+            break;
+        }
     case eValueTypeLoadAddress:
         if (exe_ctx == NULL)
         {

Modified: lldb/trunk/source/Core/ValueObjectVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectVariable.cpp?rev=192267&r1=192266&r2=192267&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectVariable.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectVariable.cpp Tue Oct  8 21:32:37 2013
@@ -156,6 +156,10 @@ ValueObjectVariable::UpdateValue ()
         {
             m_resolved_value = m_value;
             m_value.SetContext(Value::eContextTypeVariable, variable);
+            
+            ClangASTType clang_type = GetClangType();
+            if (clang_type.IsValid())
+                m_value.SetClangType(clang_type);
 
             Value::ValueType value_type = m_value.GetValueType();
             





More information about the lldb-commits mailing list