summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility/Logging.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-10-19 17:40:51 +0000
committerPavel Labath <labath@google.com>2017-10-19 17:40:51 +0000
commit6c3c02a3bd6a5703dd6b22c8254e92961d57d31d (patch)
tree73c85cef0858b8bf8c3305f52ada5b6ea5dfab25 /lldb/source/Utility/Logging.cpp
parent52f0885d4323b85cfed79416de9595e7cbb3ce53 (diff)
downloadbcm5719-llvm-6c3c02a3bd6a5703dd6b22c8254e92961d57d31d.tar.gz
bcm5719-llvm-6c3c02a3bd6a5703dd6b22c8254e92961d57d31d.zip
Logging: Make sure logging machinery is in a consistent state after forking
Summary: We had a bug where if we had forked (in the ProcessLauncherPosixFork) while another thread was writing a log message, we would deadlock. This happened because the fork child inherited the locked log rwmutex, which would never get unlocked. This meant the child got stuck trying to disable all log channels. The bug existed for a while but only started being apparent after D37930, which started using ThreadLauncher (which uses logging) instead of std::thread (which does not) for launching TaskPool threads. The fix is to use pthread_atfork to make sure noone is writing a log message while we are forking. Reviewers: zturner, eugene, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D38938 llvm-svn: 316173
Diffstat (limited to 'lldb/source/Utility/Logging.cpp')
-rw-r--r--lldb/source/Utility/Logging.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lldb/source/Utility/Logging.cpp b/lldb/source/Utility/Logging.cpp
index 0bd6d6692e3..c9a6ef1bd1e 100644
--- a/lldb/source/Utility/Logging.cpp
+++ b/lldb/source/Utility/Logging.cpp
@@ -51,7 +51,7 @@ static constexpr Log::Category g_categories[] = {
static Log::Channel g_log_channel(g_categories, LIBLLDB_LOG_DEFAULT);
-void lldb_private::InitializeLog() {
+void lldb_private::InitializeLldbChannel() {
Log::Register("lldb", g_log_channel);
}
OpenPOWER on IntegriCloud