[Lldb-commits] [lldb] r270214 - Revert rL270207: "[LLDB][MIPS] Fix floating point handling in case of thread step-out"
Tamas Berghammer via lldb-commits
lldb-commits at lists.llvm.org
Fri May 20 06:07:19 PDT 2016
Author: tberghammer
Date: Fri May 20 08:07:16 2016
New Revision: 270214
URL: http://llvm.org/viewvc/llvm-project?rev=270214&view=rev
Log:
Revert rL270207: "[LLDB][MIPS] Fix floating point handling in case of thread step-out"
The CL causes a build breakage on platforms where sizeof(double) == sizeof(long double)
and it incorrectly assumes that sizeof(double) and sizeof(long double) is the same
on the host and the target.
Modified:
lldb/trunk/include/lldb/Core/ArchSpec.h
lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Modified: lldb/trunk/include/lldb/Core/ArchSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ArchSpec.h?rev=270214&r1=270213&r2=270214&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ArchSpec.h (original)
+++ lldb/trunk/include/lldb/Core/ArchSpec.h Fri May 20 08:07:16 2016
@@ -75,20 +75,6 @@ public:
eMIPSABI_mask = 0x000ff000
};
- // MIPS Floating point ABI Values
- enum MIPS_ABI_FP
- {
- eMIPS_ABI_FP_ANY = 0x00000000,
- eMIPS_ABI_FP_DOUBLE = 0x00100000, // hard float / -mdouble-float
- eMIPS_ABI_FP_SINGLE = 0x00200000, // hard float / -msingle-float
- eMIPS_ABI_FP_SOFT = 0x00300000, // soft float
- eMIPS_ABI_FP_OLD_64 = 0x00400000, // -mips32r2 -mfp64
- eMIPS_ABI_FP_XX = 0x00500000, // -mfpxx
- eMIPS_ABI_FP_64 = 0x00600000, // -mips32r2 -mfp64
- eMIPS_ABI_FP_64A = 0x00700000, // -mips32r2 -mfp64 -mno-odd-spreg
- eMIPS_ABI_FP_mask = 0x00700000
- };
-
// ARM specific e_flags
enum ARMeflags
{
Modified: lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp?rev=270214&r1=270213&r2=270214&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp Fri May 20 08:07:16 2016
@@ -397,11 +397,7 @@ ABISysV_mips::GetReturnValueObjectImpl (
if (exe_ctx.GetTargetPtr() == nullptr || exe_ctx.GetProcessPtr() == nullptr)
return return_valobj_sp;
- Target *target = exe_ctx.GetTargetPtr();
- const ArchSpec target_arch = target->GetArchitecture();
- ByteOrder target_byte_order = target_arch.GetByteOrder();
value.SetCompilerType(return_compiler_type);
- uint32_t fp_flag = target_arch.GetFlags() & lldb_private::ArchSpec::eMIPS_ABI_FP_mask;
RegisterContext *reg_ctx = thread.GetRegisterContext().get();
if (!reg_ctx)
@@ -413,7 +409,8 @@ ABISysV_mips::GetReturnValueObjectImpl (
// In MIPS register "r2" (v0) holds the integer function return values
const RegisterInfo *r2_reg_info = reg_ctx->GetRegisterInfoByName("r2", 0);
- size_t bit_width = return_compiler_type.GetBitSize(&thread);
+ size_t bit_width = return_compiler_type.GetBitSize(&thread);
+
if (return_compiler_type.IsIntegerType (is_signed))
{
switch (bit_width)
@@ -470,107 +467,37 @@ ABISysV_mips::GetReturnValueObjectImpl (
}
else if (return_compiler_type.IsFloatingPointType (count, is_complex))
{
- if (IsSoftFloat (fp_flag))
+ const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0);
+ const RegisterInfo *f1_info = reg_ctx->GetRegisterInfoByName("f1", 0);
+
+ if (count == 1 && !is_complex)
{
- uint64_t raw_value = reg_ctx->ReadRegisterAsUnsigned(r2_reg_info, 0);
- if (count != 1 && is_complex)
- return return_valobj_sp;
switch (bit_width)
{
default:
return return_valobj_sp;
- case 32:
- static_assert(sizeof(float) == sizeof(uint32_t), "");
- value.GetScalar() = *((float *)(&raw_value));
- break;
case 64:
+ {
static_assert(sizeof(double) == sizeof(uint64_t), "");
- const RegisterInfo *r3_reg_info = reg_ctx->GetRegisterInfoByName("r3", 0);
- if (target_byte_order == eByteOrderLittle)
- raw_value = ((reg_ctx->ReadRegisterAsUnsigned(r3_reg_info, 0)) << 32) | raw_value;
- else
- raw_value = (raw_value << 32) | reg_ctx->ReadRegisterAsUnsigned(r3_reg_info, 0);
- value.GetScalar() = *((double *)(&raw_value));
+ uint64_t raw_value;
+ raw_value = reg_ctx->ReadRegisterAsUnsigned(f0_info, 0) & UINT32_MAX;
+ raw_value |= ((uint64_t)(reg_ctx->ReadRegisterAsUnsigned(f1_info, 0) & UINT32_MAX)) << 32;
+ value.GetScalar() = *reinterpret_cast<double*>(&raw_value);
break;
+ }
+ case 32:
+ {
+ static_assert(sizeof(float) == sizeof(uint32_t), "");
+ uint32_t raw_value = reg_ctx->ReadRegisterAsUnsigned(f0_info, 0) & UINT32_MAX;
+ value.GetScalar() = *reinterpret_cast<float*>(&raw_value);
+ break;
+ }
}
}
-
else
{
- const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0);
- RegisterValue f0_value;
- DataExtractor f0_data;
- reg_ctx->ReadRegister (f0_info, f0_value);
- f0_value.GetData(f0_data);
- lldb::offset_t offset = 0;
-
- if (count == 1 && !is_complex)
- {
- switch (bit_width)
- {
- default:
- return return_valobj_sp;
- case 64:
- {
- static_assert(sizeof(double) == sizeof(uint64_t), "");
- const RegisterInfo *f1_info = reg_ctx->GetRegisterInfoByName("f1", 0);
- RegisterValue f1_value;
- DataExtractor f1_data;
- reg_ctx->ReadRegister (f1_info, f1_value);
- DataExtractor *copy_from_extractor = nullptr;
- DataBufferSP data_sp (new DataBufferHeap(8, 0));
- DataExtractor return_ext (data_sp,
- target_byte_order,
- target->GetArchitecture().GetAddressByteSize());
-
- if (target_byte_order == eByteOrderLittle)
- {
- copy_from_extractor = &f0_data;
- copy_from_extractor->CopyByteOrderedData (offset,
- 4,
- data_sp->GetBytes(),
- 4,
- target_byte_order);
- f1_value.GetData(f1_data);
- copy_from_extractor = &f1_data;
- copy_from_extractor->CopyByteOrderedData (offset,
- 4,
- data_sp->GetBytes() + 4,
- 4,
- target_byte_order);
- }
- else
- {
- copy_from_extractor = &f0_data;
- copy_from_extractor->CopyByteOrderedData (offset,
- 4,
- data_sp->GetBytes() + 4,
- 4,
- target_byte_order);
- f1_value.GetData(f1_data);
- copy_from_extractor = &f1_data;
- copy_from_extractor->CopyByteOrderedData (offset,
- 4,
- data_sp->GetBytes(),
- 4,
- target_byte_order);
- }
- value.GetScalar() = (double) return_ext.GetDouble(&offset);
- break;
- }
- case 32:
- {
- static_assert(sizeof(float) == sizeof(uint32_t), "");
- value.GetScalar() = (float) f0_data.GetFloat(&offset);
- break;
- }
- }
- }
- else
- {
- // not handled yet
- return return_valobj_sp;
- }
+ // not handled yet
+ return return_valobj_sp;
}
}
else
@@ -636,12 +563,6 @@ ABISysV_mips::RegisterIsVolatile (const
}
bool
-ABISysV_mips::IsSoftFloat(uint32_t fp_flags) const
-{
- return (fp_flags == lldb_private::ArchSpec::eMIPS_ABI_FP_SOFT);
-}
-
-bool
ABISysV_mips::RegisterIsCalleeSaved (const RegisterInfo *reg_info)
{
if (reg_info)
Modified: lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h?rev=270214&r1=270213&r2=270214&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h Fri May 20 08:07:16 2016
@@ -54,9 +54,6 @@ public:
RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
bool
- IsSoftFloat(uint32_t fp_flag) const;
-
- bool
CallFrameAddressIsValid(lldb::addr_t cfa) override
{
// Make sure the stack call frame addresses are 8 byte aligned
Modified: lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp?rev=270214&r1=270213&r2=270214&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp Fri May 20 08:07:16 2016
@@ -372,11 +372,9 @@ ABISysV_mips64::GetReturnValueObjectImpl
return return_valobj_sp;
Target *target = exe_ctx.GetTargetPtr();
- const ArchSpec target_arch = target->GetArchitecture();
- ByteOrder target_byte_order = target_arch.GetByteOrder();
+ ByteOrder target_byte_order = target->GetArchitecture().GetByteOrder();
const size_t byte_size = return_compiler_type.GetByteSize(nullptr);
const uint32_t type_flags = return_compiler_type.GetTypeInfo(nullptr);
- uint32_t fp_flag = target_arch.GetFlags () & lldb_private::ArchSpec::eMIPS_ABI_FP_mask;
const RegisterInfo *r2_info = reg_ctx->GetRegisterInfoByName("r2", 0);
const RegisterInfo *r3_info = reg_ctx->GetRegisterInfoByName("r3", 0);
@@ -440,52 +438,20 @@ ABISysV_mips64::GetReturnValueObjectImpl
{
// Don't handle complex yet.
}
- else if (IsSoftFloat(fp_flag))
- {
- uint64_t raw_value = reg_ctx->ReadRegisterAsUnsigned(r2_info, 0);
- switch (byte_size)
- {
- case sizeof(float):
- value.GetScalar() = *((float *)(&raw_value));
- success = true;
- break;
- case sizeof(double):
- value.GetScalar() = *((double *)(&raw_value));
- success = true;
- break;
- case sizeof(long double):
- uint64_t result[2];
- if (target_byte_order == eByteOrderLittle)
- {
- result[0] = raw_value;
- result[1] = reg_ctx->ReadRegisterAsUnsigned(r3_info, 0);
- value.GetScalar() = *((long double *)(result));
- }
- else
- {
- result[0] = reg_ctx->ReadRegisterAsUnsigned(r3_info, 0);
- result[1] = raw_value;
- value.GetScalar() = *((long double *)(result));
- }
- success = true;
- break;
- }
-
- }
else
{
if (byte_size <= sizeof(long double))
{
const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0);
-
- RegisterValue f0_value;
- DataExtractor f0_data;
+ const RegisterInfo *f2_info = reg_ctx->GetRegisterInfoByName("f2", 0);
+ RegisterValue f0_value, f2_value;
+ DataExtractor f0_data, f2_data;
reg_ctx->ReadRegister (f0_info, f0_value);
-
+ reg_ctx->ReadRegister (f2_info, f2_value);
f0_value.GetData(f0_data);
-
+ f2_value.GetData(f2_data);
lldb::offset_t offset = 0;
if (byte_size == sizeof(float))
@@ -500,10 +466,6 @@ ABISysV_mips64::GetReturnValueObjectImpl
}
else if (byte_size == sizeof(long double))
{
- const RegisterInfo *f2_info = reg_ctx->GetRegisterInfoByName("f2", 0);
- RegisterValue f2_value;
- DataExtractor f2_data;
- reg_ctx->ReadRegister (f2_info, f2_value);
DataExtractor *copy_from_extractor = nullptr;
DataBufferSP data_sp (new DataBufferHeap(16, 0));
DataExtractor return_ext (data_sp,
@@ -512,37 +474,21 @@ ABISysV_mips64::GetReturnValueObjectImpl
if (target_byte_order == eByteOrderLittle)
{
+ f0_data.Append(f2_data);
copy_from_extractor = &f0_data;
- copy_from_extractor->CopyByteOrderedData (0,
- 8,
- data_sp->GetBytes(),
- byte_size - 8,
- target_byte_order);
- f2_value.GetData(f2_data);
- copy_from_extractor = &f2_data;
- copy_from_extractor->CopyByteOrderedData (0,
- 8,
- data_sp->GetBytes() + 8,
- byte_size - 8,
- target_byte_order);
}
else
{
- copy_from_extractor = &f0_data;
- copy_from_extractor->CopyByteOrderedData (0,
- 8,
- data_sp->GetBytes() + 8,
- byte_size - 8,
- target_byte_order);
- f2_value.GetData(f2_data);
- copy_from_extractor = &f2_data;
- copy_from_extractor->CopyByteOrderedData (0,
- 8,
- data_sp->GetBytes(),
- byte_size - 8,
- target_byte_order);
+ f2_data.Append(f0_data);
+ copy_from_extractor = &f2_data;
}
+ copy_from_extractor->CopyByteOrderedData (0,
+ byte_size,
+ data_sp->GetBytes(),
+ byte_size,
+ target_byte_order);
+
return_valobj_sp = ValueObjectConstResult::Create (&thread,
return_compiler_type,
ConstString(""),
@@ -834,12 +780,6 @@ ABISysV_mips64::RegisterIsVolatile (cons
}
bool
-ABISysV_mips64::IsSoftFloat (uint32_t fp_flag) const
-{
- return (fp_flag == lldb_private::ArchSpec::eMIPS_ABI_FP_SOFT);
-}
-
-bool
ABISysV_mips64::RegisterIsCalleeSaved (const RegisterInfo *reg_info)
{
if (reg_info)
Modified: lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h?rev=270214&r1=270213&r2=270214&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h Fri May 20 08:07:16 2016
@@ -53,9 +53,6 @@ public:
bool
RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
- bool
- IsSoftFloat(uint32_t fp_flag) const;
-
// The SysV mips ABI requires that stack frames be 16 byte aligned.
// When there is a trap handler on the stack, e.g. _sigtramp in userland
// code, we've seen that the stack pointer is often not aligned properly
Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=270214&r1=270213&r2=270214&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Fri May 20 08:07:16 2016
@@ -33,7 +33,6 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/ARMBuildAttributes.h"
#include "llvm/Support/MathExtras.h"
-#include "llvm/Support/MipsABIFlags.h"
#define CASE_AND_STREAM(s, def, width) \
case def: s->Printf("%-*s", width, #def); break;
@@ -1707,39 +1706,8 @@ ObjectFileELF::GetSectionHeaderInfo(Sect
if (section_size && (set_data (data, sheader.sh_offset, section_size) == section_size))
{
- // MIPS ASE Mask is at offset 12 in MIPS.abiflags section
- lldb::offset_t offset = 12; // MIPS ABI Flags Version: 0
- arch_flags |= data.GetU32 (&offset);
-
- // The floating point ABI is at offset 7
- offset = 7;
- switch (data.GetU8 (&offset))
- {
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_ANY :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_ANY;
- break;
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_DOUBLE :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_DOUBLE;
- break;
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_SINGLE :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_SINGLE;
- break;
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_SOFT :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_SOFT;
- break;
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_OLD_64 :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_OLD_64;
- break;
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_XX :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_XX;
- break;
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_64 :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_64;
- break;
- case llvm::Mips::Val_GNU_MIPS_ABI_FP_64A :
- arch_flags |= lldb_private::ArchSpec::eMIPS_ABI_FP_64A;
- break;
- }
+ lldb::offset_t ase_offset = 12; // MIPS ABI Flags Version: 0
+ arch_flags |= data.GetU32 (&ase_offset);
}
}
// Settings appropriate ArchSpec ABI Flags
More information about the lldb-commits
mailing list