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