[Lldb-commits] [PATCH] D14633: [LLDB][MIPS] Clear bug 25194 - LLDB-Server Assertion raised when single stepping on MIPS

Sagar Thakur via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 17 02:09:29 PST 2015


sagar added a comment.

Hi @tberghammer,

I tried using RegisterValue::SetUInt() instead of RegisterValue::SetBytes(). When using RegisterValue::SetUInt() all register values we get are zero in case of mips32 big endian machine. The GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread() and GDBRemoteCommunicationServerLLGS::Handle_p() function implementations retrieve a pointer to register value by calling RegisterValue::GetBytes() which in turn retrieves a pointer to value from Scalar::GetBytes() in cases if type of RegisterValue is eTypeUInt*. But Scalar::GetBytes() does not seem to handle endianness correctly. As a workaround I made RegisterValue::GetBytes() retrieve the pointer to register value from its bytes buffer for all cases and also called SetBytes from RegisterValue::SetUInt() like this :

> diff --git a/source/Core/RegisterValue.cpp b/source/Core/RegisterValue.cpp

> index d4ba998..ec8bfb8 100644

> --- a/source/Core/RegisterValue.cpp

> +++ b/source/Core/RegisterValue.cpp

> @@ -822,7 +822,7 @@ RegisterValue::GetBytes () const

>          case eTypeUInt128:

>          case eTypeFloat:

>          case eTypeDouble:

> -        case eTypeLongDouble:   return m_scalar.GetBytes();

> +        case eTypeLongDouble:

>          case eTypeBytes:        return buffer.bytes;

>      }

>      return NULL;

> @@ -841,7 +841,7 @@ RegisterValue::GetBytes ()

>          case eTypeUInt128:

>          case eTypeFloat:

>          case eTypeDouble:

> -        case eTypeLongDouble:   return m_scalar.GetBytes();

> +        case eTypeLongDouble:

>          case eTypeBytes:        return buffer.bytes;

>      }

>      return NULL;

> @@ -896,6 +896,7 @@ RegisterValue::SetUInt (uint64_t uint, uint32_t byte_size)

>      }

>      else

>          return false;

> +    SetBytes (&uint, byte_size, GetByteOrder());

>      return true;

>  }


If this looks good I will submit a separate patch for the same.
Should we use the above mentioned workaround or use RegisterValue::SetBytes as before? Kindly let me know if you have any other suggestions.

Regards,
Sagar


Repository:
  rL LLVM

http://reviews.llvm.org/D14633





More information about the lldb-commits mailing list