xref: /openbsd-src/gnu/llvm/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (revision dda2819751e49c83612958492e38917049128b41)
1*dda28197Spatrick //===-- ProcessGDBRemoteLog.cpp -------------------------------------------===//
2061da546Spatrick //
3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information.
5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6061da546Spatrick //
7061da546Spatrick //===----------------------------------------------------------------------===//
8061da546Spatrick 
9061da546Spatrick #include "ProcessGDBRemoteLog.h"
10061da546Spatrick #include "ProcessGDBRemote.h"
11061da546Spatrick #include "llvm/Support/Threading.h"
12061da546Spatrick 
13061da546Spatrick using namespace lldb;
14061da546Spatrick using namespace lldb_private;
15061da546Spatrick using namespace lldb_private::process_gdb_remote;
16061da546Spatrick 
17061da546Spatrick static constexpr Log::Category g_categories[] = {
18061da546Spatrick     {{"async"}, {"log asynchronous activity"}, GDBR_LOG_ASYNC},
19061da546Spatrick     {{"break"}, {"log breakpoints"}, GDBR_LOG_BREAKPOINTS},
20061da546Spatrick     {{"comm"}, {"log communication activity"}, GDBR_LOG_COMM},
21061da546Spatrick     {{"packets"}, {"log gdb remote packets"}, GDBR_LOG_PACKETS},
22061da546Spatrick     {{"memory"}, {"log memory reads and writes"}, GDBR_LOG_MEMORY},
23061da546Spatrick     {{"data-short"},
24061da546Spatrick      {"log memory bytes for memory reads and writes for short transactions "
25061da546Spatrick       "only"},
26061da546Spatrick      GDBR_LOG_MEMORY_DATA_SHORT},
27061da546Spatrick     {{"data-long"},
28061da546Spatrick      {"log memory bytes for memory reads and writes for all transactions"},
29061da546Spatrick      GDBR_LOG_MEMORY_DATA_LONG},
30061da546Spatrick     {{"process"}, {"log process events and activities"}, GDBR_LOG_PROCESS},
31061da546Spatrick     {{"step"}, {"log step related activities"}, GDBR_LOG_STEP},
32061da546Spatrick     {{"thread"}, {"log thread events and activities"}, GDBR_LOG_THREAD},
33061da546Spatrick     {{"watch"}, {"log watchpoint related activities"}, GDBR_LOG_WATCHPOINTS},
34061da546Spatrick };
35061da546Spatrick 
36061da546Spatrick Log::Channel ProcessGDBRemoteLog::g_channel(g_categories, GDBR_LOG_DEFAULT);
37061da546Spatrick 
38061da546Spatrick void ProcessGDBRemoteLog::Initialize() {
39061da546Spatrick   static llvm::once_flag g_once_flag;
40061da546Spatrick   llvm::call_once(g_once_flag, []() {
41061da546Spatrick     Log::Register("gdb-remote", g_channel);
42061da546Spatrick   });
43061da546Spatrick }
44