1 //===-- ProcessGDBRemoteLog.cpp ---------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "ProcessGDBRemoteLog.h"
11 #include "ProcessGDBRemote.h"
12 #include "llvm/Support/Threading.h"
13
14 using namespace lldb;
15 using namespace lldb_private;
16 using namespace lldb_private::process_gdb_remote;
17
18 static constexpr Log::Category g_categories[] = {
19 {{"async"}, {"log asynchronous activity"}, GDBR_LOG_ASYNC},
20 {{"break"}, {"log breakpoints"}, GDBR_LOG_BREAKPOINTS},
21 {{"comm"}, {"log communication activity"}, GDBR_LOG_COMM},
22 {{"packets"}, {"log gdb remote packets"}, GDBR_LOG_PACKETS},
23 {{"memory"}, {"log memory reads and writes"}, GDBR_LOG_MEMORY},
24 {{"data-short"},
25 {"log memory bytes for memory reads and writes for short transactions "
26 "only"},
27 GDBR_LOG_MEMORY_DATA_SHORT},
28 {{"data-long"},
29 {"log memory bytes for memory reads and writes for all transactions"},
30 GDBR_LOG_MEMORY_DATA_LONG},
31 {{"process"}, {"log process events and activities"}, GDBR_LOG_PROCESS},
32 {{"step"}, {"log step related activities"}, GDBR_LOG_STEP},
33 {{"thread"}, {"log thread events and activities"}, GDBR_LOG_THREAD},
34 {{"watch"}, {"log watchpoint related activities"}, GDBR_LOG_WATCHPOINTS},
35 };
36
37 Log::Channel ProcessGDBRemoteLog::g_channel(g_categories, GDBR_LOG_DEFAULT);
38
Initialize()39 void ProcessGDBRemoteLog::Initialize() {
40 static llvm::once_flag g_once_flag;
41 llvm::call_once(g_once_flag, []() {
42 Log::Register("gdb-remote", g_channel);
43 });
44 }
45