|
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 | Verbose (const char *fmt,...) __attribute__((format(printf |
| void void void const Flags | GetOptions () const |
| MaskType | GetMask () const |
| bool | GetVerbose () const |
| void | VAPrintf (const char *format, va_list args) |
| void | VAFormatf (llvm::StringRef file, llvm::StringRef function, const char *format, va_list args) |
| void | Enable (const std::shared_ptr< LogHandler > &handler_sp, std::optional< MaskType > flags=std::nullopt, uint32_t options=0) |
| void | Disable (std::optional< MaskType > flags=std::nullopt) |
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 () |
| 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), };
|
inline |
|
default |
| void Log::Disable | ( | std::optional< MaskType > | flags = std::nullopt | ) |
|
static |
Definition at line 268 of file Log.cpp.
References g_channel_map.
Referenced by CommandObjectLogDisable::DoExecute(), and lldb_private::SystemInitializerCommon::Terminate().
|
static |
Definition at line 225 of file Log.cpp.
References g_channel_map, and GetFlags().
Referenced by CommandObjectLogDisable::DoExecute().
|
private |
|
static |
Definition at line 241 of file Log.cpp.
References g_channel_map.
Referenced by CommandObjectLogDump::DoExecute().
| void Log::Enable | ( | const std::shared_ptr< LogHandler > & | handler_sp, |
| std::optional< MaskType > | flags = std::nullopt, | ||
| uint32_t | options = 0 ) |
|
static |
Definition at line 208 of file Log.cpp.
References g_channel_map, and GetFlags().
Referenced by lldb_private::Debugger::EnableLog().
|
staticprivate |
Definition at line 50 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.
Referenced by CompleteEnableDisable().
|
inline |
Definition at line 238 of file Log.h.
References Format().
Referenced by Format(), FormatError(), and VAFormatf().
|
private |
Definition at line 357 of file Log.cpp.
References WriteHeader(), and WriteMessage().
|
inline |
| void Log::Formatf | ( | llvm::StringRef | file, |
| llvm::StringRef | function, | ||
| const char * | format, | ||
| ... ) |
Definition at line 169 of file Log.cpp.
References VAFormatf().
|
staticprivate |
Definition at line 68 of file Log.cpp.
References ListCategories().
Referenced by DisableLogChannel(), and EnableLogChannel().
|
inlineprivate |
Definition at line 296 of file Log.h.
References m_handler, and m_mutex.
Referenced by WriteMessage().
| Log::MaskType Log::GetMask | ( | ) | const |
Definition at line 141 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::ThreadPlanCallFunction::ConstructorSetup(), lldb_private::ThreadPlanCallFunction::DoTakedown(), DumpInstToLog(), DumpUnwindRowsToLog(), lldb_private::DWARFExpression::Evaluate(), GetModuleConfig(), lldb_private::AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(), lldb_private::CompactUnwindInfo::GetUnwindPlan(), lldb_private::Module::LogMessageVerboseBacktrace(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadAllRegisterValues(), UnwindAssemblyInstEmulation::ReadMemory(), UnwindAssemblyInstEmulation::ReadRegister(), lldb_private::ThreadPlanCallFunction::ReportRegisterState(), IRForTarget::runOnModule(), lldb_private::IRDynamicChecks::runOnModule(), lldb_private::SectionLoadList::SetSectionUnloaded(), lldb_private::SectionLoadList::SetSectionUnloaded(), lldb_private::ASTResultSynthesizer::SynthesizeFunctionResult(), lldb_private::ASTResultSynthesizer::SynthesizeObjCMethodResult(), lldb_private::ASTResultSynthesizer::TransformTopLevelDecl(), Verbose(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteAllRegisterValues(), UnwindAssemblyInstEmulation::WriteMemory(), UnwindAssemblyInstEmulation::WriteRegister(), and lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteRegisterBytes().
|
static |
Definition at line 290 of file Log.cpp.
References g_channel_map, and ListCategories().
Referenced by CommandObjectLogList::DoExecute().
|
staticprivate |
Definition at line 59 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().
Referenced by CommandObjectLogList::DoExecute().
|
static |
Returns the list of log channels.
Definition at line 283 of file Log.cpp.
References g_channel_map.
Referenced by CompleteEnableDisable(), and CommandObjectLogList::HandleArgumentCompletion().
| void Log::Printf | ( | const char * | format, |
| ... ) |
Prefer using LLDB_LOGF whenever possible.
Definition at line 156 of file Log.cpp.
References VAPrintf().
Referenced by lldb_private::NativeThreadWindows::GetStopReason(), ProcessMachCore::LoadBinariesViaMetadata(), ObjectFileMachO::LoadCoreFileImages(), lldb_private::formatters::NSNumberSummaryProvider(), and ObjectFileMachO::ProcessSegmentCommand().
| void Log::PutCString | ( | const char * | cstr | ) |
Definition at line 145 of file Log.cpp.
References PutString().
Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::DoDetach(), ProcessKDP::DoDetach(), lldb_private::ThreadPlanStepInRange::DoPlanExplainsStop(), lldb_private::ThreadPlanStepOverRange::DoPlanExplainsStop(), AuxVector::DumpToLog(), DYLDRendezvous::DumpToLog(), HexagonDYLDRendezvous::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 147 of file Log.cpp.
References WriteHeader(), and WriteMessage().
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunication::CheckForPacket(), lldb_private::ThreadPlanStepOverRange::DoWillResume(), lldb_private::DiagnosticManager::Dump(), DumpInstToLog(), EntityPersistentVariable::DumpToLog(), EntityRegister::DumpToLog(), EntityResultVariable::DumpToLog(), EntitySymbol::DumpToLog(), EntityVariableBase::DumpToLog(), DumpUnwindRowsToLog(), LogInitInfo(), LogInitInfo(), ABIMacOSX_arm64::PrepareTrivialCall(), ABISysV_arm64::PrepareTrivialCall(), ABISysV_mips64::PrepareTrivialCall(), ABISysV_mips::PrepareTrivialCall(), ABISysV_ppc64::PrepareTrivialCall(), ABISysV_ppc::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 195 of file Log.cpp.
References g_channel_map, and UNUSED_IF_ASSERT_DISABLED.
Referenced by lldb_private::LLDBLogChannel::Initialize(), lldb_private::LogChannelDWARF::Initialize(), lldb_private::process_gdb_remote::ProcessGDBRemoteLog::Initialize(), lldb_private::ProcessKDPLog::Initialize(), lldb_private::ProcessPOSIXLog::Initialize(), and lldb_private::ProcessWindowsLog::Initialize().
|
static |
Definition at line 201 of file Log.cpp.
References g_channel_map.
Referenced by lldb_private::LLDBLogChannel::Terminate(), lldb_private::LogChannelDWARF::Terminate(), lldb_private::process_gdb_remote::ProcessGDBRemoteLog::Terminate(), lldb_private::ProcessKDPLog::Terminate(), lldb_private::ProcessPOSIXLog::Terminate(), and lldb_private::ProcessWindowsLog::Terminate().
| void Log::VAFormatf | ( | llvm::StringRef | file, |
| llvm::StringRef | function, | ||
| const char * | format, | ||
| va_list | args ) |
Definition at line 177 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 163 of file Log.cpp.
References PutString(), and lldb_private::VASprintf().
| void Log::Verbose | ( | const char * | fmt, |
| ... ) |
Definition at line 185 of file Log.cpp.
References GetVerbose(), and VAPrintf().
|
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 PutString().
|
private |
Definition at line 348 of file Log.cpp.
References GetHandler().
Referenced by Format(), and PutString().
|
staticprivate |
Definition at line 304 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 286 of file Log.h.
Referenced by Enable(), GetOptions(), and GetVerbose().