[Lldb-commits] [lldb] r188698 - Fixed DataExtractor to correctly display Intel extended doubles.
Richard Mitton
richard at codersnotes.com
Mon Aug 19 12:39:03 PDT 2013
Author: rmitton
Date: Mon Aug 19 14:39:03 2013
New Revision: 188698
URL: http://llvm.org/viewvc/llvm-project?rev=188698&view=rev
Log:
Fixed DataExtractor to correctly display Intel extended doubles.
This means that "register read stmm0 --format f" actually works now.
This is a little messy but LLDB assumes 'long double' is portable, when it is not.
Modified:
lldb/trunk/source/Core/DataExtractor.cpp
lldb/trunk/test/functionalities/register/TestRegisters.py
Modified: lldb/trunk/source/Core/DataExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=188698&r1=188697&r2=188698&view=diff
==============================================================================
--- lldb/trunk/source/Core/DataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DataExtractor.cpp Mon Aug 19 14:39:03 2013
@@ -777,24 +777,12 @@ DataExtractor::GetDouble (offset_t *offs
long double
DataExtractor::GetLongDouble (offset_t *offset_ptr) const
{
- typedef long double float_type;
- float_type val = 0.0;
- const size_t src_size = sizeof(float_type);
- const float_type *src = (const float_type *)GetData (offset_ptr, src_size);
- if (src)
- {
- if (m_byte_order != lldb::endian::InlHostByteOrder())
- {
- const uint8_t *src_data = (const uint8_t *)src;
- uint8_t *dst_data = (uint8_t *)&val;
- for (size_t i=0; i<sizeof(float_type); ++i)
- dst_data[sizeof(float_type) - 1 - i] = src_data[i];
- }
- else
- {
- val = *src;
- }
- }
+ long double val = 0.0;
+#if defined (__i386__) || defined (__amd64__) || defined (__x86_64__) || defined(_M_IX86) || defined(_M_IA64) || defined(_M_X64)
+ *offset_ptr += CopyByteOrderedData (*offset_ptr, 10, &val, sizeof(val), lldb::endian::InlHostByteOrder());
+#else
+ *offset_ptr += CopyByteOrderedData (*offset_ptr, sizeof(val), &val, sizeof(val), lldb::endian::InlHostByteOrder());
+#endif
return val;
}
@@ -1842,7 +1830,7 @@ DataExtractor::Dump (Stream *s,
ss.precision(std::numeric_limits<double>::digits10);
ss << GetDouble(&offset);
}
- else if (item_byte_size == sizeof(long double))
+ else if (item_byte_size == sizeof(long double) || item_byte_size == 10)
{
ss.precision(std::numeric_limits<long double>::digits10);
ss << GetLongDouble(&offset);
Modified: lldb/trunk/test/functionalities/register/TestRegisters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/register/TestRegisters.py?rev=188698&r1=188697&r2=188698&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/register/TestRegisters.py (original)
+++ lldb/trunk/test/functionalities/register/TestRegisters.py Mon Aug 19 14:39:03 2013
@@ -180,6 +180,10 @@ class RegisterCommandsTestCase(TestBase)
new_value = "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x0e 0x0f}"
self.vector_write_and_read(currentFrame, "xmm15", new_value, False)
+ self.runCmd("register write stmm0 \"{0x00 0x00 0x00 0x00 0x00 0x00 0x40 0x9a 0x09 0x40}\"")
+ self.expect("register read stmm0 --format f",
+ substrs = ['stmm0 = 1234'])
+
has_avx = False
registerSets = currentFrame.GetRegisters() # Returns an SBValueList.
for registerSet in registerSets:
More information about the lldb-commits
mailing list