[Lldb-commits] [PATCH] D17167: Fix bug with register values byte order in expression evaluation

Marianne Mailhot-Sarrasin via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 19 06:53:49 PST 2016


mamai updated this revision to Diff 48486.
mamai added a comment.

I have updated the patch to add the assertion.


Repository:
  rL LLVM

http://reviews.llvm.org/D17167

Files:
  source/Expression/Materializer.cpp

Index: source/Expression/Materializer.cpp
===================================================================
--- source/Expression/Materializer.cpp
+++ source/Expression/Materializer.cpp
@@ -26,6 +26,7 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBAssert.h"
 
 using namespace lldb_private;
 
@@ -1275,9 +1276,14 @@
         m_register_contents.reset(new DataBufferHeap(register_data.GetDataStart(), register_data.GetByteSize()));
         
         Error write_error;
-        
-        map.WriteMemory(load_addr, register_data.GetDataStart(), register_data.GetByteSize(), write_error);
-        
+
+        Scalar scalar;
+        reg_value.GetScalarValue(scalar);
+
+        lldbassert(scalar.GetByteSize() == register_data.GetByteSize());
+
+        map.WriteScalarToMemory(load_addr, scalar, scalar.GetByteSize(), write_error);
+
         if (!write_error.Success())
         {
             err.SetErrorStringWithFormat("couldn't write the contents of register %s: %s", m_register_info.name, write_error.AsCString());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17167.48486.patch
Type: text/x-patch
Size: 1112 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160219/e7943d32/attachment.bin>


More information about the lldb-commits mailing list