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