| 1 | //===-- ProcessPOSIXLog.cpp -----------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "ProcessPOSIXLog.h" |
| 10 | |
| 11 | #include "llvm/Support/Threading.h" |
| 12 | |
| 13 | using namespace lldb_private; |
| 14 | |
| 15 | static constexpr Log::Category g_categories[] = { |
| 16 | {{"break" }, {"log breakpoints" }, POSIXLog::Breakpoints}, |
| 17 | {{"memory" }, {"log memory reads and writes" }, POSIXLog::Memory}, |
| 18 | {{"process" }, {"log process events and activities" }, POSIXLog::Process}, |
| 19 | {{"ptrace" }, {"log all calls to ptrace" }, POSIXLog::Ptrace}, |
| 20 | {{"registers" }, {"log register read/writes" }, POSIXLog::Registers}, |
| 21 | {{"thread" }, {"log thread events and activities" }, POSIXLog::Thread}, |
| 22 | {{"watch" }, {"log watchpoint related activities" }, POSIXLog::Watchpoints}, |
| 23 | }; |
| 24 | |
| 25 | static Log::Channel g_channel(g_categories, POSIXLog::Process); |
| 26 | |
| 27 | template <> Log::Channel &lldb_private::LogChannelFor<POSIXLog>() { |
| 28 | return g_channel; |
| 29 | } |
| 30 | |
| 31 | void ProcessPOSIXLog::Initialize() { |
| 32 | static llvm::once_flag g_once_flag; |
| 33 | llvm::call_once(flag&: g_once_flag, F: []() { Log::Register(name: "posix" , channel&: g_channel); }); |
| 34 | } |
| 35 | |