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"}, POSIX_LOG_BREAKPOINTS},
17*0b57cec5SDimitry Andric {{"memory"}, {"log memory reads and writes"}, POSIX_LOG_MEMORY},
18*0b57cec5SDimitry Andric {{"process"}, {"log process events and activities"}, POSIX_LOG_PROCESS},
19*0b57cec5SDimitry Andric {{"ptrace"}, {"log all calls to ptrace"}, POSIX_LOG_PTRACE},
20*0b57cec5SDimitry Andric {{"registers"}, {"log register read/writes"}, POSIX_LOG_REGISTERS},
21*0b57cec5SDimitry Andric {{"thread"}, {"log thread events and activities"}, POSIX_LOG_THREAD},
22*0b57cec5SDimitry Andric {{"watch"}, {"log watchpoint related activities"}, POSIX_LOG_WATCHPOINTS},
23*0b57cec5SDimitry Andric };
24*0b57cec5SDimitry Andric
25*0b57cec5SDimitry Andric Log::Channel ProcessPOSIXLog::g_channel(g_categories, POSIX_LOG_DEFAULT);
26*0b57cec5SDimitry Andric
Initialize()27*0b57cec5SDimitry Andric void ProcessPOSIXLog::Initialize() {
28*0b57cec5SDimitry Andric static llvm::once_flag g_once_flag;
29*0b57cec5SDimitry Andric llvm::call_once(g_once_flag, []() { Log::Register("posix", g_channel); });
30*0b57cec5SDimitry Andric }
31*0b57cec5SDimitry Andric