mamai created this revision. mamai added a reviewer: spyffe. mamai added subscribers: phlav, lldb-commits. mamai set the repository for this revision to rL LLVM.
The evaluation of expressions containing register values was broken for targets for which endianness differs from host. This patch fixes issues like: (lldb) reg read pc pc = 0x00400020 arithmetic.elf`main + 32 at main.c:12 (lldb) expr -f hex -- $pc (unsigned int) $2 = 0x20004000 Where the second command will now give the right value (0x00400020). 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 @@ -1275,9 +1275,12 @@ 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); + + 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());
Index: source/Expression/Materializer.cpp =================================================================== --- source/Expression/Materializer.cpp +++ source/Expression/Materializer.cpp @@ -1275,9 +1275,12 @@ 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); + + 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());
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits