forked from OSchip/llvm-project
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. llvm-svn: 188698
This commit is contained in:
parent
5f3a9989a6
commit
f2bef0b15d
|
@ -777,24 +777,12 @@ DataExtractor::GetDouble (offset_t *offset_ptr) const
|
|||
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);
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue