[Lldb-commits] [lldb] r212681 - Fixes for broken Debian build - g++ 4.7 support.

Todd Fiala todd.fiala at gmail.com
Wed Jul 9 21:39:13 PDT 2014


Author: tfiala
Date: Wed Jul  9 23:39:13 2014
New Revision: 212681

URL: http://llvm.org/viewvc/llvm-project?rev=212681&view=rev
Log:
Fixes for broken Debian build - g++ 4.7 support.

These fix the broken debian lldb build, which is using g++ 4.7.2.

TypeFormat changes:
1. stopped using the C++11 "dtor = default;" construct.
The generated default destructor in the two derived classes wanted
them to have a different throws() semantic that was causing 4.7 to
fail to generate it.  I switched these to empty destructors defined
in the .cpp file.

2. Switched the m_types map from an ordered map to an unordered_map.
g++ 4.7's c++ library supports the C++11 emplace() used by TypeFormat
but the same c++ library's map impl does not.  Since TypeFormat didn't
look like it depended on ordering in the map, I just switched it to
a std::unordered_map.

NativeProcessLinux - g++ 4.7 chokes on lexing the "<::" in
static_cast<::pid_t>(wpid).  g++ 4.8+ and clang are fine with it.
I just put a space in between the "<" and the "::" and that cleared
it up.

Modified:
    lldb/trunk/include/lldb/DataFormatters/TypeFormat.h
    lldb/trunk/source/DataFormatters/TypeFormat.cpp
    lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp

Modified: lldb/trunk/include/lldb/DataFormatters/TypeFormat.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeFormat.h?rev=212681&r1=212680&r2=212681&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/TypeFormat.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeFormat.h Wed Jul  9 23:39:13 2014
@@ -14,6 +14,7 @@
 
 // C++ Includes
 #include <string>
+#include <unordered_map>
 
 // Other libraries and framework includes
 
@@ -135,7 +136,7 @@ namespace lldb_private {
         typedef std::shared_ptr<TypeFormatImpl> SharedPointer;
         typedef bool(*ValueCallback)(void*, ConstString, const lldb::TypeFormatImplSP&);
         
-        virtual ~TypeFormatImpl () = default;
+        virtual ~TypeFormatImpl ();
         
         bool
         Cascades () const
@@ -229,7 +230,7 @@ namespace lldb_private {
         typedef std::shared_ptr<TypeFormatImpl_Format> SharedPointer;
         typedef bool(*ValueCallback)(void*, ConstString, const TypeFormatImpl_Format::SharedPointer&);
         
-        virtual ~TypeFormatImpl_Format () = default;
+        virtual ~TypeFormatImpl_Format ();
         
         lldb::Format
         GetFormat () const
@@ -272,7 +273,7 @@ namespace lldb_private {
         typedef std::shared_ptr<TypeFormatImpl_EnumType> SharedPointer;
         typedef bool(*ValueCallback)(void*, ConstString, const TypeFormatImpl_EnumType::SharedPointer&);
         
-        ~TypeFormatImpl_EnumType () = default;
+        ~TypeFormatImpl_EnumType ();
         
         ConstString
         GetTypeName ()
@@ -301,7 +302,7 @@ namespace lldb_private {
         
     protected:
         ConstString m_enum_type;
-        mutable std::map<void*,ClangASTType> m_types;
+        mutable std::unordered_map<void*,ClangASTType> m_types;
         
     private:
         DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl_EnumType);

Modified: lldb/trunk/source/DataFormatters/TypeFormat.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeFormat.cpp?rev=212681&r1=212680&r2=212681&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeFormat.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeFormat.cpp Wed Jul  9 23:39:13 2014
@@ -38,6 +38,9 @@ m_my_revision(0)
 {
 }
 
+TypeFormatImpl::~TypeFormatImpl ()
+{
+}
 
 TypeFormatImpl_Format::TypeFormatImpl_Format (lldb::Format f,
                                               const TypeFormatImpl::Flags& flags) :
@@ -46,6 +49,10 @@ m_format (f)
 {
 }
 
+TypeFormatImpl_Format::~TypeFormatImpl_Format ()
+{
+}
+
 bool
 TypeFormatImpl_Format::FormatObject (ValueObject *valobj,
                                      std::string& dest) const
@@ -162,6 +169,10 @@ m_types()
 {
 }
 
+TypeFormatImpl_EnumType::~TypeFormatImpl_EnumType ()
+{
+}
+
 bool
 TypeFormatImpl_EnumType::FormatObject (ValueObject *valobj,
                                        std::string& dest) const

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=212681&r1=212680&r2=212681&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Wed Jul  9 23:39:13 2014
@@ -263,9 +263,9 @@ namespace
 
         errno = 0;
         if (req == PTRACE_GETREGSET || req == PTRACE_SETREGSET)
-            result = ptrace(static_cast<__ptrace_request>(req), static_cast<::pid_t>(pid), *(unsigned int *)addr, data);
+            result = ptrace(static_cast<__ptrace_request>(req), static_cast< ::pid_t>(pid), *(unsigned int *)addr, data);
         else
-            result = ptrace(static_cast<__ptrace_request>(req), static_cast<::pid_t>(pid), addr, data);
+            result = ptrace(static_cast<__ptrace_request>(req), static_cast< ::pid_t>(pid), addr, data);
 
         if (log)
             log->Printf("ptrace(%s, %" PRIu64 ", %p, %p, %zu)=%lX called from file %s line %d",
@@ -299,9 +299,9 @@ namespace
         long result = 0;
         errno = 0;
         if (req == PTRACE_GETREGSET || req == PTRACE_SETREGSET)
-            result = ptrace(static_cast<__ptrace_request>(req), static_cast<::pid_t>(pid), *(unsigned int *)addr, data);
+            result = ptrace(static_cast<__ptrace_request>(req), static_cast< ::pid_t>(pid), *(unsigned int *)addr, data);
         else
-            result = ptrace(static_cast<__ptrace_request>(req), static_cast<::pid_t>(pid), addr, data);
+            result = ptrace(static_cast<__ptrace_request>(req), static_cast< ::pid_t>(pid), addr, data);
         return result;
     }
 #endif
@@ -1530,7 +1530,7 @@ NativeProcessLinux::Launch(LaunchArgs *a
 
         goto FINISH;
     }
-    assert(WIFSTOPPED(status) && (wpid == static_cast<::pid_t> (pid)) &&
+    assert(WIFSTOPPED(status) && (wpid == static_cast< ::pid_t> (pid)) &&
            "Could not sync with inferior process.");
 
     if (log)





More information about the lldb-commits mailing list