xref: /openbsd-src/gnu/llvm/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (revision 061da546b983eb767bad15e67af1174fb0bcf31c)
1*061da546Spatrick //===-- ProcessGDBRemoteLog.cpp ---------------------------------*- C++ -*-===//
2*061da546Spatrick //
3*061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*061da546Spatrick // See https://llvm.org/LICENSE.txt for license information.
5*061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*061da546Spatrick //
7*061da546Spatrick //===----------------------------------------------------------------------===//
8*061da546Spatrick 
9*061da546Spatrick #include "ProcessGDBRemoteLog.h"
10*061da546Spatrick #include "ProcessGDBRemote.h"
11*061da546Spatrick #include "llvm/Support/Threading.h"
12*061da546Spatrick 
13*061da546Spatrick using namespace lldb;
14*061da546Spatrick using namespace lldb_private;
15*061da546Spatrick using namespace lldb_private::process_gdb_remote;
16*061da546Spatrick 
17*061da546Spatrick static constexpr Log::Category g_categories[] = {
18*061da546Spatrick     {{"async"}, {"log asynchronous activity"}, GDBR_LOG_ASYNC},
19*061da546Spatrick     {{"break"}, {"log breakpoints"}, GDBR_LOG_BREAKPOINTS},
20*061da546Spatrick     {{"comm"}, {"log communication activity"}, GDBR_LOG_COMM},
21*061da546Spatrick     {{"packets"}, {"log gdb remote packets"}, GDBR_LOG_PACKETS},
22*061da546Spatrick     {{"memory"}, {"log memory reads and writes"}, GDBR_LOG_MEMORY},
23*061da546Spatrick     {{"data-short"},
24*061da546Spatrick      {"log memory bytes for memory reads and writes for short transactions "
25*061da546Spatrick       "only"},
26*061da546Spatrick      GDBR_LOG_MEMORY_DATA_SHORT},
27*061da546Spatrick     {{"data-long"},
28*061da546Spatrick      {"log memory bytes for memory reads and writes for all transactions"},
29*061da546Spatrick      GDBR_LOG_MEMORY_DATA_LONG},
30*061da546Spatrick     {{"process"}, {"log process events and activities"}, GDBR_LOG_PROCESS},
31*061da546Spatrick     {{"step"}, {"log step related activities"}, GDBR_LOG_STEP},
32*061da546Spatrick     {{"thread"}, {"log thread events and activities"}, GDBR_LOG_THREAD},
33*061da546Spatrick     {{"watch"}, {"log watchpoint related activities"}, GDBR_LOG_WATCHPOINTS},
34*061da546Spatrick };
35*061da546Spatrick 
36*061da546Spatrick Log::Channel ProcessGDBRemoteLog::g_channel(g_categories, GDBR_LOG_DEFAULT);
37*061da546Spatrick 
38*061da546Spatrick void ProcessGDBRemoteLog::Initialize() {
39*061da546Spatrick   static llvm::once_flag g_once_flag;
40*061da546Spatrick   llvm::call_once(g_once_flag, []() {
41*061da546Spatrick     Log::Register("gdb-remote", g_channel);
42*061da546Spatrick   });
43*061da546Spatrick }
44