ProcessPOSIXLog.cpp revision 321369
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
15using namespace lldb_private;
16
17static 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
27Log::Channel ProcessPOSIXLog::g_channel(g_categories, POSIX_LOG_DEFAULT);
28
29void ProcessPOSIXLog::Initialize() {
30  static llvm::once_flag g_once_flag;
31  llvm::call_once(g_once_flag, []() { Log::Register("posix", g_channel); });
32}
33