1b9c1b51eSKate Stone //===-- ProcessPOSIXLog.cpp ---------------------------------------*- C++
2b9c1b51eSKate Stone //-*-===//
39ed5b49cSJohnny Chen //
4*2946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*2946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
6*2946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
79ed5b49cSJohnny Chen //
89ed5b49cSJohnny Chen //===----------------------------------------------------------------------===//
99ed5b49cSJohnny Chen 
109ed5b49cSJohnny Chen #include "ProcessPOSIXLog.h"
119ed5b49cSJohnny Chen 
12c5f28e2aSKamil Rytarowski #include "llvm/Support/Threading.h"
13c5f28e2aSKamil Rytarowski 
149ed5b49cSJohnny Chen using namespace lldb_private;
159ed5b49cSJohnny Chen 
16c29f7ff3SPavel Labath static constexpr Log::Category g_categories[] = {
17c29f7ff3SPavel Labath   {{"break"}, {"log breakpoints"}, POSIX_LOG_BREAKPOINTS},
18c29f7ff3SPavel Labath   {{"memory"}, {"log memory reads and writes"}, POSIX_LOG_MEMORY},
19c29f7ff3SPavel Labath   {{"process"}, {"log process events and activities"}, POSIX_LOG_PROCESS},
20c29f7ff3SPavel Labath   {{"ptrace"}, {"log all calls to ptrace"}, POSIX_LOG_PTRACE},
21c29f7ff3SPavel Labath   {{"registers"}, {"log register read/writes"}, POSIX_LOG_REGISTERS},
22c29f7ff3SPavel Labath   {{"thread"}, {"log thread events and activities"}, POSIX_LOG_THREAD},
23c29f7ff3SPavel Labath   {{"watch"}, {"log watchpoint related activities"}, POSIX_LOG_WATCHPOINTS},
24c29f7ff3SPavel Labath };
259ed5b49cSJohnny Chen 
26c29f7ff3SPavel Labath Log::Channel ProcessPOSIXLog::g_channel(g_categories, POSIX_LOG_DEFAULT);
27c29f7ff3SPavel Labath 
28c29f7ff3SPavel Labath void ProcessPOSIXLog::Initialize() {
29c5f28e2aSKamil Rytarowski   static llvm::once_flag g_once_flag;
30c29f7ff3SPavel Labath   llvm::call_once(g_once_flag, []() { Log::Register("posix", g_channel); });
315f4b6c7cSRobert Flack }
32