[Lldb-commits] [PATCH] D24124: [LLDB][MIPS] Fix register read/write for 32 bit big endian system
Nitesh Jain via lldb-commits
lldb-commits at lists.llvm.org
Thu Sep 15 02:14:26 PDT 2016
nitesh.jain added inline comments.
================
Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:1940
@@ +1939,3 @@
+ uint64_t dst_value;
+ RegisterValue reg_value;
+ lldb::ByteOrder byte_order = lldb::eByteOrderInvalid;
----------------
The GetAsUint64 work well on 32 bit little endian system since 32 bit data is copy at lower address in SetBytes which is valid for little endian but not on 32 bit big endian system. The Goal is to GetAsUint64 work for 32 bit big endian data type. We can do following change inorder to make it work for RegisterValue type eTypeBytes
uint64_t
RegisterValue::GetAsUInt64 (uint64_t fail_value, bool *success_ptr) const
{
if (success_ptr)
*success_ptr = true;
switch (m_type)
{
...
...
...
case eTypeBytes:
{
switch (buffer.length)
{
default: break;
case 1:
case 2:
case 4:
case 8: return *(const uint64_t *)buffer.bytes;
}
}
break;
}
if (success_ptr)
*success_ptr = false;
return fail_value;
}
We can modify the case for buffer.length = 4/2/1
switch (buffer.length) {
case 1: return *(const uint8_t *)buffer.bytes;
case 2: return *(const uint16_t *)buffer.bytes;
case 4: return *(const uint32_t *)buffer.bytes;
...
...
...
}
https://reviews.llvm.org/D24124
More information about the lldb-commits
mailing list