1*81ad6265SDimitry Andric //===-- LLDBLog.cpp -------------------------------------------------------===// 2*81ad6265SDimitry Andric // 3*81ad6265SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*81ad6265SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*81ad6265SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*81ad6265SDimitry Andric // 7*81ad6265SDimitry Andric //===----------------------------------------------------------------------===// 8*81ad6265SDimitry Andric 9*81ad6265SDimitry Andric #include "lldb/Utility/LLDBLog.h" 10*81ad6265SDimitry Andric #include "lldb/Utility/Log.h" 11*81ad6265SDimitry Andric #include "llvm/ADT/ArrayRef.h" 12*81ad6265SDimitry Andric #include <cstdarg> 13*81ad6265SDimitry Andric 14*81ad6265SDimitry Andric using namespace lldb_private; 15*81ad6265SDimitry Andric 16*81ad6265SDimitry Andric static constexpr Log::Category g_categories[] = { 17*81ad6265SDimitry Andric {{"api"}, {"log API calls and return values"}, LLDBLog::API}, 18*81ad6265SDimitry Andric {{"ast"}, {"log AST"}, LLDBLog::AST}, 19*81ad6265SDimitry Andric {{"break"}, {"log breakpoints"}, LLDBLog::Breakpoints}, 20*81ad6265SDimitry Andric {{"commands"}, {"log command argument parsing"}, LLDBLog::Commands}, 21*81ad6265SDimitry Andric {{"comm"}, {"log communication activities"}, LLDBLog::Communication}, 22*81ad6265SDimitry Andric {{"conn"}, {"log connection details"}, LLDBLog::Connection}, 23*81ad6265SDimitry Andric {{"demangle"}, 24*81ad6265SDimitry Andric {"log mangled names to catch demangler crashes"}, 25*81ad6265SDimitry Andric LLDBLog::Demangle}, 26*81ad6265SDimitry Andric {{"dyld"}, 27*81ad6265SDimitry Andric {"log shared library related activities"}, 28*81ad6265SDimitry Andric LLDBLog::DynamicLoader}, 29*81ad6265SDimitry Andric {{"event"}, 30*81ad6265SDimitry Andric {"log broadcaster, listener and event queue activities"}, 31*81ad6265SDimitry Andric LLDBLog::Events}, 32*81ad6265SDimitry Andric {{"expr"}, {"log expressions"}, LLDBLog::Expressions}, 33*81ad6265SDimitry Andric {{"formatters"}, 34*81ad6265SDimitry Andric {"log data formatters related activities"}, 35*81ad6265SDimitry Andric LLDBLog::DataFormatters}, 36*81ad6265SDimitry Andric {{"host"}, {"log host activities"}, LLDBLog::Host}, 37*81ad6265SDimitry Andric {{"jit"}, {"log JIT events in the target"}, LLDBLog::JITLoader}, 38*81ad6265SDimitry Andric {{"language"}, {"log language runtime events"}, LLDBLog::Language}, 39*81ad6265SDimitry Andric {{"mmap"}, {"log mmap related activities"}, LLDBLog::MMap}, 40*81ad6265SDimitry Andric {{"module"}, 41*81ad6265SDimitry Andric {"log module activities such as when modules are created, destroyed, " 42*81ad6265SDimitry Andric "replaced, and more"}, 43*81ad6265SDimitry Andric LLDBLog::Modules}, 44*81ad6265SDimitry Andric {{"object"}, 45*81ad6265SDimitry Andric {"log object construction/destruction for important objects"}, 46*81ad6265SDimitry Andric LLDBLog::Object}, 47*81ad6265SDimitry Andric {{"os"}, {"log OperatingSystem plugin related activities"}, LLDBLog::OS}, 48*81ad6265SDimitry Andric {{"platform"}, {"log platform events and activities"}, LLDBLog::Platform}, 49*81ad6265SDimitry Andric {{"process"}, {"log process events and activities"}, LLDBLog::Process}, 50*81ad6265SDimitry Andric {{"script"}, {"log events about the script interpreter"}, LLDBLog::Script}, 51*81ad6265SDimitry Andric {{"state"}, 52*81ad6265SDimitry Andric {"log private and public process state changes"}, 53*81ad6265SDimitry Andric LLDBLog::State}, 54*81ad6265SDimitry Andric {{"step"}, {"log step related activities"}, LLDBLog::Step}, 55*81ad6265SDimitry Andric {{"symbol"}, {"log symbol related issues and warnings"}, LLDBLog::Symbols}, 56*81ad6265SDimitry Andric {{"system-runtime"}, {"log system runtime events"}, LLDBLog::SystemRuntime}, 57*81ad6265SDimitry Andric {{"target"}, {"log target events and activities"}, LLDBLog::Target}, 58*81ad6265SDimitry Andric {{"temp"}, {"log internal temporary debug messages"}, LLDBLog::Temporary}, 59*81ad6265SDimitry Andric {{"thread"}, {"log thread events and activities"}, LLDBLog::Thread}, 60*81ad6265SDimitry Andric {{"types"}, {"log type system related activities"}, LLDBLog::Types}, 61*81ad6265SDimitry Andric {{"unwind"}, {"log stack unwind activities"}, LLDBLog::Unwind}, 62*81ad6265SDimitry Andric {{"watch"}, {"log watchpoint related activities"}, LLDBLog::Watchpoints}, 63*81ad6265SDimitry Andric {{"on-demand"}, 64*81ad6265SDimitry Andric {"log symbol on-demand related activities"}, 65*81ad6265SDimitry Andric LLDBLog::OnDemand}, 66*81ad6265SDimitry Andric }; 67*81ad6265SDimitry Andric 68*81ad6265SDimitry Andric static Log::Channel g_log_channel(g_categories, 69*81ad6265SDimitry Andric LLDBLog::Process | LLDBLog::Thread | 70*81ad6265SDimitry Andric LLDBLog::DynamicLoader | 71*81ad6265SDimitry Andric LLDBLog::Breakpoints | 72*81ad6265SDimitry Andric LLDBLog::Watchpoints | LLDBLog::Step | 73*81ad6265SDimitry Andric LLDBLog::State | LLDBLog::Symbols | 74*81ad6265SDimitry Andric LLDBLog::Target | LLDBLog::Commands); 75*81ad6265SDimitry Andric 76*81ad6265SDimitry Andric template <> Log::Channel &lldb_private::LogChannelFor<LLDBLog>() { 77*81ad6265SDimitry Andric return g_log_channel; 78*81ad6265SDimitry Andric } 79*81ad6265SDimitry Andric 80*81ad6265SDimitry Andric void lldb_private::InitializeLldbChannel() { 81*81ad6265SDimitry Andric Log::Register("lldb", g_log_channel); 82*81ad6265SDimitry Andric } 83