[Lldb-commits] [lldb] r262041 - Fix bug with register values byte order in expression evaluation.
Aidan Dodds via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 26 09:40:50 PST 2016
Author: aidandodds
Date: Fri Feb 26 11:40:50 2016
New Revision: 262041
URL: http://llvm.org/viewvc/llvm-project?rev=262041&view=rev
Log:
Fix bug with register values byte order in expression evaluation.
The evaluation of expressions containing register values was broken for targets for which endianness differs from host.
Committed on behalf of: mamai <marianne.mailhot.sarrasin at gmail.com>
Differential revision: http://reviews.llvm.org/D17167
Modified:
lldb/trunk/source/Expression/Materializer.cpp
Modified: lldb/trunk/source/Expression/Materializer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/Materializer.cpp?rev=262041&r1=262040&r2=262041&view=diff
==============================================================================
--- lldb/trunk/source/Expression/Materializer.cpp (original)
+++ lldb/trunk/source/Expression/Materializer.cpp Fri Feb 26 11:40:50 2016
@@ -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 @@ public:
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());
More information about the lldb-commits
mailing list