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