diff options
author | Sean Callanan <scallanan@apple.com> | 2013-09-17 18:26:42 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2013-09-17 18:26:42 +0000 |
commit | 46fc00661914fb7cab5fec1200f1e01f48ef2d3c (patch) | |
tree | 8ffaaf8db4524acd831409c2b690cf6156f2c5d8 /lldb/source/Expression/IRInterpreter.cpp | |
parent | cae8735a546598d47212c54a4246cfeb489344f6 (diff) | |
download | bcm5719-llvm-46fc00661914fb7cab5fec1200f1e01f48ef2d3c.tar.gz bcm5719-llvm-46fc00661914fb7cab5fec1200f1e01f48ef2d3c.zip |
Use a StreamString to fix the endianness in
constants before using them in the IR interpreter.
Patch by Félix Cloutier.
llvm-svn: 190877
Diffstat (limited to 'lldb/source/Expression/IRInterpreter.cpp')
-rw-r--r-- | lldb/source/Expression/IRInterpreter.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp index dcbf584cfb6..c8da6a68c6a 100644 --- a/lldb/source/Expression/IRInterpreter.cpp +++ b/lldb/source/Expression/IRInterpreter.cpp @@ -14,6 +14,7 @@ #include "lldb/Core/StreamString.h" #include "lldb/Expression/IRMemoryMap.h" #include "lldb/Expression/IRInterpreter.h" +#include "lldb/Host/Endian.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DataLayout.h" @@ -321,13 +322,19 @@ public: if (!ResolveConstantValue(resolved_value, constant)) return false; - const uint64_t *raw_data = resolved_value.getRawData(); - + lldb_private::StreamString buffer (lldb_private::Stream::eBinary, + m_memory_map.GetAddressByteSize(), + m_memory_map.GetByteOrder()); + size_t constant_size = m_target_data.getTypeStoreSize(constant->getType()); + const uint64_t *raw_data = resolved_value.getRawData(); + + buffer.PutRawBytes(raw_data, constant_size, lldb::endian::InlHostByteOrder()); + lldb_private::Error write_error; - m_memory_map.WriteMemory(process_address, (uint8_t*)raw_data, constant_size, write_error); + m_memory_map.WriteMemory(process_address, (const uint8_t*)buffer.GetData(), constant_size, write_error); return write_error.Success(); } |