xref: /freebsd-src/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (revision 5ffd83dbcc34f10e07f6d3e968ae6365869615f4)
1*5ffd83dbSDimitry Andric //===-- ProcessGDBRemoteLog.cpp -------------------------------------------===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #include "ProcessGDBRemoteLog.h"
100b57cec5SDimitry Andric #include "ProcessGDBRemote.h"
110b57cec5SDimitry Andric #include "llvm/Support/Threading.h"
120b57cec5SDimitry Andric 
130b57cec5SDimitry Andric using namespace lldb;
140b57cec5SDimitry Andric using namespace lldb_private;
150b57cec5SDimitry Andric using namespace lldb_private::process_gdb_remote;
160b57cec5SDimitry Andric 
170b57cec5SDimitry Andric static constexpr Log::Category g_categories[] = {
180b57cec5SDimitry Andric     {{"async"}, {"log asynchronous activity"}, GDBR_LOG_ASYNC},
190b57cec5SDimitry Andric     {{"break"}, {"log breakpoints"}, GDBR_LOG_BREAKPOINTS},
200b57cec5SDimitry Andric     {{"comm"}, {"log communication activity"}, GDBR_LOG_COMM},
210b57cec5SDimitry Andric     {{"packets"}, {"log gdb remote packets"}, GDBR_LOG_PACKETS},
220b57cec5SDimitry Andric     {{"memory"}, {"log memory reads and writes"}, GDBR_LOG_MEMORY},
230b57cec5SDimitry Andric     {{"data-short"},
240b57cec5SDimitry Andric      {"log memory bytes for memory reads and writes for short transactions "
250b57cec5SDimitry Andric       "only"},
260b57cec5SDimitry Andric      GDBR_LOG_MEMORY_DATA_SHORT},
270b57cec5SDimitry Andric     {{"data-long"},
280b57cec5SDimitry Andric      {"log memory bytes for memory reads and writes for all transactions"},
290b57cec5SDimitry Andric      GDBR_LOG_MEMORY_DATA_LONG},
300b57cec5SDimitry Andric     {{"process"}, {"log process events and activities"}, GDBR_LOG_PROCESS},
310b57cec5SDimitry Andric     {{"step"}, {"log step related activities"}, GDBR_LOG_STEP},
320b57cec5SDimitry Andric     {{"thread"}, {"log thread events and activities"}, GDBR_LOG_THREAD},
330b57cec5SDimitry Andric     {{"watch"}, {"log watchpoint related activities"}, GDBR_LOG_WATCHPOINTS},
340b57cec5SDimitry Andric };
350b57cec5SDimitry Andric 
360b57cec5SDimitry Andric Log::Channel ProcessGDBRemoteLog::g_channel(g_categories, GDBR_LOG_DEFAULT);
370b57cec5SDimitry Andric 
380b57cec5SDimitry Andric void ProcessGDBRemoteLog::Initialize() {
390b57cec5SDimitry Andric   static llvm::once_flag g_once_flag;
400b57cec5SDimitry Andric   llvm::call_once(g_once_flag, []() {
410b57cec5SDimitry Andric     Log::Register("gdb-remote", g_channel);
420b57cec5SDimitry Andric   });
430b57cec5SDimitry Andric }
44