15ffd83dbSDimitry 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[] = {
18*04eeddc0SDimitry Andric {{"async"}, {"log asynchronous activity"}, GDBRLog::Async},
19*04eeddc0SDimitry Andric {{"break"}, {"log breakpoints"}, GDBRLog::Breakpoints},
20*04eeddc0SDimitry Andric {{"comm"}, {"log communication activity"}, GDBRLog::Comm},
21*04eeddc0SDimitry Andric {{"packets"}, {"log gdb remote packets"}, GDBRLog::Packets},
22*04eeddc0SDimitry Andric {{"memory"}, {"log memory reads and writes"}, GDBRLog::Memory},
230b57cec5SDimitry Andric {{"data-short"},
240b57cec5SDimitry Andric {"log memory bytes for memory reads and writes for short transactions "
250b57cec5SDimitry Andric "only"},
26*04eeddc0SDimitry Andric GDBRLog::MemoryDataShort},
270b57cec5SDimitry Andric {{"data-long"},
280b57cec5SDimitry Andric {"log memory bytes for memory reads and writes for all transactions"},
29*04eeddc0SDimitry Andric GDBRLog::MemoryDataLong},
30*04eeddc0SDimitry Andric {{"process"}, {"log process events and activities"}, GDBRLog::Process},
31*04eeddc0SDimitry Andric {{"step"}, {"log step related activities"}, GDBRLog::Step},
32*04eeddc0SDimitry Andric {{"thread"}, {"log thread events and activities"}, GDBRLog::Thread},
33*04eeddc0SDimitry Andric {{"watch"}, {"log watchpoint related activities"}, GDBRLog::Watchpoints},
340b57cec5SDimitry Andric };
350b57cec5SDimitry Andric
36*04eeddc0SDimitry Andric static Log::Channel g_channel(g_categories, GDBRLog::Packets);
37*04eeddc0SDimitry Andric
LogChannelFor()38*04eeddc0SDimitry Andric template <> Log::Channel &lldb_private::LogChannelFor<GDBRLog>() {
39*04eeddc0SDimitry Andric return g_channel;
40*04eeddc0SDimitry Andric }
410b57cec5SDimitry Andric
Initialize()420b57cec5SDimitry Andric void ProcessGDBRemoteLog::Initialize() {
430b57cec5SDimitry Andric static llvm::once_flag g_once_flag;
440b57cec5SDimitry Andric llvm::call_once(g_once_flag, []() {
450b57cec5SDimitry Andric Log::Register("gdb-remote", g_channel);
460b57cec5SDimitry Andric });
470b57cec5SDimitry Andric }
48