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