
This diff introduces a new symbol on-demand which skips loading a module's debug info unless explicitly asked on demand. This provides significant performance improvement for application with dynamic linking mode which has large number of modules. The feature can be turned on with: "settings set symbols.load-on-demand true" The feature works by creating a new SymbolFileOnDemand class for each module which wraps the actual SymbolFIle subclass as member variable. By default, most virtual methods on SymbolFileOnDemand are skipped so that it looks like there is no debug info for that module. But once the module's debug info is explicitly requested to be enabled (in the conditions mentioned below) SymbolFileOnDemand will allow all methods to pass through and forward to the actual SymbolFile which would hydrate module's debug info on-demand. In an internal benchmark, we are seeing more than 95% improvement for a 3000 modules application. Currently we are providing several ways to on demand hydrate a module's debug info: * Source line breakpoint: matching in supported files * Stack trace: resolving symbol context for an address * Symbolic breakpoint: symbol table match guided promotion * Global variable: symbol table match guided promotion In all above situations the module's debug info will be on-demand parsed and indexed. Some follow-ups for this feature: * Add a command that allows users to load debug info explicitly while using a new or existing command when this feature is enabled * Add settings for "never load any of these executables in Symbols On Demand" that takes a list of globs * Add settings for "always load the the debug info for executables in Symbols On Demand" that takes a list of globs * Add a new column in "image list" that shows up by default when Symbols On Demand is enable to show the status for each shlib like "not enabled for this", "debug info off" and "debug info on" (with a single character to short string, not the ones I just typed) Differential Revision: https://reviews.llvm.org/D121631
83 lines
3.7 KiB
C++
83 lines
3.7 KiB
C++
//===-- LLDBLog.cpp -------------------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "lldb/Utility/LLDBLog.h"
|
|
#include "lldb/Utility/Log.h"
|
|
#include "llvm/ADT/ArrayRef.h"
|
|
#include <cstdarg>
|
|
|
|
using namespace lldb_private;
|
|
|
|
static constexpr Log::Category g_categories[] = {
|
|
{{"api"}, {"log API calls and return values"}, LLDBLog::API},
|
|
{{"ast"}, {"log AST"}, LLDBLog::AST},
|
|
{{"break"}, {"log breakpoints"}, LLDBLog::Breakpoints},
|
|
{{"commands"}, {"log command argument parsing"}, LLDBLog::Commands},
|
|
{{"comm"}, {"log communication activities"}, LLDBLog::Communication},
|
|
{{"conn"}, {"log connection details"}, LLDBLog::Connection},
|
|
{{"demangle"},
|
|
{"log mangled names to catch demangler crashes"},
|
|
LLDBLog::Demangle},
|
|
{{"dyld"},
|
|
{"log shared library related activities"},
|
|
LLDBLog::DynamicLoader},
|
|
{{"event"},
|
|
{"log broadcaster, listener and event queue activities"},
|
|
LLDBLog::Events},
|
|
{{"expr"}, {"log expressions"}, LLDBLog::Expressions},
|
|
{{"formatters"},
|
|
{"log data formatters related activities"},
|
|
LLDBLog::DataFormatters},
|
|
{{"host"}, {"log host activities"}, LLDBLog::Host},
|
|
{{"jit"}, {"log JIT events in the target"}, LLDBLog::JITLoader},
|
|
{{"language"}, {"log language runtime events"}, LLDBLog::Language},
|
|
{{"mmap"}, {"log mmap related activities"}, LLDBLog::MMap},
|
|
{{"module"},
|
|
{"log module activities such as when modules are created, destroyed, "
|
|
"replaced, and more"},
|
|
LLDBLog::Modules},
|
|
{{"object"},
|
|
{"log object construction/destruction for important objects"},
|
|
LLDBLog::Object},
|
|
{{"os"}, {"log OperatingSystem plugin related activities"}, LLDBLog::OS},
|
|
{{"platform"}, {"log platform events and activities"}, LLDBLog::Platform},
|
|
{{"process"}, {"log process events and activities"}, LLDBLog::Process},
|
|
{{"script"}, {"log events about the script interpreter"}, LLDBLog::Script},
|
|
{{"state"},
|
|
{"log private and public process state changes"},
|
|
LLDBLog::State},
|
|
{{"step"}, {"log step related activities"}, LLDBLog::Step},
|
|
{{"symbol"}, {"log symbol related issues and warnings"}, LLDBLog::Symbols},
|
|
{{"system-runtime"}, {"log system runtime events"}, LLDBLog::SystemRuntime},
|
|
{{"target"}, {"log target events and activities"}, LLDBLog::Target},
|
|
{{"temp"}, {"log internal temporary debug messages"}, LLDBLog::Temporary},
|
|
{{"thread"}, {"log thread events and activities"}, LLDBLog::Thread},
|
|
{{"types"}, {"log type system related activities"}, LLDBLog::Types},
|
|
{{"unwind"}, {"log stack unwind activities"}, LLDBLog::Unwind},
|
|
{{"watch"}, {"log watchpoint related activities"}, LLDBLog::Watchpoints},
|
|
{{"on-demand"},
|
|
{"log symbol on-demand related activities"},
|
|
LLDBLog::OnDemand},
|
|
};
|
|
|
|
static Log::Channel g_log_channel(g_categories,
|
|
LLDBLog::Process | LLDBLog::Thread |
|
|
LLDBLog::DynamicLoader |
|
|
LLDBLog::Breakpoints |
|
|
LLDBLog::Watchpoints | LLDBLog::Step |
|
|
LLDBLog::State | LLDBLog::Symbols |
|
|
LLDBLog::Target | LLDBLog::Commands);
|
|
|
|
template <> Log::Channel &lldb_private::LogChannelFor<LLDBLog>() {
|
|
return g_log_channel;
|
|
}
|
|
|
|
void lldb_private::InitializeLldbChannel() {
|
|
Log::Register("lldb", g_log_channel);
|
|
}
|