From 202ecd26da6abd5d1a90ddef26023fc1048859b7 Mon Sep 17 00:00:00 2001 From: Todd Fiala Date: Thu, 10 Jul 2014 04:39:13 +0000 Subject: [PATCH] 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. llvm-svn: 212681 --- lldb/include/lldb/DataFormatters/TypeFormat.h | 9 +++++---- lldb/source/DataFormatters/TypeFormat.cpp | 11 +++++++++++ lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp | 10 +++++----- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/lldb/include/lldb/DataFormatters/TypeFormat.h b/lldb/include/lldb/DataFormatters/TypeFormat.h index 20fa8f2..1090d78 100644 --- a/lldb/include/lldb/DataFormatters/TypeFormat.h +++ b/lldb/include/lldb/DataFormatters/TypeFormat.h @@ -14,6 +14,7 @@ // C++ Includes #include +#include // Other libraries and framework includes @@ -135,7 +136,7 @@ namespace lldb_private { typedef std::shared_ptr 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 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 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 m_types; + mutable std::unordered_map m_types; private: DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl_EnumType); diff --git a/lldb/source/DataFormatters/TypeFormat.cpp b/lldb/source/DataFormatters/TypeFormat.cpp index 1648a16..0c62daf 100644 --- a/lldb/source/DataFormatters/TypeFormat.cpp +++ b/lldb/source/DataFormatters/TypeFormat.cpp @@ -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 diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 4681077..e472d92 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -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 *args) 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) -- 2.7.4