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

Enrico Granata egranata at apple.com
Mon Apr 23 18:23:24 PDT 2012


Author: enrico
Date: Mon Apr 23 20:23:23 2012
New Revision: 155418

URL: http://llvm.org/viewvc/llvm-project?rev=155418&view=rev
Log:
This patch fixes a bug where LLDB was incorrectly setting the address-size on a DataExtractor to be sizeof(void*) when the ValueObject came out of the expression parser
This worked correctly for 64-bit targets, but broke down data formatters in i386 mode. The formatters would try to read pointers out of the frozen-dried objects,
but were unable to do so because they would try fetching 8 bytes from a DataExtractor with only 4 bytes in it. This patch fixes the issue by always making the pointer-size
for a DataExtractor match the target setting.

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=155418&r1=155417&r2=155418&view=diff
==============================================================================
--- lldb/trunk/source/Core/Value.cpp (original)
+++ lldb/trunk/source/Core/Value.cpp Mon Apr 23 20:23:23 2012
@@ -492,9 +492,20 @@
 
     case eValueTypeHostAddress:
         address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
+        address_type = eAddressTypeHost;
+        if (exe_ctx)
+        {
+            Target *target = exe_ctx->GetTargetPtr();
+            if (target)
+            {
+                data.SetByteOrder(target->GetArchitecture().GetByteOrder());
+                data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
+                break;
+            }
+        }
+        // fallback to host settings
         data.SetByteOrder(lldb::endian::InlHostByteOrder());
         data.SetAddressByteSize(sizeof(void *));
-        address_type = eAddressTypeHost;
         break;
     }
 





More information about the lldb-commits mailing list