1*0b57cec5SDimitry Andric //===-- ProcessPOSIXLog.cpp -----------------------------------------------===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric 
9*0b57cec5SDimitry Andric #include "ProcessPOSIXLog.h"
10*0b57cec5SDimitry Andric 
11*0b57cec5SDimitry Andric #include "llvm/Support/Threading.h"
12*0b57cec5SDimitry Andric 
13*0b57cec5SDimitry Andric using namespace lldb_private;
14*0b57cec5SDimitry Andric 
15*0b57cec5SDimitry Andric static constexpr Log::Category g_categories[] = {
16*0b57cec5SDimitry Andric     {{"break"}, {"log breakpoints"}, POSIXLog::Breakpoints},
17*0b57cec5SDimitry Andric     {{"memory"}, {"log memory reads and writes"}, POSIXLog::Memory},
18*0b57cec5SDimitry Andric     {{"process"}, {"log process events and activities"}, POSIXLog::Process},
19*0b57cec5SDimitry Andric     {{"ptrace"}, {"log all calls to ptrace"}, POSIXLog::Ptrace},
20*0b57cec5SDimitry Andric     {{"registers"}, {"log register read/writes"}, POSIXLog::Registers},
21*0b57cec5SDimitry Andric     {{"thread"}, {"log thread events and activities"}, POSIXLog::Thread},
22*0b57cec5SDimitry Andric     {{"watch"}, {"log watchpoint related activities"}, POSIXLog::Watchpoints},
23*0b57cec5SDimitry Andric };
24*0b57cec5SDimitry Andric 
25*0b57cec5SDimitry Andric static Log::Channel g_channel(g_categories, POSIXLog::Process);
26*0b57cec5SDimitry Andric 
LogChannelFor()27*0b57cec5SDimitry Andric template <> Log::Channel &lldb_private::LogChannelFor<POSIXLog>() {
28*0b57cec5SDimitry Andric   return g_channel;
29*0b57cec5SDimitry Andric }
30*0b57cec5SDimitry Andric 
Initialize()31*0b57cec5SDimitry Andric void ProcessPOSIXLog::Initialize() {
32   static llvm::once_flag g_once_flag;
33   llvm::call_once(g_once_flag, []() { Log::Register("posix", g_channel); });
34 }
35