1 //===-- ProcessPOSIXLog.cpp ---------------------------------------*- C++
2 //-*-===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 
11 #include "ProcessPOSIXLog.h"
12 
13 #include "llvm/Support/Threading.h"
14 
15 using namespace lldb;
16 using namespace lldb_private;
17 
18 static constexpr Log::Category g_categories[] = {
19   {{"break"}, {"log breakpoints"}, POSIX_LOG_BREAKPOINTS},
20   {{"memory"}, {"log memory reads and writes"}, POSIX_LOG_MEMORY},
21   {{"process"}, {"log process events and activities"}, POSIX_LOG_PROCESS},
22   {{"ptrace"}, {"log all calls to ptrace"}, POSIX_LOG_PTRACE},
23   {{"registers"}, {"log register read/writes"}, POSIX_LOG_REGISTERS},
24   {{"thread"}, {"log thread events and activities"}, POSIX_LOG_THREAD},
25   {{"watch"}, {"log watchpoint related activities"}, POSIX_LOG_WATCHPOINTS},
26 };
27 
28 Log::Channel ProcessPOSIXLog::g_channel(g_categories, POSIX_LOG_DEFAULT);
29 
30 void ProcessPOSIXLog::Initialize() {
31   static llvm::once_flag g_once_flag;
32   llvm::call_once(g_once_flag, []() { Log::Register("posix", g_channel); });
33 }
34