LLDB mainline
|
#include <Log.h>
Classes | |
struct | Category |
class | Channel |
Public Types | |
using | MaskType = uint64_t |
The underlying type of all log channel enums. | |
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 | Formatf (llvm::StringRef file, llvm::StringRef function, const char *format,...) __attribute__((format(printf |
void void | Printf (const char *format,...) __attribute__((format(printf |
Prefer using LLDB_LOGF whenever possible. | |
void void void | Error (const char *fmt,...) __attribute__((format(printf |
void void void void | Verbose (const char *fmt,...) __attribute__((format(printf |
void void void void void | Warning (const char *fmt,...) __attribute__((format(printf |
void void void void void const Flags | GetOptions () const |
MaskType | GetMask () const |
bool | GetVerbose () const |
void | VAPrintf (const char *format, va_list args) |
void | VAError (const char *format, va_list args) |
void | VAFormatf (llvm::StringRef file, llvm::StringRef function, 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. | |
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. | |
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 (llvm::StringRef 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, MaskType flags) |
void | Disable (MaskType 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 Log::MaskType | 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 282 of file Log.cpp.
References g_channel_map.
Referenced by CommandObjectLogDisable::DoExecute(), and lldb_private::SystemInitializerCommon::Terminate().
|
static |
Definition at line 240 of file Log.cpp.
References g_channel_map, and GetFlags().
Referenced by CommandObjectLogDisable::DoExecute().
|
private |
|
static |
Definition at line 255 of file Log.cpp.
References g_channel_map.
Referenced by CommandObjectLogDump::DoExecute().
|
private |
|
static |
Definition at line 224 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 175 of file Log.cpp.
References VAError().
Referenced by lldb_private::ThreadPlanNull::DoPlanExplainsStop(), lldb_private::ThreadPlanNull::GetPlanRunState(), lldb_private::ThreadPlanNull::MischiefManaged(), lldb_private::ThreadPlanNull::ShouldStop(), lldb_private::ThreadPlanNull::ValidatePlan(), and lldb_private::ThreadPlanNull::WillStop().
|
staticprivate |
Definition at line 46 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 287 of file Log.cpp.
References ForEachCategory(), and g_channel_map.
Referenced by CompleteEnableDisable().
|
inline |
Definition at line 238 of file Log.h.
References Format().
Referenced by ObjectFilePECOFF::AppendFromExportTable(), Format(), FormatError(), and VAFormatf().
|
private |
Definition at line 371 of file Log.cpp.
References WriteHeader(), and WriteMessage().
|
inline |
void Log::Formatf | ( | llvm::StringRef | file, |
llvm::StringRef | function, | ||
const char * | format, | ||
... | |||
) |
Definition at line 159 of file Log.cpp.
References VAFormatf().
|
staticprivate |
Definition at line 64 of file Log.cpp.
References ListCategories().
Referenced by DisableLogChannel(), and EnableLogChannel().
|
inlineprivate |
Definition at line 295 of file Log.h.
References m_handler, and m_mutex.
Referenced by WriteMessage().
Log::MaskType Log::GetMask | ( | ) | const |
Definition at line 131 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 314 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::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::Debugger::HandleProgressEvent(), lldb_private::Module::LogMessageVerboseBacktrace(), lldb_private::AppleObjCRuntimeV2::ParseClassInfoArray(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadAllRegisterValues(), UnwindAssemblyInstEmulation::ReadMemory(), UnwindAssemblyInstEmulation::ReadRegister(), lldb_private::ThreadList::RefreshStateAfterStop(), lldb_private::ThreadPlanCallFunction::ReportRegisterState(), lldb_private::StackFrameList::ResetCurrentInlinedDepth(), IRForTarget::runOnModule(), lldb_private::IRDynamicChecks::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::SharedCacheClassInfoExtractor::UpdateISAToDescriptorMap(), lldb_private::AppleObjCRuntimeV2::DynamicClassInfoExtractor::UpdateISAToDescriptorMap(), lldb_private::AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded(), Verbose(), lldb_private::ThreadList::WillResume(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteAllRegisterValues(), UnwindAssemblyInstEmulation::WriteMemory(), UnwindAssemblyInstEmulation::WriteRegister(), and lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteRegisterBytes().
|
static |
Definition at line 304 of file Log.cpp.
References g_channel_map, and ListCategories().
Referenced by CommandObjectLogList::DoExecute().
|
staticprivate |
Definition at line 55 of file Log.cpp.
References ForEachCategory().
Referenced by GetFlags(), ListAllLogChannels(), and ListChannelCategories().
|
static |
Definition at line 271 of file Log.cpp.
References g_channel_map, and ListCategories().
Referenced by CommandObjectLogList::DoExecute().
|
static |
Returns the list of log channels.
Definition at line 297 of file Log.cpp.
References g_channel_map.
Referenced by CompleteEnableDisable(), and CommandObjectLogList::HandleArgumentCompletion().
|
privatedelete |
void Log::Printf | ( | const char * | format, |
... | |||
) |
Prefer using LLDB_LOGF whenever possible.
Definition at line 146 of file Log.cpp.
References VAPrintf().
Referenced by lldb_private::NativeThreadWindows::GetStopReason(), ProcessMachCore::LoadBinariesViaMetadata(), ObjectFileMachO::LoadCoreFileImages(), lldb_private::formatters::NSNumberSummaryProvider(), ObjectFileMachO::ProcessSegmentCommand(), VAError(), and Warning().
void Log::PutCString | ( | const char * | cstr | ) |
Definition at line 135 of file Log.cpp.
References PutString().
Referenced by lldb_private::AppleObjCRuntimeV2::NonPointerISACache::CreateInstance(), lldb_private::process_gdb_remote::ProcessGDBRemote::DoDetach(), ProcessKDP::DoDetach(), lldb_private::ThreadPlanStepInRange::DoPlanExplainsStop(), lldb_private::ThreadPlanStepOverRange::DoPlanExplainsStop(), lldb_private::DiagnosticManager::Dump(), HexagonDYLDRendezvous::DumpToLog(), DYLDRendezvous::DumpToLog(), AuxVector::DumpToLog(), lldb_private::ThreadPlanStepThrough::HitOurBackstopBreakpoint(), lldb_private::MonitoringProcessLauncher::LaunchProcess(), lldb_private::Module::LogMessage(), lldb_private::Module::LogMessageVerboseBacktrace(), DynamicLoaderDarwinKernel::PutToLog(), DynamicLoaderMacOSXDYLD::PutToLog(), DynamicLoaderMacOSXDYLD::RemoveModulesUsingImageInfosAddress(), lldb_private::ThreadPlanCallFunction::ReportRegisterState(), lldb_private::Process::RunThreadPlan(), lldb_private::ThreadList::ShouldStop(), lldb_private::ThreadPlanStepInstruction::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 137 of file Log.cpp.
References WriteHeader(), and WriteMessage().
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunication::CheckForPacket(), lldb_private::ThreadPlanStepOverRange::DoWillResume(), EntityPersistentVariable::DumpToLog(), EntityVariableBase::DumpToLog(), EntityResultVariable::DumpToLog(), EntitySymbol::DumpToLog(), EntityRegister::DumpToLog(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), lldb_private::Debugger::HandleProgressEvent(), ABIMacOSX_arm64::PrepareTrivialCall(), ABISysV_arm64::PrepareTrivialCall(), ABISysV_mips::PrepareTrivialCall(), ABISysV_mips64::PrepareTrivialCall(), ABISysV_ppc::PrepareTrivialCall(), ABISysV_ppc64::PrepareTrivialCall(), ABISysV_s390x::PrepareTrivialCall(), ABISysV_x86_64::PrepareTrivialCall(), ABIWindows_x86_64::PrepareTrivialCall(), PutCString(), lldb_private::DataExtractor::PutToLog(), UnwindAssemblyInstEmulation::ReadMemory(), UnwindAssemblyInstEmulation::ReadRegister(), lldb_private::ThreadPlanCallFunction::ReportRegisterState(), lldb_private::Process::RunThreadPlan(), lldb_private::process_gdb_remote::GDBRemoteCommunication::SendRawPacketNoLock(), VAPrintf(), UnwindAssemblyInstEmulation::WriteMemory(), and UnwindAssemblyInstEmulation::WriteRegister().
|
static |
Definition at line 211 of file Log.cpp.
References g_channel_map, and UNUSED_IF_ASSERT_DISABLED.
Referenced by lldb_private::process_gdb_remote::ProcessGDBRemoteLog::Initialize(), lldb_private::ProcessKDPLog::Initialize(), lldb_private::ProcessPOSIXLog::Initialize(), lldb_private::ProcessWindowsLog::Initialize(), lldb_private::LogChannelDWARF::Initialize(), and lldb_private::InitializeLldbChannel().
|
static |
Definition at line 217 of file Log.cpp.
References g_channel_map.
Referenced by lldb_private::LogChannelDWARF::Terminate().
void Log::VAError | ( | const char * | format, |
va_list | args | ||
) |
Definition at line 182 of file Log.cpp.
References Printf(), and lldb_private::VASprintf().
Referenced by Error().
void Log::VAFormatf | ( | llvm::StringRef | file, |
llvm::StringRef | function, | ||
const char * | format, | ||
va_list | args | ||
) |
Definition at line 167 of file Log.cpp.
References Format(), and lldb_private::VASprintf().
Referenced by Formatf().
void Log::VAPrintf | ( | const char * | format, |
va_list | args | ||
) |
Definition at line 153 of file Log.cpp.
References PutString(), and lldb_private::VASprintf().
void Log::Verbose | ( | const char * | fmt, |
... | |||
) |
Definition at line 190 of file Log.cpp.
References GetVerbose(), and VAPrintf().
void Log::Warning | ( | const char * | fmt, |
... | |||
) |
Definition at line 201 of file Log.cpp.
References Printf(), and lldb_private::VASprintf().
Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::GetMaxMemorySize(), ObjectFileMachO::ParseSymtab(), lldb_private::BreakpointLocation::ResolveBreakpointSite(), and lldb_private::BreakpointResolverName::SearchCallback().
|
private |
Definition at line 318 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 PutString().
|
private |
Definition at line 362 of file Log.cpp.
References GetHandler().
Referenced by Format(), and PutString().
|
staticprivate |
Definition at line 308 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 285 of file Log.h.
Referenced by Enable(), GetOptions(), and GetVerbose().