[Lldb-commits] [lldb] r269058 - Fix logging in Listener.cpp

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue May 10 06:46:25 PDT 2016


Author: labath
Date: Tue May 10 08:46:25 2016
New Revision: 269058

URL: http://llvm.org/viewvc/llvm-project?rev=269058&view=rev
Log:
Fix logging in Listener.cpp

Clear() log message was claiming it was the destructor, which had me very confused when looking
at the log messages. Fix the message, and add a log message to the real destructor.

Also noticed that the destructor was needlessly locking the broadcaster mutex (as Clear was
locking it again anyway), so remove that as well.

Modified:
    lldb/trunk/source/Core/Listener.cpp

Modified: lldb/trunk/source/Core/Listener.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Listener.cpp?rev=269058&r1=269057&r2=269058&view=diff
==============================================================================
--- lldb/trunk/source/Core/Listener.cpp (original)
+++ lldb/trunk/source/Core/Listener.cpp Tue May 10 08:46:25 2016
@@ -56,9 +56,12 @@ Listener::Listener(const char *name) :
 
 Listener::~Listener()
 {
-    Mutex::Locker locker (m_broadcasters_mutex);
+    Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
 
     Clear();
+
+    if (log)
+        log->Printf("%p Listener::%s('%s')", this, __FUNCTION__, m_name.c_str());
 }
 
 void
@@ -87,9 +90,8 @@ Listener::Clear()
             manager_sp->RemoveListener(this);
     }
 
-    if (log != nullptr)
-        log->Printf ("%p Listener::~Listener('%s')",
-                     static_cast<void*>(this), m_name.c_str());
+    if (log)
+        log->Printf("%p Listener::%s('%s')", this, __FUNCTION__, m_name.c_str());
 }
 
 uint32_t




More information about the lldb-commits mailing list