LLDB  mainline
Logging.cpp
Go to the documentation of this file.
1 //===-- Logging.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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "lldb/Utility/Logging.h"
10 #include "lldb/Utility/Log.h"
11 
12 #include "llvm/ADT/ArrayRef.h"
13 
14 #include <cstdarg>
15 
16 using namespace lldb_private;
17 
18 static constexpr Log::Category g_categories[] = {
19  {{"api"}, {"log API calls and return values"}, LIBLLDB_LOG_API},
20  {{"ast"}, {"log AST"}, LIBLLDB_LOG_AST},
21  {{"break"}, {"log breakpoints"}, LIBLLDB_LOG_BREAKPOINTS},
22  {{"commands"}, {"log command argument parsing"}, LIBLLDB_LOG_COMMANDS},
23  {{"comm"}, {"log communication activities"}, LIBLLDB_LOG_COMMUNICATION},
24  {{"conn"}, {"log connection details"}, LIBLLDB_LOG_CONNECTION},
25  {{"demangle"}, {"log mangled names to catch demangler crashes"}, LIBLLDB_LOG_DEMANGLE},
26  {{"dyld"}, {"log shared library related activities"}, LIBLLDB_LOG_DYNAMIC_LOADER},
27  {{"event"}, {"log broadcaster, listener and event queue activities"}, LIBLLDB_LOG_EVENTS},
28  {{"expr"}, {"log expressions"}, LIBLLDB_LOG_EXPRESSIONS},
29  {{"formatters"}, {"log data formatters related activities"}, LIBLLDB_LOG_DATAFORMATTERS},
30  {{"host"}, {"log host activities"}, LIBLLDB_LOG_HOST},
31  {{"jit"}, {"log JIT events in the target"}, LIBLLDB_LOG_JIT_LOADER},
32  {{"language"}, {"log language runtime events"}, LIBLLDB_LOG_LANGUAGE},
33  {{"mmap"}, {"log mmap related activities"}, LIBLLDB_LOG_MMAP},
34  {{"module"}, {"log module activities such as when modules are created, destroyed, replaced, and more"}, LIBLLDB_LOG_MODULES},
35  {{"object"}, {"log object construction/destruction for important objects"}, LIBLLDB_LOG_OBJECT},
36  {{"os"}, {"log OperatingSystem plugin related activities"}, LIBLLDB_LOG_OS},
37  {{"platform"}, {"log platform events and activities"}, LIBLLDB_LOG_PLATFORM},
38  {{"process"}, {"log process events and activities"}, LIBLLDB_LOG_PROCESS},
39  {{"script"}, {"log events about the script interpreter"}, LIBLLDB_LOG_SCRIPT},
40  {{"state"}, {"log private and public process state changes"}, LIBLLDB_LOG_STATE},
41  {{"step"}, {"log step related activities"}, LIBLLDB_LOG_STEP},
42  {{"symbol"}, {"log symbol related issues and warnings"}, LIBLLDB_LOG_SYMBOLS},
43  {{"system-runtime"}, {"log system runtime events"}, LIBLLDB_LOG_SYSTEM_RUNTIME},
44  {{"target"}, {"log target events and activities"}, LIBLLDB_LOG_TARGET},
45  {{"temp"}, {"log internal temporary debug messages"}, LIBLLDB_LOG_TEMPORARY},
46  {{"thread"}, {"log thread events and activities"}, LIBLLDB_LOG_THREAD},
47  {{"types"}, {"log type system related activities"}, LIBLLDB_LOG_TYPES},
48  {{"unwind"}, {"log stack unwind activities"}, LIBLLDB_LOG_UNWIND},
49  {{"watch"}, {"log watchpoint related activities"}, LIBLLDB_LOG_WATCHPOINTS},
50 };
51 
53 
56 }
57 
59  return g_log_channel.GetLogIfAll(mask);
60 }
61 
63  return g_log_channel.GetLogIfAny(mask);
64 }
g_categories
static constexpr Log::Category g_categories[]
Definition: Logging.cpp:18
lldb_private::Log::Channel::GetLogIfAll
Log * GetLogIfAll(uint32_t mask)
Definition: Log.h:77
LIBLLDB_LOG_DYNAMIC_LOADER
#define LIBLLDB_LOG_DYNAMIC_LOADER
Definition: Logging.h:17
LIBLLDB_LOG_TARGET
#define LIBLLDB_LOG_TARGET
Definition: Logging.h:36
LIBLLDB_LOG_MODULES
#define LIBLLDB_LOG_MODULES
Definition: Logging.h:35
LIBLLDB_LOG_COMMANDS
#define LIBLLDB_LOG_COMMANDS
Definition: Logging.h:32
lldb_private::Log::Register
static void Register(llvm::StringRef name, Channel &channel)
Definition: Log.cpp:189
LIBLLDB_LOG_API
#define LIBLLDB_LOG_API
Definition: Logging.h:30
LIBLLDB_LOG_JIT_LOADER
#define LIBLLDB_LOG_JIT_LOADER
Definition: Logging.h:41
LIBLLDB_LOG_DEMANGLE
#define LIBLLDB_LOG_DEMANGLE
Definition: Logging.h:44
LIBLLDB_LOG_DEFAULT
#define LIBLLDB_LOG_DEFAULT
Definition: Logging.h:47
LIBLLDB_LOG_TEMPORARY
#define LIBLLDB_LOG_TEMPORARY
Definition: Logging.h:23
LIBLLDB_LOG_PLATFORM
#define LIBLLDB_LOG_PLATFORM
Definition: Logging.h:39
LIBLLDB_LOG_WATCHPOINTS
#define LIBLLDB_LOG_WATCHPOINTS
Definition: Logging.h:20
LIBLLDB_LOG_SYSTEM_RUNTIME
#define LIBLLDB_LOG_SYSTEM_RUNTIME
Definition: Logging.h:40
lldb_private::InitializeLldbChannel
void InitializeLldbChannel()
Definition: Logging.cpp:54
LIBLLDB_LOG_EVENTS
#define LIBLLDB_LOG_EVENTS
Definition: Logging.h:18
LIBLLDB_LOG_OS
#define LIBLLDB_LOG_OS
Definition: Logging.h:38
LIBLLDB_LOG_SYMBOLS
#define LIBLLDB_LOG_SYMBOLS
Definition: Logging.h:34
LIBLLDB_LOG_STATE
#define LIBLLDB_LOG_STATE
Definition: Logging.h:24
LIBLLDB_LOG_HOST
#define LIBLLDB_LOG_HOST
Definition: Logging.h:28
LIBLLDB_LOG_EXPRESSIONS
#define LIBLLDB_LOG_EXPRESSIONS
Definition: Logging.h:22
lldb_private::Log::Category
Definition: Log.h:52
LIBLLDB_LOG_LANGUAGE
#define LIBLLDB_LOG_LANGUAGE
Definition: Logging.h:42
LIBLLDB_LOG_AST
#define LIBLLDB_LOG_AST
Definition: Logging.h:45
LIBLLDB_LOG_COMMUNICATION
#define LIBLLDB_LOG_COMMUNICATION
Definition: Logging.h:26
Log.h
g_log_channel
static Log::Channel g_log_channel(g_categories, LIBLLDB_LOG_DEFAULT)
LIBLLDB_LOG_TYPES
#define LIBLLDB_LOG_TYPES
Definition: Logging.h:33
lldb_private::GetLogIfAllCategoriesSet
Log * GetLogIfAllCategoriesSet(uint32_t mask)
Definition: Logging.cpp:58
LIBLLDB_LOG_DATAFORMATTERS
#define LIBLLDB_LOG_DATAFORMATTERS
Definition: Logging.h:43
LIBLLDB_LOG_MMAP
#define LIBLLDB_LOG_MMAP
Definition: Logging.h:37
lldb_private::Log::Channel
Definition: Log.h:60
LIBLLDB_LOG_OBJECT
#define LIBLLDB_LOG_OBJECT
Definition: Logging.h:25
uint32_t
LIBLLDB_LOG_BREAKPOINTS
#define LIBLLDB_LOG_BREAKPOINTS
Definition: Logging.h:19
LIBLLDB_LOG_SCRIPT
#define LIBLLDB_LOG_SCRIPT
Definition: Logging.h:31
LIBLLDB_LOG_CONNECTION
#define LIBLLDB_LOG_CONNECTION
Definition: Logging.h:27
lldb_private::Log::Channel::GetLogIfAny
Log * GetLogIfAny(uint32_t mask)
Definition: Log.h:88
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
LIBLLDB_LOG_STEP
#define LIBLLDB_LOG_STEP
Definition: Logging.h:21
Logging.h
lldb_private::Log
Definition: Log.h:49
lldb_private::GetLogIfAnyCategoriesSet
Log * GetLogIfAnyCategoriesSet(uint32_t mask)
Definition: Logging.cpp:62
LIBLLDB_LOG_PROCESS
#define LIBLLDB_LOG_PROCESS
Definition: Logging.h:15
LIBLLDB_LOG_THREAD
#define LIBLLDB_LOG_THREAD
Definition: Logging.h:16
LIBLLDB_LOG_UNWIND
#define LIBLLDB_LOG_UNWIND
Definition: Logging.h:29