180814287SRaphael Isemann //===-- ProcessPOSIXLog.cpp -----------------------------------------------===//
29ed5b49cSJohnny Chen //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
69ed5b49cSJohnny Chen //
79ed5b49cSJohnny Chen //===----------------------------------------------------------------------===//
89ed5b49cSJohnny Chen 
99ed5b49cSJohnny Chen #include "ProcessPOSIXLog.h"
109ed5b49cSJohnny Chen 
11c5f28e2aSKamil Rytarowski #include "llvm/Support/Threading.h"
12c5f28e2aSKamil Rytarowski 
139ed5b49cSJohnny Chen using namespace lldb_private;
149ed5b49cSJohnny Chen 
15c29f7ff3SPavel Labath static constexpr Log::Category g_categories[] = {
16*0f08db66SPavel Labath     {{"break"}, {"log breakpoints"}, POSIXLog::Breakpoints},
17*0f08db66SPavel Labath     {{"memory"}, {"log memory reads and writes"}, POSIXLog::Memory},
18*0f08db66SPavel Labath     {{"process"}, {"log process events and activities"}, POSIXLog::Process},
19*0f08db66SPavel Labath     {{"ptrace"}, {"log all calls to ptrace"}, POSIXLog::Ptrace},
20*0f08db66SPavel Labath     {{"registers"}, {"log register read/writes"}, POSIXLog::Registers},
21*0f08db66SPavel Labath     {{"thread"}, {"log thread events and activities"}, POSIXLog::Thread},
22*0f08db66SPavel Labath     {{"watch"}, {"log watchpoint related activities"}, POSIXLog::Watchpoints},
23c29f7ff3SPavel Labath };
249ed5b49cSJohnny Chen 
25*0f08db66SPavel Labath static Log::Channel g_channel(g_categories, POSIXLog::Process);
26*0f08db66SPavel Labath 
LogChannelFor()27*0f08db66SPavel Labath template <> Log::Channel &lldb_private::LogChannelFor<POSIXLog>() {
28*0f08db66SPavel Labath   return g_channel;
29*0f08db66SPavel Labath }
30c29f7ff3SPavel Labath 
Initialize()31c29f7ff3SPavel Labath void ProcessPOSIXLog::Initialize() {
32c5f28e2aSKamil Rytarowski   static llvm::once_flag g_once_flag;
33c29f7ff3SPavel Labath   llvm::call_once(g_once_flag, []() { Log::Register("posix", g_channel); });
345f4b6c7cSRobert Flack }
35