[Lldb-commits] [lldb] r220963 - Fix some bugs from D5988

Justin Hibbits jrh29 at alumni.cwru.edu
Fri Oct 31 08:57:52 PDT 2014


Author: jhibbits
Date: Fri Oct 31 10:57:52 2014
New Revision: 220963

URL: http://llvm.org/viewvc/llvm-project?rev=220963&view=rev
Log:
Fix some bugs from D5988

Summary:
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.

Reviewers: emaste

Reviewed By: emaste

Subscribers: emaste, lldb-commits

Differential Revision: http://reviews.llvm.org/D6049

Modified:
    lldb/trunk/lib/Makefile
    lldb/trunk/source/Core/ArchSpec.cpp
    lldb/trunk/source/Host/freebsd/Host.cpp
    lldb/trunk/source/Plugins/ABI/CMakeLists.txt
    lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
    lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
    lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/lldb.cpp

Modified: lldb/trunk/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lib/Makefile?rev=220963&r1=220962&r2=220963&view=diff
==============================================================================
--- lldb/trunk/lib/Makefile (original)
+++ lldb/trunk/lib/Makefile Fri Oct 31 10:57:52 2014
@@ -34,6 +34,7 @@ USEDLIBS = lldbAPI.a \
 	lldbPluginABIMacOSX_arm.a \
 	lldbPluginABIMacOSX_arm64.a \
 	lldbPluginABIMacOSX_i386.a \
+	lldbPluginABISysV_ppc.a \
 	lldbPluginABISysV_ppc64.a \
 	lldbPluginABISysV_x86_64.a \
 	lldbPluginABISysV_hexagon.a \

Modified: lldb/trunk/source/Core/ArchSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ArchSpec.cpp?rev=220963&r1=220962&r2=220963&view=diff
==============================================================================
--- lldb/trunk/source/Core/ArchSpec.cpp (original)
+++ lldb/trunk/source/Core/ArchSpec.cpp Fri Oct 31 10:57:52 2014
@@ -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"

Modified: lldb/trunk/source/Host/freebsd/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/freebsd/Host.cpp?rev=220963&r1=220962&r2=220963&view=diff
==============================================================================
--- lldb/trunk/source/Host/freebsd/Host.cpp (original)
+++ lldb/trunk/source/Host/freebsd/Host.cpp Fri Oct 31 10:57:52 2014
@@ -301,6 +301,8 @@ GetAuxvData32(lldb_private::Process *pro
     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;

Modified: lldb/trunk/source/Plugins/ABI/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/CMakeLists.txt?rev=220963&r1=220962&r2=220963&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/ABI/CMakeLists.txt Fri Oct 31 10:57:52 2014
@@ -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)

Modified: lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp?rev=220963&r1=220962&r2=220963&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp Fri Oct 31 10:57:52 2014
@@ -637,6 +637,30 @@ ABISysV_ppc::GetReturnValueObjectSimple
             }
             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;
+                            }
+                        }
+                    }
+                }
             }
         }
 

Modified: lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp?rev=220963&r1=220962&r2=220963&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp Fri Oct 31 10:57:52 2014
@@ -637,6 +637,30 @@ ABISysV_ppc64::GetReturnValueObjectSimpl
             }
             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;
+                            }
+                        }
+                    }
+                }
             }
         }
 

Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=220963&r1=220962&r2=220963&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Fri Oct 31 10:57:52 2014
@@ -326,13 +326,13 @@ PlatformFreeBSD::GetSoftwareBreakpointTr
             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))

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=220963&r1=220962&r2=220963&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Fri Oct 31 10:57:52 2014
@@ -2281,8 +2281,8 @@ Thread::GetUnwinder ()
             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;

Modified: lldb/trunk/source/lldb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=220963&r1=220962&r2=220963&view=diff
==============================================================================
--- lldb/trunk/source/lldb.cpp (original)
+++ lldb/trunk/source/lldb.cpp Fri Oct 31 10:57:52 2014
@@ -229,6 +229,7 @@ lldb_private::Terminate ()
     ABIMacOSX_arm::Terminate();
     ABIMacOSX_arm64::Terminate();
     ABISysV_x86_64::Terminate();
+    ABISysV_ppc::Terminate();
     ABISysV_ppc64::Terminate();
     DisassemblerLLVMC::Terminate();
     ObjectContainerBSDArchive::Terminate();





More information about the lldb-commits mailing list