15ffd83dbSDimitry Andric //===-- ProcessPOSIXLog.cpp -----------------------------------------------===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric
90b57cec5SDimitry Andric #include "ProcessPOSIXLog.h"
100b57cec5SDimitry Andric
110b57cec5SDimitry Andric #include "llvm/Support/Threading.h"
120b57cec5SDimitry Andric
130b57cec5SDimitry Andric using namespace lldb_private;
140b57cec5SDimitry Andric
150b57cec5SDimitry Andric static constexpr Log::Category g_categories[] = {
16*04eeddc0SDimitry Andric {{"break"}, {"log breakpoints"}, POSIXLog::Breakpoints},
17*04eeddc0SDimitry Andric {{"memory"}, {"log memory reads and writes"}, POSIXLog::Memory},
18*04eeddc0SDimitry Andric {{"process"}, {"log process events and activities"}, POSIXLog::Process},
19*04eeddc0SDimitry Andric {{"ptrace"}, {"log all calls to ptrace"}, POSIXLog::Ptrace},
20*04eeddc0SDimitry Andric {{"registers"}, {"log register read/writes"}, POSIXLog::Registers},
21*04eeddc0SDimitry Andric {{"thread"}, {"log thread events and activities"}, POSIXLog::Thread},
22*04eeddc0SDimitry Andric {{"watch"}, {"log watchpoint related activities"}, POSIXLog::Watchpoints},
230b57cec5SDimitry Andric };
240b57cec5SDimitry Andric
25*04eeddc0SDimitry Andric static Log::Channel g_channel(g_categories, POSIXLog::Process);
26*04eeddc0SDimitry Andric
LogChannelFor()27*04eeddc0SDimitry Andric template <> Log::Channel &lldb_private::LogChannelFor<POSIXLog>() {
28*04eeddc0SDimitry Andric return g_channel;
29*04eeddc0SDimitry Andric }
300b57cec5SDimitry Andric
Initialize()310b57cec5SDimitry Andric void ProcessPOSIXLog::Initialize() {
320b57cec5SDimitry Andric static llvm::once_flag g_once_flag;
330b57cec5SDimitry Andric llvm::call_once(g_once_flag, []() { Log::Register("posix", g_channel); });
340b57cec5SDimitry Andric }
35