Hi emaste,
Ed Maste found some problems with the commit in D5988. Address most of these.
While here, also add floating point return handling. This doesn't handle
128-bit long double yet. Since I don't have any system that uses it, I don't
currently have plans to implement it.
http://reviews.llvm.org/D6049
Files:
lib/Makefile
source/Core/ArchSpec.cpp
source/Host/freebsd/Host.cpp
source/Plugins/ABI/CMakeLists.txt
source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
source/Target/Thread.cpp
source/lldb.cpp
Index: lib/Makefile
===================================================================
--- lib/Makefile
+++ lib/Makefile
@@ -34,6 +34,7 @@
lldbPluginABIMacOSX_arm.a \
lldbPluginABIMacOSX_arm64.a \
lldbPluginABIMacOSX_i386.a \
+ lldbPluginABISysV_ppc.a \
lldbPluginABISysV_ppc64.a \
lldbPluginABISysV_x86_64.a \
lldbPluginABISysV_hexagon.a \
Index: source/Core/ArchSpec.cpp
===================================================================
--- source/Core/ArchSpec.cpp
+++ source/Core/ArchSpec.cpp
@@ -19,7 +19,6 @@
#include "llvm/Support/ELF.h"
#include "llvm/Support/Host.h"
#include "lldb/Utility/SafeMachO.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/StringList.h"
#include "lldb/Host/Endian.h"
Index: source/Host/freebsd/Host.cpp
===================================================================
--- source/Host/freebsd/Host.cpp
+++ source/Host/freebsd/Host.cpp
@@ -301,6 +301,8 @@
DataBufferSP buf_sp;
std::unique_ptr<DataBufferHeap> buf_ap(new DataBufferHeap(1024, 0));
+ // TODO:FIXME: Need a way to get this dynamically, instead of a magic
+ // constant that only works on a single architecture.
ps_strings_addr = (void *)0xffffdff0;
pid.piod_op = PIOD_READ_D;
pid.piod_addr = &ps_strings;
Index: source/Plugins/ABI/CMakeLists.txt
===================================================================
--- source/Plugins/ABI/CMakeLists.txt
+++ source/Plugins/ABI/CMakeLists.txt
@@ -1,6 +1,6 @@
add_subdirectory(SysV-hexagon)
-add_subdirectory(SysV-ppc64)
add_subdirectory(SysV-ppc)
+add_subdirectory(SysV-ppc64)
add_subdirectory(SysV-x86_64)
add_subdirectory(MacOSX-i386)
add_subdirectory(MacOSX-arm)
Index: source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
===================================================================
--- source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
+++ source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
@@ -637,6 +637,30 @@
}
else
{
+ const size_t byte_size = return_clang_type.GetByteSize();
+ if (byte_size <= sizeof(long double))
+ {
+ const RegisterInfo *f1_info = reg_ctx->GetRegisterInfoByName("f1", 0);
+ RegisterValue f1_value;
+ if (reg_ctx->ReadRegister (f1_info, f1_value))
+ {
+ DataExtractor data;
+ if (f1_value.GetData(data))
+ {
+ lldb::offset_t offset = 0;
+ if (byte_size == sizeof(float))
+ {
+ value.GetScalar() = (float) data.GetFloat(&offset);
+ success = true;
+ }
+ else if (byte_size == sizeof(double))
+ {
+ value.GetScalar() = (double) data.GetDouble(&offset);
+ success = true;
+ }
+ }
+ }
+ }
}
}
Index: source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
===================================================================
--- source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
+++ source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
@@ -637,6 +637,30 @@
}
else
{
+ const size_t byte_size = return_clang_type.GetByteSize();
+ if (byte_size <= sizeof(long double))
+ {
+ const RegisterInfo *f1_info = reg_ctx->GetRegisterInfoByName("f1", 0);
+ RegisterValue f1_value;
+ if (reg_ctx->ReadRegister (f1_info, f1_value))
+ {
+ DataExtractor data;
+ if (f1_value.GetData(data))
+ {
+ lldb::offset_t offset = 0;
+ if (byte_size == sizeof(float))
+ {
+ value.GetScalar() = (float) data.GetFloat(&offset);
+ success = true;
+ }
+ else if (byte_size == sizeof(double))
+ {
+ value.GetScalar() = (double) data.GetDouble(&offset);
+ success = true;
+ }
+ }
+ }
+ }
}
}
Index: source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
===================================================================
--- source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
+++ source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
@@ -326,13 +326,13 @@
trap_opcode_size = sizeof(g_i386_opcode);
}
break;
- case llvm::Triple::ppc:
- case llvm::Triple::ppc64:
- {
- static const uint8_t g_ppc_opcode[] = { 0x7f, 0xe0, 0x00, 0x08 };
- trap_opcode = g_ppc_opcode;
- trap_opcode_size = sizeof(g_ppc_opcode);
- }
+ case llvm::Triple::ppc:
+ case llvm::Triple::ppc64:
+ {
+ static const uint8_t g_ppc_opcode[] = { 0x7f, 0xe0, 0x00, 0x08 };
+ trap_opcode = g_ppc_opcode;
+ trap_opcode_size = sizeof(g_ppc_opcode);
+ }
}
if (bp_site->SetTrapOpcode(trap_opcode, trap_opcode_size))
Index: source/Target/Thread.cpp
===================================================================
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -2281,8 +2281,8 @@
case llvm::Triple::aarch64:
case llvm::Triple::thumb:
case llvm::Triple::mips64:
- case llvm::Triple::ppc64:
case llvm::Triple::ppc:
+ case llvm::Triple::ppc64:
case llvm::Triple::hexagon:
m_unwinder_ap.reset (new UnwindLLDB (*this));
break;
Index: source/lldb.cpp
===================================================================
--- source/lldb.cpp
+++ source/lldb.cpp
@@ -229,6 +229,7 @@
ABIMacOSX_arm::Terminate();
ABIMacOSX_arm64::Terminate();
ABISysV_x86_64::Terminate();
+ ABISysV_ppc::Terminate();
ABISysV_ppc64::Terminate();
DisassemblerLLVMC::Terminate();
ObjectContainerBSDArchive::Terminate();
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits