xref: /freebsd-src/contrib/llvm-project/lldb/source/Utility/LLDBLog.cpp (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
181ad6265SDimitry Andric //===-- LLDBLog.cpp -------------------------------------------------------===//
281ad6265SDimitry Andric //
381ad6265SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
481ad6265SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
581ad6265SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
681ad6265SDimitry Andric //
781ad6265SDimitry Andric //===----------------------------------------------------------------------===//
881ad6265SDimitry Andric 
981ad6265SDimitry Andric #include "lldb/Utility/LLDBLog.h"
1081ad6265SDimitry Andric #include "lldb/Utility/Log.h"
1181ad6265SDimitry Andric #include "llvm/ADT/ArrayRef.h"
1281ad6265SDimitry Andric #include <cstdarg>
1381ad6265SDimitry Andric 
1481ad6265SDimitry Andric using namespace lldb_private;
1581ad6265SDimitry Andric 
1681ad6265SDimitry Andric static constexpr Log::Category g_categories[] = {
1781ad6265SDimitry Andric     {{"api"}, {"log API calls and return values"}, LLDBLog::API},
1881ad6265SDimitry Andric     {{"ast"}, {"log AST"}, LLDBLog::AST},
1981ad6265SDimitry Andric     {{"break"}, {"log breakpoints"}, LLDBLog::Breakpoints},
2081ad6265SDimitry Andric     {{"commands"}, {"log command argument parsing"}, LLDBLog::Commands},
2181ad6265SDimitry Andric     {{"comm"}, {"log communication activities"}, LLDBLog::Communication},
2281ad6265SDimitry Andric     {{"conn"}, {"log connection details"}, LLDBLog::Connection},
2381ad6265SDimitry Andric     {{"demangle"},
2481ad6265SDimitry Andric      {"log mangled names to catch demangler crashes"},
2581ad6265SDimitry Andric      LLDBLog::Demangle},
2681ad6265SDimitry Andric     {{"dyld"},
2781ad6265SDimitry Andric      {"log shared library related activities"},
2881ad6265SDimitry Andric      LLDBLog::DynamicLoader},
2981ad6265SDimitry Andric     {{"event"},
3081ad6265SDimitry Andric      {"log broadcaster, listener and event queue activities"},
3181ad6265SDimitry Andric      LLDBLog::Events},
3281ad6265SDimitry Andric     {{"expr"}, {"log expressions"}, LLDBLog::Expressions},
3381ad6265SDimitry Andric     {{"formatters"},
3481ad6265SDimitry Andric      {"log data formatters related activities"},
3581ad6265SDimitry Andric      LLDBLog::DataFormatters},
3681ad6265SDimitry Andric     {{"host"}, {"log host activities"}, LLDBLog::Host},
3781ad6265SDimitry Andric     {{"jit"}, {"log JIT events in the target"}, LLDBLog::JITLoader},
3881ad6265SDimitry Andric     {{"language"}, {"log language runtime events"}, LLDBLog::Language},
3981ad6265SDimitry Andric     {{"mmap"}, {"log mmap related activities"}, LLDBLog::MMap},
4081ad6265SDimitry Andric     {{"module"},
4181ad6265SDimitry Andric      {"log module activities such as when modules are created, destroyed, "
4281ad6265SDimitry Andric       "replaced, and more"},
4381ad6265SDimitry Andric      LLDBLog::Modules},
4481ad6265SDimitry Andric     {{"object"},
4581ad6265SDimitry Andric      {"log object construction/destruction for important objects"},
4681ad6265SDimitry Andric      LLDBLog::Object},
4781ad6265SDimitry Andric     {{"os"}, {"log OperatingSystem plugin related activities"}, LLDBLog::OS},
4881ad6265SDimitry Andric     {{"platform"}, {"log platform events and activities"}, LLDBLog::Platform},
4981ad6265SDimitry Andric     {{"process"}, {"log process events and activities"}, LLDBLog::Process},
5081ad6265SDimitry Andric     {{"script"}, {"log events about the script interpreter"}, LLDBLog::Script},
5181ad6265SDimitry Andric     {{"state"},
5281ad6265SDimitry Andric      {"log private and public process state changes"},
5381ad6265SDimitry Andric      LLDBLog::State},
5481ad6265SDimitry Andric     {{"step"}, {"log step related activities"}, LLDBLog::Step},
5581ad6265SDimitry Andric     {{"symbol"}, {"log symbol related issues and warnings"}, LLDBLog::Symbols},
5681ad6265SDimitry Andric     {{"system-runtime"}, {"log system runtime events"}, LLDBLog::SystemRuntime},
5781ad6265SDimitry Andric     {{"target"}, {"log target events and activities"}, LLDBLog::Target},
5881ad6265SDimitry Andric     {{"temp"}, {"log internal temporary debug messages"}, LLDBLog::Temporary},
5981ad6265SDimitry Andric     {{"thread"}, {"log thread events and activities"}, LLDBLog::Thread},
6081ad6265SDimitry Andric     {{"types"}, {"log type system related activities"}, LLDBLog::Types},
6181ad6265SDimitry Andric     {{"unwind"}, {"log stack unwind activities"}, LLDBLog::Unwind},
6281ad6265SDimitry Andric     {{"watch"}, {"log watchpoint related activities"}, LLDBLog::Watchpoints},
6381ad6265SDimitry Andric     {{"on-demand"},
6481ad6265SDimitry Andric      {"log symbol on-demand related activities"},
6581ad6265SDimitry Andric      LLDBLog::OnDemand},
66*06c3fb27SDimitry Andric     {{"source"}, {"log source related activities"}, LLDBLog::Source},
6781ad6265SDimitry Andric };
6881ad6265SDimitry Andric 
6981ad6265SDimitry Andric static Log::Channel g_log_channel(g_categories,
7081ad6265SDimitry Andric                                   LLDBLog::Process | LLDBLog::Thread |
7181ad6265SDimitry Andric                                       LLDBLog::DynamicLoader |
7281ad6265SDimitry Andric                                       LLDBLog::Breakpoints |
7381ad6265SDimitry Andric                                       LLDBLog::Watchpoints | LLDBLog::Step |
7481ad6265SDimitry Andric                                       LLDBLog::State | LLDBLog::Symbols |
7581ad6265SDimitry Andric                                       LLDBLog::Target | LLDBLog::Commands);
7681ad6265SDimitry Andric 
LogChannelFor()7781ad6265SDimitry Andric template <> Log::Channel &lldb_private::LogChannelFor<LLDBLog>() {
7881ad6265SDimitry Andric   return g_log_channel;
7981ad6265SDimitry Andric }
8081ad6265SDimitry Andric 
InitializeLldbChannel()8181ad6265SDimitry Andric void lldb_private::InitializeLldbChannel() {
8281ad6265SDimitry Andric   Log::Register("lldb", g_log_channel);
8381ad6265SDimitry Andric }
84