[Lldb-commits] [PATCH] D127922: [lldb] Introduce the concept of a log handler (NFC)

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 16 10:34:49 PDT 2022


clayborg added inline comments.


================
Comment at: lldb/source/Utility/Log.cpp:323-324
   if (options.Test(LLDB_LOG_OPTION_THREADSAFE)) {
     static std::recursive_mutex g_LogThreadedMutex;
     std::lock_guard<std::recursive_mutex> guard(g_LogThreadedMutex);
+    handler_sp->Emit(message);
----------------
Since we are improving stuff here, should we add a mutex to each handler and use the handler specific mutex if needed?


================
Comment at: lldb/source/Utility/Log.cpp:325
     std::lock_guard<std::recursive_mutex> guard(g_LogThreadedMutex);
-    *stream_sp << message;
-    stream_sp->flush();
+    handler_sp->Emit(message);
+    handler_sp->Flush();
----------------
Will this copy the string? The Emit() calls take a "std::string", maybe we should switch it to "const std::string &" to avoid any copies?


================
Comment at: lldb/source/Utility/Log.cpp:328
   } else {
-    *stream_sp << message;
-    stream_sp->flush();
+    handler_sp->Emit(message);
+    handler_sp->Flush();
----------------
Ditto


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127922/new/

https://reviews.llvm.org/D127922



More information about the lldb-commits mailing list