[Lldb-commits] [lldb] e632e90 - [lldb] Remove logging from Platform::~Platform

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 14 11:43:06 PDT 2021


Author: Raphael Isemann
Date: 2021-10-14T20:42:45+02:00
New Revision: e632e900ac1092f581b42fb93662613db9977b5a

URL: https://github.com/llvm/llvm-project/commit/e632e900ac1092f581b42fb93662613db9977b5a
DIFF: https://github.com/llvm/llvm-project/commit/e632e900ac1092f581b42fb93662613db9977b5a.diff

LOG: [lldb] Remove logging from Platform::~Platform

Platform instances are stored in a function-local static list. However, the
logging code involves locking a function-local static mutex. This only works on
some implementations where the Log mutex is by accident destroyed *after* the
Platform list is destroyed.

This fixes randomly failing tests due to `recursive_mutex lock failed: Invalid
argument`.

Reviewed By: kastiglione

Differential Revision: https://reviews.llvm.org/D111816

Added: 
    

Modified: 
    lldb/include/lldb/Target/Platform.h
    lldb/source/Target/Platform.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h
index 9aed70188097f..81858bbfa7023 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -73,11 +73,9 @@ class Platform : public PluginInterface {
   /// Default Constructor
   Platform(bool is_host_platform);
 
-  /// Destructor.
-  ///
   /// The destructor is virtual since this class is designed to be inherited
   /// from by the plug-in instance.
-  ~Platform() override;
+  ~Platform() override = default;
 
   static void Initialize();
 

diff  --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 7a40446261f73..a414bc7460837 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -395,15 +395,6 @@ Platform::Platform(bool is_host)
   LLDB_LOGF(log, "%p Platform::Platform()", static_cast<void *>(this));
 }
 
-/// Destructor.
-///
-/// The destructor is virtual since this class is designed to be
-/// inherited from by the plug-in instance.
-Platform::~Platform() {
-  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
-  LLDB_LOGF(log, "%p Platform::~Platform()", static_cast<void *>(this));
-}
-
 void Platform::GetStatus(Stream &strm) {
   std::string s;
   strm.Printf("  Platform: %s\n", GetPluginName().GetCString());


        


More information about the lldb-commits mailing list