LLDB
mainline
|
#include <Log.h>
Classes | |
struct | Category |
class | Channel |
Public Types | |
using | MaskType = uint64_t |
The underlying type of all log channel enums. More... | |
Public Member Functions | |
Log (Channel &channel) | |
~Log ()=default | |
void | PutCString (const char *cstr) |
void | PutString (llvm::StringRef str) |
template<typename... Args> | |
void | Format (llvm::StringRef file, llvm::StringRef function, const char *format, Args &&... args) |
template<typename... Args> | |
void | FormatError (llvm::Error error, llvm::StringRef file, llvm::StringRef function, const char *format, Args &&... args) |
void | Printf (const char *format,...) __attribute__((format(printf |
Prefer using LLDB_LOGF whenever possible. More... | |
void void | Error (const char *fmt,...) __attribute__((format(printf |
void void void | Verbose (const char *fmt,...) __attribute__((format(printf |
void void void void | Warning (const char *fmt,...) __attribute__((format(printf |
void void void void const Flags | GetOptions () const |
const Flags | GetMask () const |
bool | GetVerbose () const |
void | VAPrintf (const char *format, va_list args) |
void | VAError (const char *format, va_list args) |
Static Public Member Functions | |
static void | Register (llvm::StringRef name, Channel &channel) |
static void | Unregister (llvm::StringRef name) |
static bool | EnableLogChannel (const std::shared_ptr< LogHandler > &log_handler_sp, uint32_t log_options, llvm::StringRef channel, llvm::ArrayRef< const char * > categories, llvm::raw_ostream &error_stream) |
static bool | DisableLogChannel (llvm::StringRef channel, llvm::ArrayRef< const char * > categories, llvm::raw_ostream &error_stream) |
static bool | DumpLogChannel (llvm::StringRef channel, llvm::raw_ostream &output_stream, llvm::raw_ostream &error_stream) |
static bool | ListChannelCategories (llvm::StringRef channel, llvm::raw_ostream &stream) |
static std::vector< llvm::StringRef > | ListChannels () |
Returns the list of log channels. More... | |
static void | ForEachChannelCategory (llvm::StringRef channel, llvm::function_ref< void(llvm::StringRef, llvm::StringRef)> lambda) |
Calls the given lambda for every category in the given channel. More... | |
static void | DisableAllLogChannels () |
static void | ListAllLogChannels (llvm::raw_ostream &stream) |
Static Public Attributes | |
template<MaskType Bit> | |
static constexpr MaskType | ChannelFlag = MaskType(1) << Bit |
Private Types | |
typedef llvm::StringMap< Log > | ChannelMap |
Private Member Functions | |
void | WriteHeader (llvm::raw_ostream &OS, llvm::StringRef file, llvm::StringRef function) |
void | WriteMessage (const std::string &message) |
void | Format (llvm::StringRef file, llvm::StringRef function, const llvm::formatv_object_base &payload) |
std::shared_ptr< LogHandler > | GetHandler () |
void | Enable (const std::shared_ptr< LogHandler > &handler_sp, uint32_t options, uint32_t flags) |
void | Disable (uint32_t flags) |
bool | Dump (llvm::raw_ostream &stream) |
Log (const Log &)=delete | |
void | operator= (const Log &)=delete |
Static Private Member Functions | |
static void | ForEachCategory (const Log::ChannelMap::value_type &entry, llvm::function_ref< void(llvm::StringRef, llvm::StringRef)> lambda) |
static void | ListCategories (llvm::raw_ostream &stream, const ChannelMap::value_type &entry) |
static uint32_t | GetFlags (llvm::raw_ostream &stream, const ChannelMap::value_type &entry, llvm::ArrayRef< const char * > categories) |
Private Attributes | |
Channel & | m_channel |
llvm::sys::RWMutex | m_mutex |
std::shared_ptr< LogHandler > | m_handler |
std::atomic< uint32_t > | m_options {0} |
std::atomic< MaskType > | m_mask {0} |
Static Private Attributes | |
static llvm::ManagedStatic< ChannelMap > | g_channel_map |
|
private |
using lldb_private::Log::MaskType = uint64_t |
The underlying type of all log channel enums.
Declare them as: enum class MyLog : MaskType { Channel0 = Log::ChannelFlag<0>, Channel1 = Log::ChannelFlag<1>, ..., LLVM_MARK_AS_BITMASK_ENUM(LastChannel), };
|
default |
|
privatedelete |
|
private |
|
static |
Definition at line 268 of file Log.cpp.
References g_channel_map, and UINT32_MAX.
Referenced by lldb_private::SystemInitializerCommon::Terminate().
|
static |
Definition at line 226 of file Log.cpp.
References g_channel_map, GetFlags(), and UINT32_MAX.
|
private |
|
static |
Definition at line 241 of file Log.cpp.
References g_channel_map.
|
private |
|
static |
Definition at line 210 of file Log.cpp.
References g_channel_map, and GetFlags().
Referenced by lldb_private::Debugger::EnableLog().
void Log::Error | ( | const char * | fmt, |
... | |||
) |
Definition at line 161 of file Log.cpp.
References VAError().
Referenced by lldb_private::ThreadPlanNull::DoPlanExplainsStop(), lldb_private::ThreadPlanNull::GetPlanRunState(), lldb_private::ThreadPlanNull::MischiefManaged(), lldb_private::lldb_renderscript::RSModuleDescriptor::ParseExportReduceCount(), lldb_private::ThreadPlanNull::ShouldStop(), lldb_private::ThreadPlanNull::ValidatePlan(), and lldb_private::ThreadPlanNull::WillStop().
|
staticprivate |
Definition at line 45 of file Log.cpp.
Referenced by ForEachChannelCategory(), and ListCategories().
|
static |
Calls the given lambda for every category in the given channel.
If no channel with the given name exists, lambda is never called.
Definition at line 273 of file Log.cpp.
References ForEachCategory(), and g_channel_map.
|
inline |
Definition at line 221 of file Log.h.
Referenced by FormatError().
|
private |
Definition at line 355 of file Log.cpp.
References message(), string(), WriteHeader(), and WriteMessage().
|
inline |
Definition at line 227 of file Log.h.
References error(), Format(), and lldb_private::toString().
|
staticprivate |
Definition at line 63 of file Log.cpp.
References ListCategories(), and UINT32_MAX.
Referenced by DisableLogChannel(), and EnableLogChannel().
|
inlineprivate |
Definition at line 273 of file Log.h.
References m_handler, and m_mutex.
Referenced by WriteMessage().
const Flags Log::GetMask | ( | ) | const |
Definition at line 129 of file Log.cpp.
References m_mask.
Referenced by lldb_private::Log::Channel::GetLog().
const Flags Log::GetOptions | ( | ) | const |
bool Log::GetVerbose | ( | ) | const |
Definition at line 300 of file Log.cpp.
References LLDB_LOG_OPTION_VERBOSE, and m_options.
Referenced by CommunicationKDP::CheckForPacket(), lldb_private::process_gdb_remote::GDBRemoteCommunication::CheckForPacket(), lldb_private::ClangExpressionParser::ClangExpressionParser(), lldb_private::ThreadPlanCallFunction::ConstructorSetup(), lldb_private::ThreadPlanCallFunction::DoTakedown(), lldb_private::DWARFExpression::Evaluate(), lldb_private::ClangASTSource::FindExternalVisibleDecls(), lldb_private::StackFrameList::GetCurrentInlinedDepth(), GetModuleConfig(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), lldb_private::AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(), lldb_private::CompactUnwindInfo::GetUnwindPlan(), lldb_private::Module::LogMessageVerboseBacktrace(), lldb_private::AppleObjCRuntimeV2::ParseClassInfoArray(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadAllRegisterValues(), UnwindAssemblyInstEmulation::ReadMemory(), lldb_private::ThreadList::RefreshStateAfterStop(), lldb_private::ThreadPlanCallFunction::ReportRegisterState(), lldb_private::StackFrameList::ResetCurrentInlinedDepth(), lldb_private::IRDynamicChecks::runOnModule(), IRForTarget::runOnModule(), lldb_private::SectionLoadList::SetSectionUnloaded(), lldb_private::process_gdb_remote::ProcessGDBRemote::StartNoticingNewThreads(), lldb_private::process_gdb_remote::ProcessGDBRemote::StopNoticingNewThreads(), lldb_private::ASTResultSynthesizer::SynthesizeFunctionResult(), lldb_private::ASTResultSynthesizer::SynthesizeObjCMethodResult(), lldb_private::ASTResultSynthesizer::TransformTopLevelDecl(), lldb_private::RegisterContextUnwind::UnwindLogMsgVerbose(), lldb_private::AppleObjCRuntimeV2::DynamicClassInfoExtractor::UpdateISAToDescriptorMap(), lldb_private::AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::UpdateISAToDescriptorMap(), lldb_private::AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded(), Verbose(), lldb_private::ThreadList::WillResume(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteAllRegisterValues(), UnwindAssemblyInstEmulation::WriteMemory(), and lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteRegisterBytes().
|
static |
Definition at line 290 of file Log.cpp.
References g_channel_map, and ListCategories().
|
staticprivate |
Definition at line 54 of file Log.cpp.
References ForEachCategory().
Referenced by GetFlags(), ListAllLogChannels(), and ListChannelCategories().
|
static |
Definition at line 257 of file Log.cpp.
References g_channel_map, and ListCategories().
|
static |
|
privatedelete |
void Log::Printf | ( | const char * | format, |
... | |||
) |
Prefer using LLDB_LOGF whenever possible.
Definition at line 137 of file Log.cpp.
References VAPrintf().
Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::DoConnectRemote(), ProcessMachCore::DoLoadCore(), lldb_private::NativeThreadWindows::GetStopReason(), GetXcodeSDK(), ObjectFileMachO::LoadCoreFileImages(), lldb_private::formatters::NSNumberSummaryProvider(), ObjectFileMachO::ProcessSegmentCommand(), PutCString(), VAError(), and Warning().
void Log::PutCString | ( | const char * | cstr | ) |
Definition at line 133 of file Log.cpp.
References Printf().
Referenced by lldb_private::AppleObjCRuntimeV2::NonPointerISACache::CreateInstance(), ProcessKDP::DoDetach(), lldb_private::process_gdb_remote::ProcessGDBRemote::DoDetach(), lldb_private::ThreadPlanStepOverRange::DoPlanExplainsStop(), lldb_private::ThreadPlanStepInRange::DoPlanExplainsStop(), lldb_private::DiagnosticManager::Dump(), AuxVector::DumpToLog(), HexagonDYLDRendezvous::DumpToLog(), DYLDRendezvous::DumpToLog(), lldb_private::ThreadPlanStepThrough::HitOurBackstopBreakpoint(), lldb_private::MonitoringProcessLauncher::LaunchProcess(), lldb_private::Module::LogMessage(), lldb_private::Module::LogMessageVerboseBacktrace(), PutString(), DynamicLoaderMacOSXDYLD::PutToLog(), DynamicLoaderDarwinKernel::PutToLog(), DynamicLoaderMacOSXDYLD::RemoveModulesUsingImageInfosAddress(), lldb_private::ThreadPlanCallFunction::ReportRegisterState(), lldb_private::Process::RunThreadPlan(), lldb_private::ThreadPlanStepInstruction::ShouldStop(), lldb_private::ThreadList::ShouldStop(), lldb_private::process_gdb_remote::GDBRemoteClientBase::Lock::SyncWithContinueThread(), lldb_private::DynamicLoaderDarwin::UnloadAllImages(), and lldb_private::DynamicLoaderDarwin::UnloadImages().
void Log::PutString | ( | llvm::StringRef | str | ) |
Definition at line 134 of file Log.cpp.
References PutCString().
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunication::CheckForPacket(), lldb_private::ThreadPlanStepOverRange::DoWillResume(), EntityPersistentVariable::DumpToLog(), EntityVariable::DumpToLog(), EntityResultVariable::DumpToLog(), EntitySymbol::DumpToLog(), EntityRegister::DumpToLog(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), ABIWindows_x86_64::PrepareTrivialCall(), ABISysV_x86_64::PrepareTrivialCall(), ABISysV_arm64::PrepareTrivialCall(), ABISysV_mips64::PrepareTrivialCall(), ABISysV_ppc::PrepareTrivialCall(), ABISysV_ppc64::PrepareTrivialCall(), ABISysV_mips::PrepareTrivialCall(), ABISysV_s390x::PrepareTrivialCall(), ABIMacOSX_arm64::PrepareTrivialCall(), lldb_private::DataExtractor::PutToLog(), UnwindAssemblyInstEmulation::ReadMemory(), lldb_private::ThreadPlanCallFunction::ReportRegisterState(), lldb_private::Process::RunThreadPlan(), lldb_private::process_gdb_remote::GDBRemoteCommunication::SendRawPacketNoLock(), and UnwindAssemblyInstEmulation::WriteMemory().
|
static |
Definition at line 197 of file Log.cpp.
References g_channel_map.
Referenced by lldb_private::LogChannelDWARF::Initialize(), lldb_private::ProcessWindowsLog::Initialize(), lldb_private::ProcessPOSIXLog::Initialize(), lldb_private::ProcessKDPLog::Initialize(), and lldb_private::InitializeLldbChannel().
|
static |
Definition at line 203 of file Log.cpp.
References g_channel_map, and UINT32_MAX.
Referenced by lldb_private::LogChannelDWARF::Terminate().
void Log::VAError | ( | const char * | format, |
va_list | args | ||
) |
Definition at line 168 of file Log.cpp.
References Printf(), and lldb_private::VASprintf().
Referenced by Error().
void Log::VAPrintf | ( | const char * | format, |
va_list | args | ||
) |
Definition at line 147 of file Log.cpp.
References string(), lldb_private::VASprintf(), WriteHeader(), and WriteMessage().
void Log::Verbose | ( | const char * | fmt, |
... | |||
) |
Definition at line 176 of file Log.cpp.
References GetVerbose(), and VAPrintf().
void Log::Warning | ( | const char * | fmt, |
... | |||
) |
Definition at line 187 of file Log.cpp.
References Printf(), and lldb_private::VASprintf().
Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::GetMaxMemorySize(), lldb_private::lldb_renderscript::RSModuleDescriptor::ParseExportReduceCount(), ObjectFileMachO::ParseSymtab(), lldb_private::BreakpointLocation::ResolveBreakpointSite(), RenderScriptRuntimeModulePass::runOnModule(), and lldb_private::BreakpointResolverName::SearchCallback().
|
private |
Definition at line 304 of file Log.cpp.
References GetOptions(), LLDB_LOG_OPTION_BACKTRACE, LLDB_LOG_OPTION_PREPEND_FILE_FUNCTION, LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD, LLDB_LOG_OPTION_PREPEND_SEQUENCE, LLDB_LOG_OPTION_PREPEND_THREAD_NAME, LLDB_LOG_OPTION_PREPEND_TIMESTAMP, lldb_private::OS, and lldb_private::Flags::Test().
Referenced by Format(), and VAPrintf().
|
private |
Definition at line 346 of file Log.cpp.
References GetHandler(), and message().
Referenced by Format(), and VAPrintf().
|
staticprivate |
Definition at line 286 of file Log.h.
Referenced by DisableAllLogChannels(), DisableLogChannel(), DumpLogChannel(), EnableLogChannel(), ForEachChannelCategory(), ListAllLogChannels(), ListChannelCategories(), ListChannels(), Register(), and Unregister().
|
private |
|
private |
|
private |
|
private |
|
private |
Definition at line 263 of file Log.h.
Referenced by Enable(), GetOptions(), and GetVerbose().