[lldb] Fix Initialization/Termination for all log channels (#184467)

Similar to #184261, but for all the other log channels.
This commit is contained in:
Jonas Devlieghere
2026-03-03 16:38:38 -08:00
committed by GitHub
parent 699563e0da
commit 53fbbaa577
9 changed files with 19 additions and 22 deletions

View File

@@ -90,10 +90,16 @@ llvm::Error SystemInitializerCommon::Initialize() {
void SystemInitializerCommon::Terminate() {
LLDB_SCOPED_TIMER();
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
defined(__OpenBSD__)
ProcessPOSIXLog::Terminate();
#endif
#if defined(_WIN32)
ProcessWindowsLog::Terminate();
#endif
process_gdb_remote::ProcessGDBRemoteLog::Terminate();
Socket::Terminate();
HostInfo::Terminate();
Log::DisableAllLogChannels();

View File

@@ -94,6 +94,7 @@ llvm::StringRef ProcessKDP::GetPluginDescriptionStatic() {
}
void ProcessKDP::Terminate() {
ProcessKDPLog::Terminate();
PluginManager::UnregisterPlugin(ProcessKDP::CreateInstance);
}

View File

@@ -36,3 +36,4 @@ template <> Log::Channel &lldb_private::LogChannelFor<KDPLog>() {
}
void ProcessKDPLog::Initialize() { Log::Register("kdp-remote", g_channel); }
void ProcessKDPLog::Terminate() { Log::Unregister("kdp-remote"); }

View File

@@ -33,6 +33,7 @@ LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
class ProcessKDPLog {
public:
static void Initialize();
static void Terminate();
};
template <> Log::Channel &LogChannelFor<KDPLog>();

View File

@@ -28,7 +28,6 @@ template <> Log::Channel &lldb_private::LogChannelFor<POSIXLog>() {
return g_channel;
}
void ProcessPOSIXLog::Initialize() {
static llvm::once_flag g_once_flag;
llvm::call_once(g_once_flag, []() { Log::Register("posix", g_channel); });
}
void ProcessPOSIXLog::Initialize() { Log::Register("posix", g_channel); }
void ProcessPOSIXLog::Terminate() { Log::Unregister("posix"); }

View File

@@ -31,6 +31,7 @@ LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
class ProcessPOSIXLog {
public:
static void Initialize();
static void Terminate();
};
template <> Log::Channel &LogChannelFor<POSIXLog>();

View File

@@ -27,18 +27,6 @@ template <> Log::Channel &lldb_private::LogChannelFor<WindowsLog>() {
return g_channel;
}
void ProcessWindowsLog::Initialize() {
static llvm::once_flag g_once_flag;
llvm::call_once(g_once_flag, []() { Log::Register("windows", g_channel); });
}
void ProcessWindowsLog::Terminate() {}
void ProcessWindowsLog::Initialize() { Log::Register("windows", g_channel); }
void ProcessWindowsLog::Terminate() { Log::Unregister("windows"); }

View File

@@ -40,8 +40,7 @@ template <> Log::Channel &lldb_private::LogChannelFor<GDBRLog>() {
}
void ProcessGDBRemoteLog::Initialize() {
static llvm::once_flag g_once_flag;
llvm::call_once(g_once_flag, []() {
Log::Register("gdb-remote", g_channel);
});
Log::Register("gdb-remote", g_channel);
}
void ProcessGDBRemoteLog::Terminate() { Log::Unregister("gdb-remote"); }

View File

@@ -34,6 +34,7 @@ LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
class ProcessGDBRemoteLog {
public:
static void Initialize();
static void Terminate();
};
} // namespace process_gdb_remote