]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
Import CK as of commit 5221ae2f3722a78c7fc41e47069ad94983d3bccb.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / Process / POSIX / ProcessPOSIXLog.cpp
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_private;
16
17 static constexpr Log::Category g_categories[] = {
18   {{"break"}, {"log breakpoints"}, POSIX_LOG_BREAKPOINTS},
19   {{"memory"}, {"log memory reads and writes"}, POSIX_LOG_MEMORY},
20   {{"process"}, {"log process events and activities"}, POSIX_LOG_PROCESS},
21   {{"ptrace"}, {"log all calls to ptrace"}, POSIX_LOG_PTRACE},
22   {{"registers"}, {"log register read/writes"}, POSIX_LOG_REGISTERS},
23   {{"thread"}, {"log thread events and activities"}, POSIX_LOG_THREAD},
24   {{"watch"}, {"log watchpoint related activities"}, POSIX_LOG_WATCHPOINTS},
25 };
26
27 Log::Channel ProcessPOSIXLog::g_channel(g_categories, POSIX_LOG_DEFAULT);
28
29 void ProcessPOSIXLog::Initialize() {
30   static llvm::once_flag g_once_flag;
31   llvm::call_once(g_once_flag, []() { Log::Register("posix", g_channel); });
32 }