[Lldb-commits] [lldb] r126433 - /lldb/trunk/source/Core/Value.cpp

Jim Ingham jingham at apple.com
Thu Feb 24 13:23:14 PST 2011


Author: jingham
Date: Thu Feb 24 15:23:14 2011
New Revision: 126433

URL: http://llvm.org/viewvc/llvm-project?rev=126433&view=rev
Log:
When making a DataExtractor from a Value that's got a ClangType, set the AddressByteSize from the AST Context.

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

Modified: lldb/trunk/source/Core/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=126433&r1=126432&r2=126433&view=diff
==============================================================================
--- lldb/trunk/source/Core/Value.cpp (original)
+++ lldb/trunk/source/Core/Value.cpp Thu Feb 24 15:23:14 2011
@@ -524,7 +524,15 @@
 
     case eValueTypeScalar:
         data.SetByteOrder (lldb::endian::InlHostByteOrder());
-        data.SetAddressByteSize(sizeof(void *));
+        if (m_context_type == eContextTypeClangType && ast_context)
+        {
+            uint32_t ptr_bit_width = ClangASTType::GetClangTypeBitWidth (ast_context, 
+                                                                     ClangASTContext::GetVoidPtrType(ast_context, false));
+            uint32_t ptr_byte_size = (ptr_bit_width + 7) / 8;
+            data.SetAddressByteSize (ptr_byte_size);
+        }
+        else
+            data.SetAddressByteSize(sizeof(void *));
         if (m_value.GetData (data))
             return error;   // Success;
         error.SetErrorStringWithFormat("extracting data from value failed");





More information about the lldb-commits mailing list