From a007a6d84471bb956abe10974cac3066799f583f Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 31 Jan 2022 15:57:48 +0100 Subject: [PATCH] [lldb] Convert "LLDB" log channel to the new API --- lldb/include/lldb/Interpreter/ScriptedInterface.h | 4 +- lldb/include/lldb/Utility/Logging.h | 37 ------- lldb/source/API/SBDebugger.cpp | 24 ++--- lldb/source/API/SBFrame.cpp | 2 +- lldb/source/API/SBStream.cpp | 2 +- lldb/source/API/SBTarget.cpp | 5 +- lldb/source/Breakpoint/Breakpoint.cpp | 4 +- lldb/source/Breakpoint/BreakpointLocation.cpp | 6 +- lldb/source/Breakpoint/BreakpointResolver.cpp | 2 +- .../Breakpoint/BreakpointResolverAddress.cpp | 3 +- .../Breakpoint/BreakpointResolverFileLine.cpp | 2 +- lldb/source/Breakpoint/BreakpointResolverName.cpp | 4 +- lldb/source/Breakpoint/Watchpoint.cpp | 5 +- lldb/source/Commands/CommandObjectTarget.cpp | 2 +- lldb/source/Core/AddressResolverFileLine.cpp | 2 +- lldb/source/Core/Communication.cpp | 29 +++--- lldb/source/Core/DataFileCache.cpp | 8 +- lldb/source/Core/Debugger.cpp | 6 +- lldb/source/Core/FormatEntity.cpp | 6 +- lldb/source/Core/Mangled.cpp | 8 +- lldb/source/Core/Module.cpp | 11 +-- lldb/source/Core/ModuleList.cpp | 2 +- lldb/source/Core/RichManglingContext.cpp | 4 +- lldb/source/Core/StreamFile.cpp | 2 +- lldb/source/Core/ValueObject.cpp | 2 +- lldb/source/Core/ValueObjectDynamicValue.cpp | 2 +- lldb/source/Core/ValueObjectRegister.cpp | 5 +- lldb/source/Core/ValueObjectSyntheticFilter.cpp | 6 +- lldb/source/DataFormatters/FormatManager.cpp | 4 +- lldb/source/DataFormatters/TypeCategoryMap.cpp | 2 +- lldb/source/Expression/DWARFExpression.cpp | 4 +- lldb/source/Expression/ExpressionVariable.cpp | 2 +- lldb/source/Expression/FunctionCaller.cpp | 11 +-- lldb/source/Expression/IRExecutionUnit.cpp | 17 ++-- lldb/source/Expression/IRInterpreter.cpp | 10 +- lldb/source/Expression/IRMemoryMap.cpp | 12 +-- lldb/source/Expression/LLVMUserExpression.cpp | 5 +- lldb/source/Expression/Materializer.cpp | 24 +++-- lldb/source/Expression/UserExpression.cpp | 3 +- lldb/source/Host/common/Host.cpp | 10 +- lldb/source/Host/common/HostInfoBase.cpp | 16 +-- lldb/source/Host/common/HostNativeThreadBase.cpp | 2 +- .../Host/common/MonitoringProcessLauncher.cpp | 2 +- lldb/source/Host/common/NativeProcessProtocol.cpp | 20 ++-- lldb/source/Host/common/NativeRegisterContext.cpp | 4 +- lldb/source/Host/common/ProcessLaunchInfo.cpp | 7 +- lldb/source/Host/common/Socket.cpp | 10 +- lldb/source/Host/common/TCPSocket.cpp | 4 +- lldb/source/Host/common/UDPSocket.cpp | 2 +- lldb/source/Host/linux/Host.cpp | 6 +- lldb/source/Host/linux/HostInfoLinux.cpp | 3 +- lldb/source/Host/linux/Support.cpp | 6 +- lldb/source/Host/macosx/objcxx/Host.mm | 14 +-- lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm | 4 +- lldb/source/Host/netbsd/HostNetBSD.cpp | 2 +- .../Host/posix/ConnectionFileDescriptorPosix.cpp | 27 +++--- .../Host/windows/ConnectionGenericFileWindows.cpp | 8 +- lldb/source/Interpreter/CommandInterpreter.cpp | 6 +- .../source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp | 2 +- lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp | 2 +- lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp | 2 +- lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp | 2 +- lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp | 2 +- lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp | 9 +- lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp | 2 +- lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp | 2 +- lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp | 2 +- .../Plugins/Architecture/Mips/ArchitectureMips.cpp | 2 +- .../Disassembler/LLVMC/DisassemblerLLVMC.cpp | 3 +- .../Darwin-Kernel/DynamicLoaderDarwinKernel.cpp | 12 +-- .../Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp | 12 +-- .../MacOSX-DYLD/DynamicLoaderDarwin.cpp | 12 +-- .../MacOSX-DYLD/DynamicLoaderMacOS.cpp | 4 +- .../MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp | 6 +- .../DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp | 6 +- .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp | 24 ++--- .../Windows-DYLD/DynamicLoaderWindowsDYLD.cpp | 44 ++++----- .../wasm-DYLD/DynamicLoaderWasmDYLD.cpp | 2 +- .../Clang/ASTResultSynthesizer.cpp | 14 +-- .../ExpressionParser/Clang/ClangASTImporter.cpp | 26 +++-- .../ExpressionParser/Clang/ClangASTSource.cpp | 32 +++--- .../Clang/ClangExpressionDeclMap.cpp | 32 +++--- .../Clang/ClangExpressionParser.cpp | 8 +- .../ExpressionParser/Clang/ClangFunctionCaller.cpp | 2 +- .../Plugins/ExpressionParser/Clang/ClangHost.cpp | 6 +- .../Clang/ClangModulesDeclVendor.cpp | 4 +- .../ExpressionParser/Clang/ClangUserExpression.cpp | 12 +-- .../ExpressionParser/Clang/CxxModuleHandler.cpp | 2 +- .../ExpressionParser/Clang/IRDynamicChecks.cpp | 6 +- .../Plugins/ExpressionParser/Clang/IRForTarget.cpp | 49 ++++------ .../ExpressionParser/Clang/NameSearchContext.cpp | 2 +- .../Instruction/PPC64/EmulateInstructionPPC64.cpp | 10 +- lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp | 6 +- .../Plugins/Language/CPlusPlus/BlockPointer.cpp | 5 +- .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 2 +- lldb/source/Plugins/Language/ObjC/Cocoa.cpp | 2 +- .../ItaniumABI/ItaniumABILanguageRuntime.cpp | 3 +- .../AppleObjCClassDescriptorV2.cpp | 2 +- .../ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp | 20 ++-- .../ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp | 2 +- .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp | 2 +- .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp | 24 ++--- .../AppleObjCTrampolineHandler.cpp | 6 +- .../AppleThreadPlanStepThroughObjCTrampoline.cpp | 4 +- .../LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp | 2 +- .../RenderScriptExpressionOpts.cpp | 3 +- .../RenderScriptRuntime/RenderScriptRuntime.cpp | 95 +++++++++--------- .../RenderScriptx86ABIFixups.cpp | 3 +- .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 13 ++- .../Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | 20 ++-- .../Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp | 6 +- .../Plugins/ObjectFile/wasm/ObjectFileWasm.cpp | 2 +- .../Python/OperatingSystemPython.cpp | 8 +- .../Plugins/Platform/Android/PlatformAndroid.cpp | 8 +- .../Android/PlatformAndroidRemoteGDBServer.cpp | 8 +- .../Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp | 2 +- .../Plugins/Platform/Linux/PlatformLinux.cpp | 2 +- .../Platform/MacOSX/PlatformAppleSimulator.cpp | 2 +- .../Plugins/Platform/MacOSX/PlatformDarwin.cpp | 21 ++-- .../Platform/MacOSX/PlatformDarwinKernel.cpp | 8 +- .../Platform/MacOSX/PlatformRemoteAppleBridge.cpp | 2 +- .../Platform/MacOSX/PlatformRemoteAppleTV.cpp | 2 +- .../Platform/MacOSX/PlatformRemoteAppleWatch.cpp | 2 +- .../Platform/MacOSX/PlatformRemoteDarwinDevice.cpp | 10 +- .../Platform/MacOSX/PlatformRemoteMacOSX.cpp | 2 +- .../Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp | 2 +- .../Plugins/Platform/NetBSD/PlatformNetBSD.cpp | 2 +- .../Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp | 2 +- .../Plugins/Platform/POSIX/PlatformPOSIX.cpp | 8 +- .../Plugins/Platform/QemuUser/PlatformQemuUser.cpp | 2 +- .../gdb-server/PlatformRemoteGDBServer.cpp | 18 ++-- .../Plugins/Process/Linux/NativeProcessLinux.cpp | 11 +-- .../Plugins/Process/Linux/NativeThreadLinux.cpp | 10 +- .../Plugins/Process/Utility/HistoryThread.cpp | 4 +- .../Utility/NativeRegisterContextDBReg_arm64.cpp | 26 ++--- .../Utility/NativeRegisterContextDBReg_x86.cpp | 2 +- .../Process/Windows/Common/NativeThreadWindows.cpp | 4 +- .../Process/Windows/Common/TargetThreadWindows.cpp | 4 +- .../Plugins/Process/elf-core/ProcessElfCore.cpp | 4 +- .../Plugins/Process/elf-core/ThreadElfCore.cpp | 2 +- .../gdb-remote/GDBRemoteCommunicationClient.cpp | 2 +- .../GDBRemoteCommunicationServerCommon.cpp | 4 +- .../GDBRemoteCommunicationServerLLGS.cpp | 108 ++++++++++----------- .../GDBRemoteCommunicationServerPlatform.cpp | 4 +- .../Process/gdb-remote/ProcessGDBRemote.cpp | 18 ++-- .../Plugins/Process/mach-core/ProcessMachCore.cpp | 6 +- .../Plugins/Process/minidump/MinidumpParser.cpp | 25 ++--- .../Plugins/Process/minidump/ProcessMinidump.cpp | 4 +- .../Plugins/Process/scripted/ScriptedProcess.cpp | 7 +- .../Plugins/Process/scripted/ScriptedThread.cpp | 16 +-- .../ScriptInterpreter/Python/PythonDataObjects.cpp | 2 +- .../Python/ScriptInterpreterPython.cpp | 14 +-- .../DarwinLog/StructuredDataDarwinLog.cpp | 14 +-- .../SymbolFile/Breakpad/SymbolFileBreakpad.cpp | 16 +-- .../Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 24 +++-- .../SymbolFile/NativePDB/SymbolFileNativePDB.cpp | 4 +- .../SymbolFile/NativePDB/UdtRecordCompleter.cpp | 4 +- .../source/Plugins/SymbolFile/PDB/PDBASTParser.cpp | 4 +- .../Plugins/SymbolFile/PDB/SymbolFilePDB.cpp | 44 ++++----- .../MacOSX/AppleGetItemInfoHandler.cpp | 4 +- .../MacOSX/AppleGetPendingItemsHandler.cpp | 4 +- .../SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp | 4 +- .../MacOSX/AppleGetThreadItemInfoHandler.cpp | 4 +- .../SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp | 2 +- .../Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 12 +-- .../InstEmulation/UnwindAssemblyInstEmulation.cpp | 10 +- lldb/source/Symbol/Block.cpp | 2 +- lldb/source/Symbol/CompactUnwindInfo.cpp | 4 +- lldb/source/Symbol/DWARFCallFrameInfo.cpp | 4 +- lldb/source/Symbol/Function.cpp | 8 +- lldb/source/Symbol/LocateSymbolFile.cpp | 2 +- lldb/source/Symbol/LocateSymbolFileMacOSX.cpp | 6 +- lldb/source/Symbol/ObjectFile.cpp | 8 +- lldb/source/Symbol/SymbolContext.cpp | 2 +- lldb/source/Symbol/Type.cpp | 6 +- lldb/source/Symbol/UnwindPlan.cpp | 8 +- lldb/source/Target/ABI.cpp | 2 +- lldb/source/Target/AssertFrameRecognizer.cpp | 6 +- lldb/source/Target/DynamicRegisterInfo.cpp | 2 +- lldb/source/Target/Memory.cpp | 12 +-- lldb/source/Target/ModuleCache.cpp | 2 +- lldb/source/Target/Platform.cpp | 18 ++-- lldb/source/Target/Process.cpp | 100 +++++++++---------- lldb/source/Target/RegisterContextUnwind.cpp | 10 +- lldb/source/Target/SectionLoadList.cpp | 6 +- lldb/source/Target/StackFrame.cpp | 5 +- lldb/source/Target/StackFrameList.cpp | 8 +- lldb/source/Target/StopInfo.cpp | 15 ++- lldb/source/Target/Target.cpp | 80 ++++++++------- lldb/source/Target/Thread.cpp | 24 ++--- lldb/source/Target/ThreadList.cpp | 12 +-- lldb/source/Target/ThreadPlan.cpp | 16 +-- lldb/source/Target/ThreadPlanBase.cpp | 2 +- lldb/source/Target/ThreadPlanCallFunction.cpp | 13 ++- .../source/Target/ThreadPlanCallUserExpression.cpp | 2 +- lldb/source/Target/ThreadPlanPython.cpp | 12 +-- lldb/source/Target/ThreadPlanRunToAddress.cpp | 2 +- lldb/source/Target/ThreadPlanShouldStopHere.cpp | 6 +- lldb/source/Target/ThreadPlanStepInRange.cpp | 12 +-- lldb/source/Target/ThreadPlanStepInstruction.cpp | 6 +- lldb/source/Target/ThreadPlanStepOut.cpp | 6 +- .../source/Target/ThreadPlanStepOverBreakpoint.cpp | 4 +- lldb/source/Target/ThreadPlanStepOverRange.cpp | 6 +- lldb/source/Target/ThreadPlanStepRange.cpp | 14 +-- lldb/source/Target/ThreadPlanStepThrough.cpp | 8 +- lldb/source/Target/ThreadPlanStepUntil.cpp | 2 +- lldb/source/Target/ThreadPlanTracer.cpp | 6 +- lldb/source/Target/UnwindLLDB.cpp | 6 +- lldb/source/Utility/ArchSpec.cpp | 2 +- lldb/source/Utility/Broadcaster.cpp | 10 +- lldb/source/Utility/Instrumentation.cpp | 2 +- lldb/source/Utility/Listener.cpp | 20 ++-- lldb/source/Utility/Logging.cpp | 8 -- lldb/tools/lldb-server/lldb-gdbserver.cpp | 2 +- 214 files changed, 960 insertions(+), 1118 deletions(-) diff --git a/lldb/include/lldb/Interpreter/ScriptedInterface.h b/lldb/include/lldb/Interpreter/ScriptedInterface.h index 9de5e60..fd752fd 100644 --- a/lldb/include/lldb/Interpreter/ScriptedInterface.h +++ b/lldb/include/lldb/Interpreter/ScriptedInterface.h @@ -34,8 +34,8 @@ public: static Ret ErrorWithMessage(llvm::StringRef caller_name, llvm::StringRef error_msg, Status &error, LLDBLog log_caterogy = LLDBLog::Process) { - LLDB_LOGF(GetLogIfAllCategoriesSet(log_caterogy), "%s ERROR = %s", - caller_name.data(), error_msg.data()); + LLDB_LOGF(GetLog(log_caterogy), "%s ERROR = %s", caller_name.data(), + error_msg.data()); error.SetErrorString(llvm::Twine(caller_name + llvm::Twine(" ERROR = ") + llvm::Twine(error_msg)) .str()); diff --git a/lldb/include/lldb/Utility/Logging.h b/lldb/include/lldb/Utility/Logging.h index db84da2..892caa1 100644 --- a/lldb/include/lldb/Utility/Logging.h +++ b/lldb/include/lldb/Utility/Logging.h @@ -52,43 +52,6 @@ enum class LLDBLog : Log::MaskType { LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE(); -// Log Bits specific to logging in lldb -#define LIBLLDB_LOG_PROCESS ::lldb_private::LLDBLog::Process -#define LIBLLDB_LOG_THREAD ::lldb_private::LLDBLog::Thread -#define LIBLLDB_LOG_DYNAMIC_LOADER ::lldb_private::LLDBLog::DynamicLoader -#define LIBLLDB_LOG_EVENTS ::lldb_private::LLDBLog::Events -#define LIBLLDB_LOG_BREAKPOINTS ::lldb_private::LLDBLog::Breakpoints -#define LIBLLDB_LOG_WATCHPOINTS ::lldb_private::LLDBLog::Watchpoints -#define LIBLLDB_LOG_STEP ::lldb_private::LLDBLog::Step -#define LIBLLDB_LOG_EXPRESSIONS ::lldb_private::LLDBLog::Expressions -#define LIBLLDB_LOG_TEMPORARY ::lldb_private::LLDBLog::Temporary -#define LIBLLDB_LOG_STATE ::lldb_private::LLDBLog::State -#define LIBLLDB_LOG_OBJECT ::lldb_private::LLDBLog::Object -#define LIBLLDB_LOG_COMMUNICATION ::lldb_private::LLDBLog::Communication -#define LIBLLDB_LOG_CONNECTION ::lldb_private::LLDBLog::Connection -#define LIBLLDB_LOG_HOST ::lldb_private::LLDBLog::Host -#define LIBLLDB_LOG_UNWIND ::lldb_private::LLDBLog::Unwind -#define LIBLLDB_LOG_API ::lldb_private::LLDBLog::API -#define LIBLLDB_LOG_SCRIPT ::lldb_private::LLDBLog::Script -#define LIBLLDB_LOG_COMMANDS ::lldb_private::LLDBLog::Commands -#define LIBLLDB_LOG_TYPES ::lldb_private::LLDBLog::Types -#define LIBLLDB_LOG_SYMBOLS ::lldb_private::LLDBLog::Symbols -#define LIBLLDB_LOG_MODULES ::lldb_private::LLDBLog::Modules -#define LIBLLDB_LOG_TARGET ::lldb_private::LLDBLog::Target -#define LIBLLDB_LOG_MMAP ::lldb_private::LLDBLog::MMap -#define LIBLLDB_LOG_OS ::lldb_private::LLDBLog::OS -#define LIBLLDB_LOG_PLATFORM ::lldb_private::LLDBLog::Platform -#define LIBLLDB_LOG_SYSTEM_RUNTIME ::lldb_private::LLDBLog::SystemRuntime -#define LIBLLDB_LOG_JIT_LOADER ::lldb_private::LLDBLog::JITLoader -#define LIBLLDB_LOG_LANGUAGE ::lldb_private::LLDBLog::Language -#define LIBLLDB_LOG_DATAFORMATTERS ::lldb_private::LLDBLog::DataFormatters -#define LIBLLDB_LOG_DEMANGLE ::lldb_private::LLDBLog::Demangle -#define LIBLLDB_LOG_AST ::lldb_private::LLDBLog::AST - -Log *GetLogIfAllCategoriesSet(LLDBLog mask); - -Log *GetLogIfAnyCategoriesSet(LLDBLog mask); - void InitializeLldbChannel(); template <> Log::Channel &LogChannelFor(); diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index 8b09d6a..800ebc7 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -760,7 +760,7 @@ lldb::SBTarget SBDebugger::CreateTarget(const char *filename, sb_error.SetErrorString("invalid debugger"); } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log = GetLog(LLDBLog::API); LLDB_LOGF(log, "SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, " "platform_name=%s, add_dependent_modules=%u, error=%s) => " @@ -788,7 +788,7 @@ SBDebugger::CreateTargetWithFileAndTargetTriple(const char *filename, sb_target.SetSP(target_sp); } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log = GetLog(LLDBLog::API); LLDB_LOGF(log, "SBDebugger(%p)::CreateTargetWithFileAndTargetTriple " "(filename=\"%s\", triple=%s) => SBTarget(%p)", @@ -802,7 +802,7 @@ SBTarget SBDebugger::CreateTargetWithFileAndArch(const char *filename, const char *arch_cstr) { LLDB_INSTRUMENT_VA(this, filename, arch_cstr); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log = GetLog(LLDBLog::API); SBTarget sb_target; TargetSP target_sp; @@ -858,7 +858,7 @@ SBTarget SBDebugger::CreateTarget(const char *filename) { if (error.Success()) sb_target.SetSP(target_sp); } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log = GetLog(LLDBLog::API); LLDB_LOGF(log, "SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)", static_cast(m_opaque_sp.get()), filename, @@ -873,7 +873,7 @@ SBTarget SBDebugger::GetDummyTarget() { if (m_opaque_sp) { sb_target.SetSP(m_opaque_sp->GetDummyTarget().shared_from_this()); } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log = GetLog(LLDBLog::API); LLDB_LOGF(log, "SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)", static_cast(m_opaque_sp.get()), static_cast(sb_target.GetSP().get())); @@ -894,7 +894,7 @@ bool SBDebugger::DeleteTarget(lldb::SBTarget &target) { } } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log = GetLog(LLDBLog::API); LLDB_LOGF(log, "SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i", static_cast(m_opaque_sp.get()), static_cast(target.m_opaque_sp.get()), result); @@ -977,7 +977,7 @@ uint32_t SBDebugger::GetNumTargets() { SBTarget SBDebugger::GetSelectedTarget() { LLDB_INSTRUMENT_VA(this); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log = GetLog(LLDBLog::API); SBTarget sb_target; TargetSP target_sp; @@ -1001,7 +1001,7 @@ SBTarget SBDebugger::GetSelectedTarget() { void SBDebugger::SetSelectedTarget(SBTarget &sb_target) { LLDB_INSTRUMENT_VA(this, sb_target); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log = GetLog(LLDBLog::API); TargetSP target_sp(sb_target.GetSP()); if (m_opaque_sp) { @@ -1019,7 +1019,7 @@ void SBDebugger::SetSelectedTarget(SBTarget &sb_target) { SBPlatform SBDebugger::GetSelectedPlatform() { LLDB_INSTRUMENT_VA(this); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log = GetLog(LLDBLog::API); SBPlatform sb_platform; DebuggerSP debugger_sp(m_opaque_sp); @@ -1036,7 +1036,7 @@ SBPlatform SBDebugger::GetSelectedPlatform() { void SBDebugger::SetSelectedPlatform(SBPlatform &sb_platform) { LLDB_INSTRUMENT_VA(this, sb_platform); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log = GetLog(LLDBLog::API); DebuggerSP debugger_sp(m_opaque_sp); if (debugger_sp) { @@ -1123,7 +1123,7 @@ void SBDebugger::DispatchInput(void *baton, const void *data, size_t data_len) { void SBDebugger::DispatchInput(const void *data, size_t data_len) { LLDB_INSTRUMENT_VA(this, data, data_len); - // Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); + // Log *log(GetLog (LLDBLog::API)); // // if (log) // LLDB_LOGF(log, "SBDebugger(%p)::DispatchInput (data=\"%.*s\", @@ -1312,7 +1312,7 @@ void SBDebugger::SetTerminalWidth(uint32_t term_width) { const char *SBDebugger::GetPrompt() const { LLDB_INSTRUMENT_VA(this); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log = GetLog(LLDBLog::API); LLDB_LOGF(log, "SBDebugger(%p)::GetPrompt () => \"%s\"", static_cast(m_opaque_sp.get()), diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index ffbbed0..561548b 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -1033,7 +1033,7 @@ lldb::SBValue SBFrame::EvaluateExpression(const char *expr, const SBExpressionOptions &options) { LLDB_INSTRUMENT_VA(this, expr, options); - Log *expr_log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *expr_log = GetLog(LLDBLog::Expressions); SBValue expr_result; diff --git a/lldb/source/API/SBStream.cpp b/lldb/source/API/SBStream.cpp index 9ceef34..7fc1124 100644 --- a/lldb/source/API/SBStream.cpp +++ b/lldb/source/API/SBStream.cpp @@ -98,7 +98,7 @@ void SBStream::RedirectToFile(const char *path, bool append) { llvm::Expected file = FileSystem::Instance().Open(FileSpec(path), open_options); if (!file) { - LLDB_LOG_ERROR(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API), file.takeError(), + LLDB_LOG_ERROR(GetLog(LLDBLog::API), file.takeError(), "Cannot open {1}: {0}", path); return; } diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index 75534b2..2090263 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -1116,8 +1116,7 @@ bool SBTarget::FindBreakpointsByName(const char *name, llvm::Expected> expected_vector = target_sp->GetBreakpointList().FindBreakpointsByName(name); if (!expected_vector) { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS), - "invalid breakpoint name: {}", + LLDB_LOG(GetLog(LLDBLog::Breakpoints), "invalid breakpoint name: {}", llvm::toString(expected_vector.takeError())); return false; } @@ -2195,7 +2194,7 @@ lldb::SBValue SBTarget::EvaluateExpression(const char *expr, const SBExpressionOptions &options) { LLDB_INSTRUMENT_VA(this, expr, options); - Log *expr_log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *expr_log = GetLog(LLDBLog::Expressions); SBValue expr_result; ValueObjectSP expr_value_sp; TargetSP target_sp(GetSP()); diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index eeb8eac..56b06c1 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -487,7 +487,7 @@ void Breakpoint::ClearAllBreakpointSites() { void Breakpoint::ModulesChanged(ModuleList &module_list, bool load, bool delete_locations) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "Breakpoint::ModulesChanged: num_modules: %zu load: %i " "delete_locations: %i\n", @@ -646,7 +646,7 @@ static bool SymbolContextsMightBeEquivalent(SymbolContext &old_sc, void Breakpoint::ModuleReplaced(ModuleSP old_module_sp, ModuleSP new_module_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "Breakpoint::ModulesReplaced for %s\n", old_module_sp->GetSpecificationDescription().c_str()); // First find all the locations that are in the old module diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp index 0c4d3e0..af92cf8 100644 --- a/lldb/source/Breakpoint/BreakpointLocation.cpp +++ b/lldb/source/Breakpoint/BreakpointLocation.cpp @@ -233,7 +233,7 @@ const char *BreakpointLocation::GetConditionText(size_t *hash) const { bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx, Status &error) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); + Log *log = GetLog(LLDBLog::Breakpoints); std::lock_guard guard(m_condition_mutex); @@ -393,7 +393,7 @@ bool BreakpointLocation::ValidForThisThread(Thread &thread) { bool BreakpointLocation::ShouldStop(StoppointCallbackContext *context) { bool should_stop = true; - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); + Log *log = GetLog(LLDBLog::Breakpoints); // Do this first, if a location is disabled, it shouldn't increment its hit // count. @@ -450,7 +450,7 @@ bool BreakpointLocation::ResolveBreakpointSite() { process->CreateBreakpointSite(shared_from_this(), m_owner.IsHardware()); if (new_id == LLDB_INVALID_BREAK_ID) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); + Log *log = GetLog(LLDBLog::Breakpoints); if (log) log->Warning("Failed to add breakpoint site at 0x%" PRIx64, m_address.GetOpcodeLoadAddress(&m_owner.GetTarget())); diff --git a/lldb/source/Breakpoint/BreakpointResolver.cpp b/lldb/source/Breakpoint/BreakpointResolver.cpp index d3d57a2..76bc1e1 100644 --- a/lldb/source/Breakpoint/BreakpointResolver.cpp +++ b/lldb/source/Breakpoint/BreakpointResolver.cpp @@ -292,7 +292,7 @@ void BreakpointResolver::AddLocation(SearchFilter &filter, const SymbolContext &sc, bool skip_prologue, llvm::StringRef log_ident) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); Address line_start = sc.line_entry.range.GetBaseAddress(); if (!line_start.IsValid()) { LLDB_LOGF(log, diff --git a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp index 3187e84..3ef32ad 100644 --- a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp @@ -143,8 +143,7 @@ Searcher::CallbackReturn BreakpointResolverAddress::SearchCallback( if (bp_loc_sp && !breakpoint.IsInternal()) { StreamString s; bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose); - Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "Added location: %s\n", s.GetData()); } } else { diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp index be46160..81171c3 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -127,7 +127,7 @@ void BreakpointResolverFileLine::FilterContexts(SymbolContextList &sc_list, if (is_relative) relative_path = m_location_spec.GetFileSpec().GetDirectory().GetStringRef(); - Log * log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); + Log *log = GetLog(LLDBLog::Breakpoints); for(uint32_t i = 0; i < sc_list.GetSize(); ++i) { SymbolContext sc; sc_list.GetContextAtIndex(i, sc); diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp b/lldb/source/Breakpoint/BreakpointResolverName.cpp index 49087b3..e75c0cd 100644 --- a/lldb/source/Breakpoint/BreakpointResolverName.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp @@ -33,7 +33,7 @@ BreakpointResolverName::BreakpointResolverName(const BreakpointSP &bkpt, if (m_match_type == Breakpoint::Regexp) { m_regex = RegularExpression(name_cstr); if (!m_regex.IsValid()) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); if (log) log->Warning("function name regexp: \"%s\" did not compile.", @@ -252,7 +252,7 @@ void BreakpointResolverName::AddNameLookup(ConstString name, Searcher::CallbackReturn BreakpointResolverName::SearchCallback(SearchFilter &filter, SymbolContext &context, Address *addr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); if (m_class_name) { if (log) diff --git a/lldb/source/Breakpoint/Watchpoint.cpp b/lldb/source/Breakpoint/Watchpoint.cpp index 29ae1ef..ac41c1f 100644 --- a/lldb/source/Breakpoint/Watchpoint.cpp +++ b/lldb/source/Breakpoint/Watchpoint.cpp @@ -40,9 +40,8 @@ Watchpoint::Watchpoint(Target &target, lldb::addr_t addr, uint32_t size, auto type_system_or_err = target.GetScratchTypeSystemForLanguage(eLanguageTypeC); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_WATCHPOINTS), - std::move(err), "Failed to set type."); + LLDB_LOG_ERROR(GetLog(LLDBLog::Watchpoints), std::move(err), + "Failed to set type."); } else { m_type = type_system_or_err->GetBuiltinTypeForEncodingAndBitSize( eEncodingUint, 8 * size); diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 157065b..2cc3a90 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -1034,7 +1034,7 @@ protected: const char *to = command.GetArgumentAtIndex(i + 1); if (from[0] && to[0]) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); if (log) { LLDB_LOGF(log, "target modules search path adding ImageSearchPath " diff --git a/lldb/source/Core/AddressResolverFileLine.cpp b/lldb/source/Core/AddressResolverFileLine.cpp index fb61a610..76c0edd 100644 --- a/lldb/source/Core/AddressResolverFileLine.cpp +++ b/lldb/source/Core/AddressResolverFileLine.cpp @@ -40,7 +40,7 @@ AddressResolverFileLine::SearchCallback(SearchFilter &filter, SymbolContextList sc_list; CompileUnit *cu = context.comp_unit; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); // TODO: Handle SourceLocationSpec column information cu->ResolveSymbolContext(m_src_location_spec, eSymbolContextEverything, diff --git a/lldb/source/Core/Communication.cpp b/lldb/source/Core/Communication.cpp index 0ad2751..fde3e3e 100644 --- a/lldb/source/Core/Communication.cpp +++ b/lldb/source/Core/Communication.cpp @@ -47,8 +47,7 @@ Communication::Communication(const char *name) { - LLDB_LOG(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | - LIBLLDB_LOG_COMMUNICATION), + LLDB_LOG(GetLog(LLDBLog::Object | LLDBLog::Communication), "{0} Communication::Communication (name = {1})", this, name); SetEventName(eBroadcastBitDisconnected, "disconnected"); @@ -62,8 +61,7 @@ Communication::Communication(const char *name) } Communication::~Communication() { - LLDB_LOG(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | - LIBLLDB_LOG_COMMUNICATION), + LLDB_LOG(GetLog(LLDBLog::Object | LLDBLog::Communication), "{0} Communication::~Communication (name = {1})", this, GetBroadcasterName().AsCString()); Clear(); @@ -78,7 +76,7 @@ void Communication::Clear() { ConnectionStatus Communication::Connect(const char *url, Status *error_ptr) { Clear(); - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), + LLDB_LOG(GetLog(LLDBLog::Communication), "{0} Communication::Connect (url = {1})", this, url); lldb::ConnectionSP connection_sp(m_connection_sp); @@ -90,8 +88,8 @@ ConnectionStatus Communication::Connect(const char *url, Status *error_ptr) { } ConnectionStatus Communication::Disconnect(Status *error_ptr) { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), - "{0} Communication::Disconnect ()", this); + LLDB_LOG(GetLog(LLDBLog::Communication), "{0} Communication::Disconnect ()", + this); assert((!m_read_thread_enabled || m_read_thread_did_exit) && "Disconnecting while the read thread is running is racy!"); @@ -125,7 +123,7 @@ bool Communication::HasConnection() const { size_t Communication::Read(void *dst, size_t dst_len, const Timeout &timeout, ConnectionStatus &status, Status *error_ptr) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION); + Log *log = GetLog(LLDBLog::Communication); LLDB_LOG( log, "this = {0}, dst = {1}, dst_len = {2}, timeout = {3}, connection = {4}", @@ -175,7 +173,7 @@ size_t Communication::Write(const void *src, size_t src_len, lldb::ConnectionSP connection_sp(m_connection_sp); std::lock_guard guard(m_write_mutex); - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), + LLDB_LOG(GetLog(LLDBLog::Communication), "{0} Communication::Write (src = {1}, src_len = {2}" ") connection = {3}", this, src, (uint64_t)src_len, connection_sp.get()); @@ -206,7 +204,7 @@ bool Communication::StartReadThread(Status *error_ptr) { if (m_read_thread.IsJoinable()) return true; - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), + LLDB_LOG(GetLog(LLDBLog::Communication), "{0} Communication::StartReadThread ()", this); const std::string thread_name = @@ -222,8 +220,7 @@ bool Communication::StartReadThread(Status *error_ptr) { if (error_ptr) *error_ptr = Status(maybe_thread.takeError()); else { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), - "failed to launch host thread: {}", + LLDB_LOG(GetLog(LLDBLog::Host), "failed to launch host thread: {}", llvm::toString(maybe_thread.takeError())); } } @@ -238,7 +235,7 @@ bool Communication::StopReadThread(Status *error_ptr) { if (!m_read_thread.IsJoinable()) return true; - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), + LLDB_LOG(GetLog(LLDBLog::Communication), "{0} Communication::StopReadThread ()", this); m_read_thread_enabled = false; @@ -280,7 +277,7 @@ size_t Communication::GetCachedBytes(void *dst, size_t dst_len) { void Communication::AppendBytesToCache(const uint8_t *bytes, size_t len, bool broadcast, ConnectionStatus status) { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), + LLDB_LOG(GetLog(LLDBLog::Communication), "{0} Communication::AppendBytesToCache (src = {1}, src_len = {2}, " "broadcast = {3})", this, bytes, (uint64_t)len, broadcast); @@ -317,7 +314,7 @@ bool Communication::ReadThreadIsRunning() { return m_read_thread_enabled; } lldb::thread_result_t Communication::ReadThread(lldb::thread_arg_t p) { Communication *comm = (Communication *)p; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION)); + Log *log = GetLog(LLDBLog::Communication); LLDB_LOGF(log, "%p Communication::ReadThread () thread starting...", p); @@ -369,7 +366,7 @@ lldb::thread_result_t Communication::ReadThread(lldb::thread_arg_t p) { break; } } - log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION); + log = GetLog(LLDBLog::Communication); if (log) LLDB_LOGF(log, "%p Communication::ReadThread () thread exiting...", p); diff --git a/lldb/source/Core/DataFileCache.cpp b/lldb/source/Core/DataFileCache.cpp index 3f52b92..44e046e 100644 --- a/lldb/source/Core/DataFileCache.cpp +++ b/lldb/source/Core/DataFileCache.cpp @@ -57,7 +57,7 @@ DataFileCache::DataFileCache(StringRef path) { if (cache_or_err) m_cache_callback = std::move(*cache_or_err); else { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES)); + Log *log = GetLog(LLDBLog::Modules); LLDB_LOG_ERROR(log, cache_or_err.takeError(), "failed to create lldb index cache directory: {0}"); } @@ -89,7 +89,7 @@ DataFileCache::GetCachedData(StringRef key) { if (!add_stream) return std::move(m_mem_buff_up); } else { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES)); + Log *log = GetLog(LLDBLog::Modules); LLDB_LOG_ERROR(log, add_stream_or_err.takeError(), "failed to get the cache add stream callback for key: {0}"); } @@ -124,13 +124,13 @@ bool DataFileCache::SetCachedData(StringRef key, llvm::ArrayRef data) { cfs->OS->write((const char *)data.data(), data.size()); return true; } else { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES)); + Log *log = GetLog(LLDBLog::Modules); LLDB_LOG_ERROR(log, file_or_err.takeError(), "failed to get the cache file stream for key: {0}"); } } } else { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES)); + Log *log = GetLog(LLDBLog::Modules); LLDB_LOG_ERROR(log, add_stream_or_err.takeError(), "failed to get the cache add stream callback for key: {0}"); } diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 49cc21b..b0dbb95b 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1692,8 +1692,7 @@ bool Debugger::StartEventHandlerThread() { if (event_handler_thread) { m_event_handler_thread = *event_handler_thread; } else { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), - "failed to launch host thread: {}", + LLDB_LOG(GetLog(LLDBLog::Host), "failed to launch host thread: {}", llvm::toString(event_handler_thread.takeError())); } @@ -1733,8 +1732,7 @@ bool Debugger::StartIOHandlerThread() { if (io_handler_thread) { m_io_handler_thread = *io_handler_thread; } else { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), - "failed to launch host thread: {}", + LLDB_LOG(GetLog(LLDBLog::Host), "failed to launch host thread: {}", llvm::toString(io_handler_thread.takeError())); } } diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index 6e6255b..56fad87 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -509,7 +509,7 @@ static bool ScanBracketedRange(llvm::StringRef subpath, size_t &close_bracket_index, const char *&var_name_final_if_array_range, int64_t &index_lower, int64_t &index_higher) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); + Log *log = GetLog(LLDBLog::DataFormatters); close_bracket_index = llvm::StringRef::npos; const size_t open_bracket_index = subpath.find('['); if (open_bracket_index == llvm::StringRef::npos) { @@ -618,7 +618,7 @@ static bool DumpRegister(Stream &s, StackFrame *frame, RegisterKind reg_kind, static ValueObjectSP ExpandIndexedExpression(ValueObject *valobj, size_t index, bool deref_pointer) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); + Log *log = GetLog(LLDBLog::DataFormatters); const char *ptr_deref_format = "[%d]"; std::string ptr_deref_buffer(10, 0); ::sprintf(&ptr_deref_buffer[0], ptr_deref_format, index); @@ -676,7 +676,7 @@ static bool DumpValue(Stream &s, const SymbolContext *sc, if (valobj == nullptr) return false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); + Log *log = GetLog(LLDBLog::DataFormatters); Format custom_format = eFormatInvalid; ValueObject::ValueObjectRepresentationStyle val_obj_display = entry.string.empty() diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp index 4e10324..653af3a 100644 --- a/lldb/source/Core/Mangled.cpp +++ b/lldb/source/Core/Mangled.cpp @@ -130,7 +130,7 @@ static char *GetMSVCDemangledStr(const char *M) { llvm::MSDF_NoAccessSpecifier | llvm::MSDF_NoCallingConvention | llvm::MSDF_NoMemberType | llvm::MSDF_NoVariableType)); - if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) { + if (Log *log = GetLog(LLDBLog::Demangle)) { if (demangled_cstr && demangled_cstr[0]) LLDB_LOGF(log, "demangled msvc: %s -> \"%s\"", M, demangled_cstr); else @@ -157,7 +157,7 @@ static char *GetItaniumDemangledStr(const char *M) { "Expected demangled_size to return length including trailing null"); } - if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) { + if (Log *log = GetLog(LLDBLog::Demangle)) { if (demangled_cstr) LLDB_LOGF(log, "demangled itanium: %s -> \"%s\"", M, demangled_cstr); else @@ -170,7 +170,7 @@ static char *GetItaniumDemangledStr(const char *M) { static char *GetRustV0DemangledStr(const char *M) { char *demangled_cstr = llvm::rustDemangle(M, nullptr, nullptr, nullptr); - if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) { + if (Log *log = GetLog(LLDBLog::Demangle)) { if (demangled_cstr && demangled_cstr[0]) LLDB_LOG(log, "demangled rustv0: {0} -> \"{1}\"", M, demangled_cstr); else @@ -183,7 +183,7 @@ static char *GetRustV0DemangledStr(const char *M) { static char *GetDLangDemangledStr(const char *M) { char *demangled_cstr = llvm::dlangDemangle(M); - if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) { + if (Log *log = GetLog(LLDBLog::Demangle)) { if (demangled_cstr && demangled_cstr[0]) LLDB_LOG(log, "demangled dlang: {0} -> \"{1}\"", M, demangled_cstr); else diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index feecf98..b7e80aa 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -138,8 +138,7 @@ Module::Module(const ModuleSpec &module_spec) GetModuleCollection().push_back(this); } - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | - LIBLLDB_LOG_MODULES)); + Log *log(GetLog(LLDBLog::Object | LLDBLog::Modules)); if (log != nullptr) LLDB_LOGF(log, "%p Module::Module((%s) '%s%s%s%s')", static_cast(this), @@ -251,8 +250,7 @@ Module::Module(const FileSpec &file_spec, const ArchSpec &arch, if (object_name) m_object_name = *object_name; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | - LIBLLDB_LOG_MODULES)); + Log *log(GetLog(LLDBLog::Object | LLDBLog::Modules)); if (log != nullptr) LLDB_LOGF(log, "%p Module::Module((%s) '%s%s%s%s')", static_cast(this), m_arch.GetArchitectureName(), @@ -281,8 +279,7 @@ Module::~Module() { assert(pos != end); modules.erase(pos); } - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | - LIBLLDB_LOG_MODULES)); + Log *log(GetLog(LLDBLog::Object | LLDBLog::Modules)); if (log != nullptr) LLDB_LOGF(log, "%p Module::~Module((%s) '%s%s%s%s')", static_cast(this), m_arch.GetArchitectureName(), @@ -1629,7 +1626,7 @@ void Module::RegisterXcodeSDK(llvm::StringRef sdk_name, bool Module::MergeArchitecture(const ArchSpec &arch_spec) { if (!arch_spec.IsValid()) return false; - LLDB_LOGF(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_MODULES), + LLDB_LOGF(GetLog(LLDBLog::Object | LLDBLog::Modules), "module has arch %s, merging/replacing with arch %s", m_arch.GetTriple().getTriple().c_str(), arch_spec.GetTriple().getTriple().c_str()); diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index 4841213..74d3712 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -807,7 +807,7 @@ ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp, if (old_modules) old_modules->push_back(module_sp); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES)); + Log *log = GetLog(LLDBLog::Modules); if (log != nullptr) LLDB_LOGF( log, "%p '%s' module changed: removing from global module list", diff --git a/lldb/source/Core/RichManglingContext.cpp b/lldb/source/Core/RichManglingContext.cpp index 63170fe..b0ba26a 100644 --- a/lldb/source/Core/RichManglingContext.cpp +++ b/lldb/source/Core/RichManglingContext.cpp @@ -47,7 +47,7 @@ bool RichManglingContext::FromItaniumName(ConstString mangled) { ResetProvider(ItaniumPartialDemangler); } - if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) { + if (Log *log = GetLog(LLDBLog::Demangle)) { if (!err) { ParseFullName(); LLDB_LOG(log, "demangled itanium: {0} -> \"{1}\"", mangled, m_ipd_buf); @@ -103,7 +103,7 @@ void RichManglingContext::processIPDStrResult(char *ipd_res, size_t res_size) { m_ipd_buf = ipd_res; // std::realloc freed or reused the old buffer. m_ipd_buf_size = res_size; // May actually be bigger, but we can't know. - if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) + if (Log *log = GetLog(LLDBLog::Demangle)) LLDB_LOG(log, "ItaniumPartialDemangler Realloc: new buffer size is {0}", m_ipd_buf_size); } diff --git a/lldb/source/Core/StreamFile.cpp b/lldb/source/Core/StreamFile.cpp index 7753397a..1fee76a 100644 --- a/lldb/source/Core/StreamFile.cpp +++ b/lldb/source/Core/StreamFile.cpp @@ -37,7 +37,7 @@ StreamFile::StreamFile(const char *path, File::OpenOptions options, m_file_sp = std::move(file.get()); else { // TODO refactor this so the error gets popagated up instead of logged here. - LLDB_LOG_ERROR(GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), file.takeError(), + LLDB_LOG_ERROR(GetLog(LLDBLog::Host), file.takeError(), "Cannot open {1}: {0}", path); m_file_sp = std::make_shared(); } diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 6794d0c..db4bae2 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -200,7 +200,7 @@ bool ValueObject::UpdateValueIfNeeded(bool update_format) { } bool ValueObject::UpdateFormatsIfNeeded() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); + Log *log = GetLog(LLDBLog::DataFormatters); LLDB_LOGF(log, "[%s %p] checking for FormatManager revisions. ValueObject " "rev: %d - Global rev: %d", diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp index bf087f3..e82fe72 100644 --- a/lldb/source/Core/ValueObjectDynamicValue.cpp +++ b/lldb/source/Core/ValueObjectDynamicValue.cpp @@ -201,7 +201,7 @@ bool ValueObjectDynamicValue::UpdateValue() { Value old_value(m_value); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES)); + Log *log = GetLog(LLDBLog::Commands); bool has_changed_type = false; diff --git a/lldb/source/Core/ValueObjectRegister.cpp b/lldb/source/Core/ValueObjectRegister.cpp index 743083a..7835dad6 100644 --- a/lldb/source/Core/ValueObjectRegister.cpp +++ b/lldb/source/Core/ValueObjectRegister.cpp @@ -202,9 +202,8 @@ CompilerType ValueObjectRegister::GetCompilerTypeImpl() { auto type_system_or_err = exe_module->GetTypeSystemForLanguage(eLanguageTypeC); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TYPES), - std::move(err), "Unable to get CompilerType from TypeSystem"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Commands), std::move(err), + "Unable to get CompilerType from TypeSystem"); } else { m_compiler_type = type_system_or_err->GetBuiltinTypeForEncodingAndBitSize( diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp index aa55e39..65ed62a 100644 --- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp +++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp @@ -81,7 +81,7 @@ ConstString ValueObjectSynthetic::GetDisplayTypeName() { } size_t ValueObjectSynthetic::CalculateNumChildren(uint32_t max) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS); + Log *log = GetLog(LLDBLog::DataFormatters); UpdateValueIfNeeded(); if (m_synthetic_children_count < UINT32_MAX) @@ -148,7 +148,7 @@ void ValueObjectSynthetic::CreateSynthFilter() { } bool ValueObjectSynthetic::UpdateValue() { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS); + Log *log = GetLog(LLDBLog::DataFormatters); SetValueIsValid(false); m_error.Clear(); @@ -234,7 +234,7 @@ bool ValueObjectSynthetic::UpdateValue() { lldb::ValueObjectSP ValueObjectSynthetic::GetChildAtIndex(size_t idx, bool can_create) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS); + Log *log = GetLog(LLDBLog::DataFormatters); LLDB_LOGF(log, "[ValueObjectSynthetic::GetChildAtIndex] name=%s, retrieving " diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp index f07bb9a..c65e8c6 100644 --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -614,7 +614,7 @@ ImplSP FormatManager::Get(ValueObject &valobj, if (ImplSP retval_sp = GetCached(match_data)) return retval_sp; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); + Log *log = GetLog(LLDBLog::DataFormatters); LLDB_LOGF(log, "[%s] Search failed. Giving language a chance.", __FUNCTION__); for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) { @@ -637,7 +637,7 @@ ImplSP FormatManager::Get(ValueObject &valobj, template ImplSP FormatManager::GetCached(FormattersMatchData &match_data) { ImplSP retval_sp; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); + Log *log = GetLog(LLDBLog::DataFormatters); if (match_data.GetTypeForCache()) { LLDB_LOGF(log, "\n\n[%s] Looking into cache for type %s", __FUNCTION__, match_data.GetTypeForCache().AsCString("")); diff --git a/lldb/source/DataFormatters/TypeCategoryMap.cpp b/lldb/source/DataFormatters/TypeCategoryMap.cpp index a011c54..40af58ee 100644 --- a/lldb/source/DataFormatters/TypeCategoryMap.cpp +++ b/lldb/source/DataFormatters/TypeCategoryMap.cpp @@ -174,7 +174,7 @@ void TypeCategoryMap::Get(FormattersMatchData &match_data, ImplSP &retval) { ActiveCategoriesIterator begin, end = m_active_categories.end(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); + Log *log = GetLog(LLDBLog::DataFormatters); if (log) { for (auto match : match_data.GetMatchesVector()) { diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index ccd41fb..3d43258 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -977,7 +977,7 @@ bool DWARFExpression::Evaluate( uint64_t op_piece_offset = 0; Value pieces; // Used for DW_OP_piece - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); // A generic type is "an integral type that has the size of an address and an // unspecified signedness". For now, just use the signedness of the operand. // TODO: Implement a real typed stack, and store the genericness of the value @@ -2673,7 +2673,7 @@ static DataExtractor ToDataExtractor(const llvm::DWARFLocationExpression &loc, llvm::Optional DWARFExpression::GetLocationExpression(addr_t load_function_start, addr_t addr) const { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *log = GetLog(LLDBLog::Expressions); std::unique_ptr loctable_up = m_dwarf_cu->GetLocationTable(m_data); diff --git a/lldb/source/Expression/ExpressionVariable.cpp b/lldb/source/Expression/ExpressionVariable.cpp index 565a3d1..03cb0e3 100644 --- a/lldb/source/Expression/ExpressionVariable.cpp +++ b/lldb/source/Expression/ExpressionVariable.cpp @@ -41,7 +41,7 @@ lldb::addr_t PersistentExpressionState::LookupSymbol(ConstString name) { void PersistentExpressionState::RegisterExecutionUnit( lldb::IRExecutionUnitSP &execution_unit_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); m_execution_units.insert(execution_unit_sp); diff --git a/lldb/source/Expression/FunctionCaller.cpp b/lldb/source/Expression/FunctionCaller.cpp index 5f34675..f04944a 100644 --- a/lldb/source/Expression/FunctionCaller.cpp +++ b/lldb/source/Expression/FunctionCaller.cpp @@ -218,7 +218,7 @@ bool FunctionCaller::InsertFunction(ExecutionContext &exe_ctx, if (!WriteFunctionArguments(exe_ctx, args_addr_ref, diagnostic_manager)) return false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOGF(log, "Call Address: 0x%" PRIx64 " Struct Address: 0x%" PRIx64 ".\n", m_jit_start_addr, args_addr_ref); @@ -229,8 +229,7 @@ lldb::ThreadPlanSP FunctionCaller::GetThreadPlanToCallFunction( ExecutionContext &exe_ctx, lldb::addr_t args_addr, const EvaluateExpressionOptions &options, DiagnosticManager &diagnostic_manager) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS | - LIBLLDB_LOG_STEP)); + Log *log(GetLog(LLDBLog::Expressions | LLDBLog::Step)); LLDB_LOGF(log, "-- [FunctionCaller::GetThreadPlanToCallFunction] Creating " @@ -269,8 +268,7 @@ bool FunctionCaller::FetchFunctionResults(ExecutionContext &exe_ctx, // then use GetReturnValueObject // to fetch the value. That way we can fetch any values we need. - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS | - LIBLLDB_LOG_STEP)); + Log *log(GetLog(LLDBLog::Expressions | LLDBLog::Step)); LLDB_LOGF(log, "-- [FunctionCaller::FetchFunctionResults] Fetching function " @@ -343,8 +341,7 @@ lldb::ExpressionResults FunctionCaller::ExecuteFunction( return lldb::eExpressionSetupError; } - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS | - LIBLLDB_LOG_STEP)); + Log *log(GetLog(LLDBLog::Expressions | LLDBLog::Step)); LLDB_LOGF(log, "== [FunctionCaller::ExecuteFunction] Executing function \"%s\" ==", diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp index 3c4a87c..e95ee8d 100644 --- a/lldb/source/Expression/IRExecutionUnit.cpp +++ b/lldb/source/Expression/IRExecutionUnit.cpp @@ -70,8 +70,7 @@ lldb::addr_t IRExecutionUnit::WriteNow(const uint8_t *bytes, size_t size, return LLDB_INVALID_ADDRESS; } - if (Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { + if (Log *log = GetLog(LLDBLog::Expressions)) { DataBufferHeap my_buffer(size, 0); Status err; ReadMemory(my_buffer.GetBytes(), allocation_process_addr, size, err); @@ -99,7 +98,7 @@ void IRExecutionUnit::FreeNow(lldb::addr_t allocation) { Status IRExecutionUnit::DisassembleFunction(Stream &stream, lldb::ProcessSP &process_wp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); ExecutionContext exe_ctx(process_wp); @@ -254,7 +253,7 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr, m_did_jit = true; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); std::string error_string; @@ -592,7 +591,7 @@ lldb::SectionType IRExecutionUnit::GetSectionTypeFromSectionName( uint8_t *IRExecutionUnit::MemoryManager::allocateCodeSection( uintptr_t Size, unsigned Alignment, unsigned SectionID, llvm::StringRef SectionName) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); uint8_t *return_value = m_default_mm_up->allocateCodeSection( Size, Alignment, SectionID, SectionName); @@ -622,7 +621,7 @@ uint8_t *IRExecutionUnit::MemoryManager::allocateCodeSection( uint8_t *IRExecutionUnit::MemoryManager::allocateDataSection( uintptr_t Size, unsigned Alignment, unsigned SectionID, llvm::StringRef SectionName, bool IsReadOnly) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); uint8_t *return_value = m_default_mm_up->allocateDataSection( Size, Alignment, SectionID, SectionName, IsReadOnly); @@ -882,7 +881,7 @@ lldb::addr_t IRExecutionUnit::FindSymbol(lldb_private::ConstString name, void IRExecutionUnit::GetStaticInitializers( std::vector &static_initializers) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); llvm::GlobalVariable *global_ctors = m_module->getNamedGlobal("llvm.global_ctors"); @@ -950,7 +949,7 @@ IRExecutionUnit::MemoryManager::getSymbolAddress(const std::string &Name) { uint64_t IRExecutionUnit::MemoryManager::GetSymbolAddressAndPresence( const std::string &Name, bool &missing_weak) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); ConstString name_cs(Name.c_str()); @@ -977,7 +976,7 @@ void *IRExecutionUnit::MemoryManager::getPointerToNamedFunction( lldb::addr_t IRExecutionUnit::GetRemoteAddressForLocal(lldb::addr_t local_address) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); for (AllocationRecord &record : m_records) { if (local_address >= record.m_host_address && diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp index 9b2af56..6c35acd 100644 --- a/lldb/source/Expression/IRInterpreter.cpp +++ b/lldb/source/Expression/IRInterpreter.cpp @@ -41,6 +41,7 @@ #include using namespace llvm; +using lldb_private::LLDBLog; static std::string PrintValue(const Value *value, bool truncate = false) { std::string s; @@ -325,8 +326,7 @@ public: m_values[value] = data_address; - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); if (log) { LLDB_LOGF(log, "Made an allocation for argument %s", @@ -484,8 +484,7 @@ static bool CanResolveConstant(llvm::Constant *constant) { bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function, lldb_private::Status &error, const bool support_function_calls) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); bool saw_function_with_body = false; for (Function &f : module) { @@ -637,8 +636,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, lldb::addr_t stack_frame_bottom, lldb::addr_t stack_frame_top, lldb_private::ExecutionContext &exe_ctx) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); if (log) { std::string s; diff --git a/lldb/source/Expression/IRMemoryMap.cpp b/lldb/source/Expression/IRMemoryMap.cpp index 9eee5cf..88a545b 100644 --- a/lldb/source/Expression/IRMemoryMap.cpp +++ b/lldb/source/Expression/IRMemoryMap.cpp @@ -288,8 +288,7 @@ IRMemoryMap::Allocation::Allocation(lldb::addr_t process_alloc, lldb::addr_t IRMemoryMap::Malloc(size_t size, uint8_t alignment, uint32_t permissions, AllocationPolicy policy, bool zero_memory, Status &error) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); error.Clear(); lldb::ProcessSP process_sp; @@ -476,8 +475,7 @@ void IRMemoryMap::Free(lldb::addr_t process_address, Status &error) { } } - if (lldb_private::Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { + if (lldb_private::Log *log = GetLog(LLDBLog::Expressions)) { LLDB_LOGF(log, "IRMemoryMap::Free (0x%" PRIx64 ") freed [0x%" PRIx64 "..0x%" PRIx64 ")", @@ -574,8 +572,7 @@ void IRMemoryMap::WriteMemory(lldb::addr_t process_address, break; } - if (lldb_private::Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { + if (lldb_private::Log *log = GetLog(LLDBLog::Expressions)) { LLDB_LOGF(log, "IRMemoryMap::WriteMemory (0x%" PRIx64 ", 0x%" PRIxPTR ", 0x%" PRId64 ") went to [0x%" PRIx64 "..0x%" PRIx64 ")", @@ -704,8 +701,7 @@ void IRMemoryMap::ReadMemory(uint8_t *bytes, lldb::addr_t process_address, break; } - if (lldb_private::Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { + if (lldb_private::Log *log = GetLog(LLDBLog::Expressions)) { LLDB_LOGF(log, "IRMemoryMap::ReadMemory (0x%" PRIx64 ", 0x%" PRIxPTR ", 0x%" PRId64 ") came from [0x%" PRIx64 "..0x%" PRIx64 ")", diff --git a/lldb/source/Expression/LLVMUserExpression.cpp b/lldb/source/Expression/LLVMUserExpression.cpp index 527dff8..597c1c9 100644 --- a/lldb/source/Expression/LLVMUserExpression.cpp +++ b/lldb/source/Expression/LLVMUserExpression.cpp @@ -67,8 +67,7 @@ LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager, // The expression log is quite verbose, and if you're just tracking the // execution of the expression, it's quite convenient to have these logs come // out with the STEP log as well. - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS | - LIBLLDB_LOG_STEP)); + Log *log(GetLog(LLDBLog::Expressions | LLDBLog::Step)); if (m_jit_start_addr == LLDB_INVALID_ADDRESS && !m_can_interpret) { diagnostic_manager.PutString( @@ -254,7 +253,7 @@ bool LLVMUserExpression::FinalizeJITExecution( DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx, lldb::ExpressionVariableSP &result, lldb::addr_t function_stack_bottom, lldb::addr_t function_stack_top) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOGF(log, "-- [UserExpression::FinalizeJITExecution] Dematerializing " "after execution --"); diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp index d40365d..6dc20d4 100644 --- a/lldb/source/Expression/Materializer.cpp +++ b/lldb/source/Expression/Materializer.cpp @@ -58,7 +58,7 @@ public: } void MakeAllocation(IRMemoryMap &map, Status &err) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); // Allocate a spare memory area to store the persistent variable's // contents. @@ -138,7 +138,7 @@ public: void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Status &err) override { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); const lldb::addr_t load_addr = process_address + m_offset; @@ -190,7 +190,7 @@ public: void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, lldb::addr_t frame_top, lldb::addr_t frame_bottom, Status &err) override { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); const lldb::addr_t load_addr = process_address + m_offset; @@ -425,7 +425,7 @@ public: void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Status &err) override { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); const lldb::addr_t load_addr = process_address + m_offset; if (log) { @@ -594,7 +594,7 @@ public: void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, lldb::addr_t frame_top, lldb::addr_t frame_bottom, Status &err) override { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); const lldb::addr_t load_addr = process_address + m_offset; if (log) { @@ -1057,7 +1057,7 @@ public: void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Status &err) override { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); const lldb::addr_t load_addr = process_address + m_offset; @@ -1106,7 +1106,7 @@ public: void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, lldb::addr_t frame_top, lldb::addr_t frame_bottom, Status &err) override { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); const lldb::addr_t load_addr = process_address + m_offset; @@ -1176,7 +1176,7 @@ public: void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Status &err) override { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); const lldb::addr_t load_addr = process_address + m_offset; @@ -1239,7 +1239,7 @@ public: void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, lldb::addr_t frame_top, lldb::addr_t frame_bottom, Status &err) override { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); const lldb::addr_t load_addr = process_address + m_offset; @@ -1377,8 +1377,7 @@ Materializer::Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, return DematerializerSP(); } - if (Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { + if (Log *log = GetLog(LLDBLog::Expressions)) { LLDB_LOGF( log, "Materializer::Materialize (frame_sp = %p, process_address = 0x%" PRIx64 @@ -1415,8 +1414,7 @@ void Materializer::Dematerializer::Dematerialize(Status &error, error.SetErrorToGenericError(); error.SetErrorString("Couldn't dematerialize: target is gone"); } else { - if (Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { + if (Log *log = GetLog(LLDBLog::Expressions)) { LLDB_LOGF(log, "Materializer::Dematerialize (frame_sp = %p, process_address " "= 0x%" PRIx64 ") about to dematerialize:", diff --git a/lldb/source/Expression/UserExpression.cpp b/lldb/source/Expression/UserExpression.cpp index 692594b..519f18f 100644 --- a/lldb/source/Expression/UserExpression.cpp +++ b/lldb/source/Expression/UserExpression.cpp @@ -141,8 +141,7 @@ UserExpression::Evaluate(ExecutionContext &exe_ctx, llvm::StringRef expr, llvm::StringRef prefix, lldb::ValueObjectSP &result_valobj_sp, Status &error, std::string *fixed_expression, ValueObject *ctx_obj) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS | - LIBLLDB_LOG_STEP)); + Log *log(GetLog(LLDBLog::Expressions | LLDBLog::Step)); if (ctx_obj) { static unsigned const ctx_type_mask = diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 53a096c..2c43042 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -163,7 +163,7 @@ static bool CheckForMonitorCancellation() { } static thread_result_t MonitorChildProcessThreadFunction(void *arg) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); const char *function = __FUNCTION__; LLDB_LOGF(log, "%s (arg = %p) thread starting...", function, arg); @@ -192,7 +192,7 @@ static thread_result_t MonitorChildProcessThreadFunction(void *arg) { #endif // __linux__ while (true) { - log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); + log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "%s ::waitpid (pid = %" PRIi32 ", &status, options = %i)...", function, pid, options); @@ -243,7 +243,7 @@ static thread_result_t MonitorChildProcessThreadFunction(void *arg) { ScopedPThreadCancelDisabler pthread_cancel_disabler; #endif - log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); + log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "%s ::waitpid (pid = %" PRIi32 ", &status, options = %i) => pid = %" PRIi32 @@ -277,7 +277,7 @@ static thread_result_t MonitorChildProcessThreadFunction(void *arg) { } } - log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); + log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "%s (arg = %p) thread exiting...", __FUNCTION__, arg); return nullptr; @@ -301,7 +301,7 @@ void Host::SystemLog(SystemLogType type, const char *format, ...) { va_end(args); } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST)); + Log *log = GetLog(LLDBLog::Host); if (log && log->GetVerbose()) { // Log to log channel. This allows testcases to grep for log output. va_list args; diff --git a/lldb/source/Host/common/HostInfoBase.cpp b/lldb/source/Host/common/HostInfoBase.cpp index a6239a3..f13719d 100644 --- a/lldb/source/Host/common/HostInfoBase.cpp +++ b/lldb/source/Host/common/HostInfoBase.cpp @@ -119,7 +119,7 @@ FileSpec HostInfoBase::GetShlibDir() { llvm::call_once(g_fields->m_lldb_so_dir_once, []() { if (!HostInfo::ComputeSharedLibraryDirectory(g_fields->m_lldb_so_dir)) g_fields->m_lldb_so_dir = FileSpec(); - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); LLDB_LOG(log, "shlib dir -> `{0}`", g_fields->m_lldb_so_dir); }); return g_fields->m_lldb_so_dir; @@ -129,7 +129,7 @@ FileSpec HostInfoBase::GetSupportExeDir() { llvm::call_once(g_fields->m_lldb_support_exe_dir_once, []() { if (!HostInfo::ComputeSupportExeDirectory(g_fields->m_lldb_support_exe_dir)) g_fields->m_lldb_support_exe_dir = FileSpec(); - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); LLDB_LOG(log, "support exe dir -> `{0}`", g_fields->m_lldb_support_exe_dir); }); return g_fields->m_lldb_support_exe_dir; @@ -139,7 +139,7 @@ FileSpec HostInfoBase::GetHeaderDir() { llvm::call_once(g_fields->m_lldb_headers_dir_once, []() { if (!HostInfo::ComputeHeaderDirectory(g_fields->m_lldb_headers_dir)) g_fields->m_lldb_headers_dir = FileSpec(); - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); LLDB_LOG(log, "header dir -> `{0}`", g_fields->m_lldb_headers_dir); }); return g_fields->m_lldb_headers_dir; @@ -149,7 +149,7 @@ FileSpec HostInfoBase::GetSystemPluginDir() { llvm::call_once(g_fields->m_lldb_system_plugin_dir_once, []() { if (!HostInfo::ComputeSystemPluginsDirectory(g_fields->m_lldb_system_plugin_dir)) g_fields->m_lldb_system_plugin_dir = FileSpec(); - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); LLDB_LOG(log, "system plugin dir -> `{0}`", g_fields->m_lldb_system_plugin_dir); }); @@ -160,7 +160,7 @@ FileSpec HostInfoBase::GetUserPluginDir() { llvm::call_once(g_fields->m_lldb_user_plugin_dir_once, []() { if (!HostInfo::ComputeUserPluginsDirectory(g_fields->m_lldb_user_plugin_dir)) g_fields->m_lldb_user_plugin_dir = FileSpec(); - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); LLDB_LOG(log, "user plugin dir -> `{0}`", g_fields->m_lldb_user_plugin_dir); }); return g_fields->m_lldb_user_plugin_dir; @@ -170,7 +170,7 @@ FileSpec HostInfoBase::GetProcessTempDir() { llvm::call_once(g_fields->m_lldb_process_tmp_dir_once, []() { if (!HostInfo::ComputeProcessTempFileDirectory( g_fields->m_lldb_process_tmp_dir)) g_fields->m_lldb_process_tmp_dir = FileSpec(); - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); LLDB_LOG(log, "process temp dir -> `{0}`", g_fields->m_lldb_process_tmp_dir); }); @@ -182,7 +182,7 @@ FileSpec HostInfoBase::GetGlobalTempDir() { if (!HostInfo::ComputeGlobalTempFileDirectory( g_fields->m_lldb_global_tmp_dir)) g_fields->m_lldb_global_tmp_dir = FileSpec(); - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); LLDB_LOG(log, "global temp dir -> `{0}`", g_fields->m_lldb_global_tmp_dir); }); return g_fields->m_lldb_global_tmp_dir; @@ -211,7 +211,7 @@ ArchSpec HostInfoBase::GetAugmentedArchSpec(llvm::StringRef triple) { bool HostInfoBase::ComputePathRelativeToLibrary(FileSpec &file_spec, llvm::StringRef dir) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); FileSpec lldb_file_spec = GetShlibDir(); if (!lldb_file_spec) diff --git a/lldb/source/Host/common/HostNativeThreadBase.cpp b/lldb/source/Host/common/HostNativeThreadBase.cpp index b8223e3..71958c9 100644 --- a/lldb/source/Host/common/HostNativeThreadBase.cpp +++ b/lldb/source/Host/common/HostNativeThreadBase.cpp @@ -58,7 +58,7 @@ HostNativeThreadBase::ThreadCreateTrampoline(lldb::thread_arg_t arg) { thread_func_t thread_fptr = info->thread_fptr; thread_arg_t thread_arg = info->thread_arg; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); LLDB_LOGF(log, "thread created"); delete info; diff --git a/lldb/source/Host/common/MonitoringProcessLauncher.cpp b/lldb/source/Host/common/MonitoringProcessLauncher.cpp index 1ef345c..ea854e9 100644 --- a/lldb/source/Host/common/MonitoringProcessLauncher.cpp +++ b/lldb/source/Host/common/MonitoringProcessLauncher.cpp @@ -50,7 +50,7 @@ MonitoringProcessLauncher::LaunchProcess(const ProcessLaunchInfo &launch_info, m_delegate_launcher->LaunchProcess(resolved_info, error); if (process.GetProcessId() != LLDB_INVALID_PROCESS_ID) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); assert(launch_info.GetMonitorProcessCallback()); llvm::Expected maybe_thread = diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp index ea80a05..e06adb4 100644 --- a/lldb/source/Host/common/NativeProcessProtocol.cpp +++ b/lldb/source/Host/common/NativeProcessProtocol.cpp @@ -74,7 +74,7 @@ llvm::Optional NativeProcessProtocol::GetExitStatus() { bool NativeProcessProtocol::SetExitStatus(WaitStatus status, bool bNotifyStateChange) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOG(log, "status = {0}, notify = {1}", status, bNotifyStateChange); // Exit status already set @@ -128,7 +128,7 @@ NativeProcessProtocol::GetWatchpointMap() const { llvm::Optional> NativeProcessProtocol::GetHardwareDebugSupportInfo() const { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // get any thread NativeThreadProtocol *thread( @@ -152,7 +152,7 @@ Status NativeProcessProtocol::SetWatchpoint(lldb::addr_t addr, size_t size, // thread that is attached to via the (FIXME implement) OnThreadAttached () // method. - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // Update the thread list UpdateThreads(); @@ -236,7 +236,7 @@ Status NativeProcessProtocol::SetHardwareBreakpoint(lldb::addr_t addr, // This default implementation assumes setting a hardware breakpoint for this // process will require setting same hardware breakpoint for each of its // existing threads. New thread will do the same once created. - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // Update the thread list UpdateThreads(); @@ -308,7 +308,7 @@ Status NativeProcessProtocol::RemoveHardwareBreakpoint(lldb::addr_t addr) { void NativeProcessProtocol::SynchronouslyNotifyProcessStateChanged( lldb::StateType state) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); m_delegate.ProcessStateChanged(this, state); @@ -317,7 +317,7 @@ void NativeProcessProtocol::SynchronouslyNotifyProcessStateChanged( } void NativeProcessProtocol::NotifyDidExec() { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOG(log, "process {0} exec()ed", GetID()); m_delegate.DidExec(this); @@ -325,7 +325,7 @@ void NativeProcessProtocol::NotifyDidExec() { Status NativeProcessProtocol::SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOG(log, "addr = {0:x}, size_hint = {1}", addr, size_hint); auto it = m_software_breakpoints.find(addr); @@ -342,7 +342,7 @@ Status NativeProcessProtocol::SetSoftwareBreakpoint(lldb::addr_t addr, } Status NativeProcessProtocol::RemoveSoftwareBreakpoint(lldb::addr_t addr) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOG(log, "addr = {0:x}", addr); auto it = m_software_breakpoints.find(addr); if (it == m_software_breakpoints.end()) @@ -408,7 +408,7 @@ Status NativeProcessProtocol::RemoveSoftwareBreakpoint(lldb::addr_t addr) { llvm::Expected NativeProcessProtocol::EnableSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); auto expected_trap = GetSoftwareBreakpointTrapOpcode(size_hint); if (!expected_trap) @@ -554,7 +554,7 @@ size_t NativeProcessProtocol::GetSoftwareBreakpointPCOffset() { void NativeProcessProtocol::FixupBreakpointPCAsNeeded( NativeThreadProtocol &thread) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); + Log *log = GetLog(LLDBLog::Breakpoints); Status error; diff --git a/lldb/source/Host/common/NativeRegisterContext.cpp b/lldb/source/Host/common/NativeRegisterContext.cpp index d0afc2b..e733a0e 100644 --- a/lldb/source/Host/common/NativeRegisterContext.cpp +++ b/lldb/source/Host/common/NativeRegisterContext.cpp @@ -122,7 +122,7 @@ const char *NativeRegisterContext::GetRegisterSetNameForRegisterAtIndex( } lldb::addr_t NativeRegisterContext::GetPC(lldb::addr_t fail_value) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); uint32_t reg = ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC); @@ -197,7 +197,7 @@ NativeRegisterContext::ReadRegisterAsUnsigned(uint32_t reg, uint64_t NativeRegisterContext::ReadRegisterAsUnsigned(const RegisterInfo *reg_info, lldb::addr_t fail_value) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); if (reg_info) { RegisterValue value; diff --git a/lldb/source/Host/common/ProcessLaunchInfo.cpp b/lldb/source/Host/common/ProcessLaunchInfo.cpp index 07e4f15..145c0e9 100644 --- a/lldb/source/Host/common/ProcessLaunchInfo.cpp +++ b/lldb/source/Host/common/ProcessLaunchInfo.cpp @@ -183,7 +183,7 @@ void ProcessLaunchInfo::SetMonitorProcessCallback( } bool ProcessLaunchInfo::NoOpMonitorCallback(lldb::pid_t pid, bool exited, int signal, int status) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); + Log *log = GetLog(LLDBLog::Process); LLDB_LOG(log, "pid = {0}, exited = {1}, signal = {2}, status = {3}", pid, exited, signal, status); return true; @@ -195,8 +195,7 @@ bool ProcessLaunchInfo::MonitorProcess() const { Host::StartMonitoringChildProcess(m_monitor_callback, GetProcessID(), m_monitor_signals); if (!maybe_thread) - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), - "failed to launch host thread: {}", + LLDB_LOG(GetLog(LLDBLog::Host), "failed to launch host thread: {}", llvm::toString(maybe_thread.takeError())); return true; } @@ -211,7 +210,7 @@ void ProcessLaunchInfo::SetDetachOnError(bool enable) { } llvm::Error ProcessLaunchInfo::SetUpPtyRedirection() { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); + Log *log = GetLog(LLDBLog::Process); bool stdin_free = GetFileActionForFD(STDIN_FILENO) == nullptr; bool stdout_free = GetFileActionForFD(STDOUT_FILENO) == nullptr; diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp index d8b8f54a..591a94f 100644 --- a/lldb/source/Host/common/Socket.cpp +++ b/lldb/source/Host/common/Socket.cpp @@ -146,7 +146,7 @@ std::unique_ptr Socket::Create(const SocketProtocol protocol, llvm::Expected> Socket::TcpConnect(llvm::StringRef host_and_port, bool child_processes_inherit) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); LLDB_LOG(log, "host_and_port = {0}", host_and_port); Status error; @@ -165,7 +165,7 @@ Socket::TcpConnect(llvm::StringRef host_and_port, llvm::Expected> Socket::TcpListen(llvm::StringRef host_and_port, bool child_processes_inherit, int backlog) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); LLDB_LOG(log, "host_and_port = {0}", host_and_port); std::unique_ptr listen_socket( @@ -225,7 +225,7 @@ Status Socket::Read(void *buf, size_t &num_bytes) { } else num_bytes = bytes_received; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION)); + Log *log = GetLog(LLDBLog::Communication); if (log) { LLDB_LOGF(log, "%p Socket::Read() (socket = %" PRIu64 @@ -253,7 +253,7 @@ Status Socket::Write(const void *buf, size_t &num_bytes) { } else num_bytes = bytes_sent; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION)); + Log *log = GetLog(LLDBLog::Communication); if (log) { LLDB_LOGF(log, "%p Socket::Write() (socket = %" PRIu64 @@ -277,7 +277,7 @@ Status Socket::Close() { if (!IsValid() || !m_should_close_fd) return error; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); LLDB_LOGF(log, "%p Socket::Close (fd = %" PRIu64 ")", static_cast(this), static_cast(m_socket)); diff --git a/lldb/source/Host/common/TCPSocket.cpp b/lldb/source/Host/common/TCPSocket.cpp index 28c3fa1..f8a8627 100644 --- a/lldb/source/Host/common/TCPSocket.cpp +++ b/lldb/source/Host/common/TCPSocket.cpp @@ -148,7 +148,7 @@ Status TCPSocket::CreateSocket(int domain) { Status TCPSocket::Connect(llvm::StringRef name) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION)); + Log *log = GetLog(LLDBLog::Communication); LLDB_LOGF(log, "TCPSocket::%s (host/port = %s)", __FUNCTION__, name.data()); Status error; @@ -184,7 +184,7 @@ Status TCPSocket::Connect(llvm::StringRef name) { } Status TCPSocket::Listen(llvm::StringRef name, int backlog) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); LLDB_LOGF(log, "TCPSocket::%s (%s)", __FUNCTION__, name.data()); Status error; diff --git a/lldb/source/Host/common/UDPSocket.cpp b/lldb/source/Host/common/UDPSocket.cpp index 31266c9..e73dd75 100644 --- a/lldb/source/Host/common/UDPSocket.cpp +++ b/lldb/source/Host/common/UDPSocket.cpp @@ -54,7 +54,7 @@ llvm::Expected> UDPSocket::Connect(llvm::StringRef name, bool child_processes_inherit) { std::unique_ptr socket; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); LLDB_LOG(log, "host/port = {0}", name); Status error; diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp index dabebf5..8f5dc3a 100644 --- a/lldb/source/Host/linux/Host.cpp +++ b/lldb/source/Host/linux/Host.cpp @@ -56,7 +56,7 @@ class ProcessLaunchInfo; static bool GetStatusInfo(::pid_t Pid, ProcessInstanceInfo &ProcessInfo, ProcessState &State, ::pid_t &TracerPid, ::pid_t &Tgid) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); auto BufferOrError = getProcFile(Pid, "status"); if (!BufferOrError) @@ -126,7 +126,7 @@ static bool IsDirNumeric(const char *dname) { } static ArchSpec GetELFProcessCPUType(llvm::StringRef exe_path) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); auto buffer_sp = FileSystem::Instance().CreateDataBuffer(exe_path, 0x20, 0); if (!buffer_sp) @@ -165,7 +165,7 @@ static void GetProcessArgs(::pid_t pid, ProcessInstanceInfo &process_info) { } static void GetExePathAndArch(::pid_t pid, ProcessInstanceInfo &process_info) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); std::string ExePath(PATH_MAX, '\0'); // We can't use getProcFile here because proc/[pid]/exe is a symbolic link. diff --git a/lldb/source/Host/linux/HostInfoLinux.cpp b/lldb/source/Host/linux/HostInfoLinux.cpp index fa82da2..7bf8b4b 100644 --- a/lldb/source/Host/linux/HostInfoLinux.cpp +++ b/lldb/source/Host/linux/HostInfoLinux.cpp @@ -80,8 +80,7 @@ llvm::StringRef HostInfoLinux::GetDistributionId() { // Try to run 'lbs_release -i', and use that response for the distribution // id. llvm::call_once(g_fields->m_distribution_once_flag, []() { - - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST)); + Log *log = GetLog(LLDBLog::Host); LLDB_LOGF(log, "attempting to determine Linux distribution..."); // check if the lsb_release command exists at one of the following paths diff --git a/lldb/source/Host/linux/Support.cpp b/lldb/source/Host/linux/Support.cpp index c71824c..df3b6f8 100644 --- a/lldb/source/Host/linux/Support.cpp +++ b/lldb/source/Host/linux/Support.cpp @@ -12,7 +12,7 @@ llvm::ErrorOr> lldb_private::getProcFile(::pid_t pid, ::pid_t tid, const llvm::Twine &file) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); std::string File = ("/proc/" + llvm::Twine(pid) + "/task/" + llvm::Twine(tid) + "/" + file) .str(); @@ -24,7 +24,7 @@ lldb_private::getProcFile(::pid_t pid, ::pid_t tid, const llvm::Twine &file) { llvm::ErrorOr> lldb_private::getProcFile(::pid_t pid, const llvm::Twine &file) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); std::string File = ("/proc/" + llvm::Twine(pid) + "/" + file).str(); auto Ret = llvm::MemoryBuffer::getFileAsStream(File); if (!Ret) @@ -34,7 +34,7 @@ lldb_private::getProcFile(::pid_t pid, const llvm::Twine &file) { llvm::ErrorOr> lldb_private::getProcFile(const llvm::Twine &file) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); std::string File = ("/proc/" + file).str(); auto Ret = llvm::MemoryBuffer::getFileAsStream(File); if (!Ret) diff --git a/lldb/source/Host/macosx/objcxx/Host.mm b/lldb/source/Host/macosx/objcxx/Host.mm index 7225979..b687760 100644 --- a/lldb/source/Host/macosx/objcxx/Host.mm +++ b/lldb/source/Host/macosx/objcxx/Host.mm @@ -322,7 +322,7 @@ bool Host::OpenFileInExternalEditor(const FileSpec &file_spec, uint32_t reserved2; // must be zero } BabelAESelInfo; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_HOST)); + Log *log = GetLog(LLDBLog::Host); char file_path[PATH_MAX]; file_spec.GetPath(file_path, PATH_MAX); CFCString file_cfstr(file_path, kCFStringEncodingUTF8); @@ -721,8 +721,7 @@ static void PackageXPCEnvironment(xpc_object_t message, llvm::StringRef prefix, static AuthorizationRef authorizationRef = NULL; static Status getXPCAuthorization(ProcessLaunchInfo &launch_info) { Status error; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::Host | LLDBLog::Process)); if ((launch_info.GetUserID() == 0) && !authorizationRef) { OSStatus createStatus = @@ -843,8 +842,7 @@ static Status LaunchProcessXPC(const char *exe_path, if (error.Fail()) return error; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::Host | LLDBLog::Process)); uid_t requested_uid = launch_info.GetUserID(); const char *xpc_service = nil; @@ -1053,8 +1051,7 @@ static Status LaunchProcessPosixSpawn(const char *exe_path, const ProcessLaunchInfo &launch_info, lldb::pid_t &pid) { Status error; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::Host | LLDBLog::Process)); posix_spawnattr_t attr; error.SetError(::posix_spawnattr_init(&attr), eErrorTypePOSIX); @@ -1436,8 +1433,7 @@ llvm::Expected Host::StartMonitoringChildProcess( if (monitor_signals) mask |= DISPATCH_PROC_SIGNAL; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_HOST | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::Host | LLDBLog::Process)); dispatch_source_t source = ::dispatch_source_create( DISPATCH_SOURCE_TYPE_PROC, pid, mask, diff --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm index 6d02555..12355f0 100644 --- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm +++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm @@ -144,7 +144,7 @@ bool HostInfoMacOSX::ComputeSupportExeDirectory(FileSpec &file_spec) { FileSpec support_dir_spec(raw_path); FileSystem::Instance().Resolve(support_dir_spec); if (!FileSystem::Instance().IsDirectory(support_dir_spec)) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); LLDB_LOGF(log, "HostInfoMacOSX::%s(): failed to find support directory", __FUNCTION__); return false; @@ -443,7 +443,7 @@ static std::string GetXcodeSDK(XcodeSDK sdk) { if (!path.empty()) break; } - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); LLDB_LOGF(log, "Couldn't find SDK %s on host", sdk_name.c_str()); // Try without the version. diff --git a/lldb/source/Host/netbsd/HostNetBSD.cpp b/lldb/source/Host/netbsd/HostNetBSD.cpp index af31a11..4cb63bd 100644 --- a/lldb/source/Host/netbsd/HostNetBSD.cpp +++ b/lldb/source/Host/netbsd/HostNetBSD.cpp @@ -101,7 +101,7 @@ static bool GetNetBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr, } static bool GetNetBSDProcessCPUType(ProcessInstanceInfo &process_info) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); if (process_info.ProcessIDIsValid()) { auto buffer_sp = FileSystem::Instance().CreateDataBuffer( diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp index b3140f7..6be2da1 100644 --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -54,8 +54,7 @@ ConnectionFileDescriptor::ConnectionFileDescriptor(bool child_processes_inherit) : Connection(), m_pipe(), m_mutex(), m_shutting_down(false), m_child_processes_inherit(child_processes_inherit) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION | - LIBLLDB_LOG_OBJECT)); + Log *log(GetLog(LLDBLog::Connection | LLDBLog::Object)); LLDB_LOGF(log, "%p ConnectionFileDescriptor::ConnectionFileDescriptor ()", static_cast(this)); } @@ -66,8 +65,7 @@ ConnectionFileDescriptor::ConnectionFileDescriptor(int fd, bool owns_fd) m_io_sp = std::make_shared(fd, File::eOpenOptionReadWrite, owns_fd); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION | - LIBLLDB_LOG_OBJECT)); + Log *log(GetLog(LLDBLog::Connection | LLDBLog::Object)); LLDB_LOGF(log, "%p ConnectionFileDescriptor::ConnectionFileDescriptor (fd = " "%i, owns_fd = %i)", @@ -82,8 +80,7 @@ ConnectionFileDescriptor::ConnectionFileDescriptor(Socket *socket) } ConnectionFileDescriptor::~ConnectionFileDescriptor() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION | - LIBLLDB_LOG_OBJECT)); + Log *log(GetLog(LLDBLog::Connection | LLDBLog::Object)); LLDB_LOGF(log, "%p ConnectionFileDescriptor::~ConnectionFileDescriptor ()", static_cast(this)); Disconnect(nullptr); @@ -93,7 +90,7 @@ ConnectionFileDescriptor::~ConnectionFileDescriptor() { void ConnectionFileDescriptor::OpenCommandPipe() { CloseCommandPipe(); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); // Make the command file descriptor here: Status result = m_pipe.CreateNew(m_child_processes_inherit); if (!result.Success()) { @@ -111,7 +108,7 @@ void ConnectionFileDescriptor::OpenCommandPipe() { } void ConnectionFileDescriptor::CloseCommandPipe() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); LLDB_LOGF(log, "%p ConnectionFileDescriptor::CloseCommandPipe()", static_cast(this)); @@ -132,7 +129,7 @@ ConnectionFileDescriptor::Connect(llvm::StringRef path, socket_id_callback_type socket_id_callback, Status *error_ptr) { std::lock_guard guard(m_mutex); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); LLDB_LOGF(log, "%p ConnectionFileDescriptor::Connect (url = '%s')", static_cast(this), path.str().c_str()); @@ -189,7 +186,7 @@ bool ConnectionFileDescriptor::InterruptRead() { } ConnectionStatus ConnectionFileDescriptor::Disconnect(Status *error_ptr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); LLDB_LOGF(log, "%p ConnectionFileDescriptor::Disconnect ()", static_cast(this)); @@ -250,7 +247,7 @@ size_t ConnectionFileDescriptor::Read(void *dst, size_t dst_len, const Timeout &timeout, ConnectionStatus &status, Status *error_ptr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); std::unique_lock locker(m_mutex, std::defer_lock); if (!locker.try_lock()) { @@ -358,7 +355,7 @@ size_t ConnectionFileDescriptor::Read(void *dst, size_t dst_len, size_t ConnectionFileDescriptor::Write(const void *src, size_t src_len, ConnectionStatus &status, Status *error_ptr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); LLDB_LOGF(log, "%p ConnectionFileDescriptor::Write (src = %p, src_len = %" PRIu64 ")", @@ -446,7 +443,7 @@ ConnectionFileDescriptor::BytesAvailable(const Timeout &timeout, // Read. If we ever get used more generally we will need to lock here as // well. - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); LLDB_LOG(log, "this = {0}, timeout = {1}", this, timeout); // Make a copy of the file descriptors to make sure we don't have another @@ -656,8 +653,8 @@ ConnectionFileDescriptor::ConnectUDP(llvm::StringRef s, if (error_ptr) *error_ptr = socket.takeError(); else - LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION), - socket.takeError(), "tcp connect failed: {0}"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Connection), socket.takeError(), + "tcp connect failed: {0}"); return eConnectionStatusError; } m_io_sp = std::move(*socket); diff --git a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp index 817663d..3a32f08 100644 --- a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp +++ b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp @@ -90,7 +90,7 @@ bool ConnectionGenericFile::IsConnected() const { lldb::ConnectionStatus ConnectionGenericFile::Connect(llvm::StringRef path, Status *error_ptr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); LLDB_LOGF(log, "%p ConnectionGenericFile::Connect (url = '%s')", static_cast(this), path.str().c_str()); @@ -132,7 +132,7 @@ lldb::ConnectionStatus ConnectionGenericFile::Connect(llvm::StringRef path, } lldb::ConnectionStatus ConnectionGenericFile::Disconnect(Status *error_ptr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); LLDB_LOGF(log, "%p ConnectionGenericFile::Disconnect ()", static_cast(this)); @@ -244,7 +244,7 @@ finish: ResetEvent(m_event_handles[kBytesAvailableEvent]); IncrementFilePointer(return_info.GetBytes()); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); LLDB_LOGF(log, "%p ConnectionGenericFile::Read() handle = %p, dst = %p, " "dst_len = %zu) => %zu, error = %s", @@ -293,7 +293,7 @@ finish: *error_ptr = return_info.GetError(); IncrementFilePointer(return_info.GetBytes()); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log = GetLog(LLDBLog::Connection); LLDB_LOGF(log, "%p ConnectionGenericFile::Write() handle = %p, src = %p, " "src_len = %zu) => %zu, error = %s", diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 59c2371..7f028f1 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1825,7 +1825,7 @@ bool CommandInterpreter::HandleCommand(const char *command_line, std::string command_string(command_line); std::string original_command_string(command_line); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMANDS)); + Log *log = GetLog(LLDBLog::Commands); llvm::PrettyStackTraceFormat stack_trace("HandleCommand(command = \"%s\")", command_line); @@ -3122,8 +3122,8 @@ bool CommandInterpreter::SaveTranscript( } auto error_out = [&](llvm::StringRef error_message, std::string description) { - LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMANDS), "{0} ({1}:{2})", - error_message, output_file, description); + LLDB_LOG(GetLog(LLDBLog::Commands), "{0} ({1}:{2})", error_message, + output_file, description); result.AppendErrorWithFormatv( "Failed to save session's transcripts to {0}!", *output_file); return false; diff --git a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp index 804532a..37e2b79b 100644 --- a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp +++ b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp @@ -62,7 +62,7 @@ bool ABIMacOSX_arm64::PrepareTrivialCall( if (!reg_ctx) return false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (log) { StreamString s; diff --git a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp index 9592415..7fff364 100644 --- a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp +++ b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp @@ -65,7 +65,7 @@ bool ABISysV_arm64::PrepareTrivialCall(Thread &thread, addr_t sp, if (!reg_ctx) return false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (log) { StreamString s; diff --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp index 662689c..dab46b9 100644 --- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp +++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp @@ -529,7 +529,7 @@ ABISysV_mips::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) { bool ABISysV_mips::PrepareTrivialCall(Thread &thread, addr_t sp, addr_t func_addr, addr_t return_addr, llvm::ArrayRef args) const { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (log) { StreamString s; diff --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp index 7e27226..8091163 100644 --- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp +++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp @@ -526,7 +526,7 @@ ABISysV_mips64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) bool ABISysV_mips64::PrepareTrivialCall(Thread &thread, addr_t sp, addr_t func_addr, addr_t return_addr, llvm::ArrayRef args) const { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (log) { StreamString s; diff --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp index 70b9c46..abd10f6 100644 --- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp +++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp @@ -228,7 +228,7 @@ ABISysV_ppc::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) { bool ABISysV_ppc::PrepareTrivialCall(Thread &thread, addr_t sp, addr_t func_addr, addr_t return_addr, llvm::ArrayRef args) const { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (log) { StreamString s; diff --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp index f9a2851..615a2c3 100644 --- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp +++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp @@ -80,7 +80,7 @@ ABISysV_ppc64::CreateInstance(lldb::ProcessSP process_sp, bool ABISysV_ppc64::PrepareTrivialCall(Thread &thread, addr_t sp, addr_t func_addr, addr_t return_addr, llvm::ArrayRef args) const { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (log) { StreamString s; @@ -478,8 +478,7 @@ class ReturnValueExtractor { Type m_type; RegisterContext *m_reg_ctx; ByteOrder m_byte_order; - Log *m_log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *m_log = GetLog(LLDBLog::Expressions); }; Register GetGPR(uint32_t index) const { @@ -555,7 +554,7 @@ private: int32_t m_src_offs = 0; int32_t m_dst_offs = 0; bool m_packed = false; - Log *m_log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *m_log = GetLog(LLDBLog::Expressions); RegisterContext *m_reg_ctx; ProcessSP m_process_sp; ByteOrder m_byte_order; @@ -934,7 +933,7 @@ ABISysV_ppc64::GetReturnValueObjectSimple(Thread &thread, auto exp_extractor = ReturnValueExtractor::Create(thread, type); if (!exp_extractor) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOG_ERROR(log, exp_extractor.takeError(), "Extracting return value failed: {0}"); return ValueObjectSP(); diff --git a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp index f8156de..584f63a 100644 --- a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp +++ b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp @@ -195,7 +195,7 @@ ABISysV_s390x::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) bool ABISysV_s390x::PrepareTrivialCall(Thread &thread, addr_t sp, addr_t func_addr, addr_t return_addr, llvm::ArrayRef args) const { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (log) { StreamString s; diff --git a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp index b51ee5c..4b9fb0a 100644 --- a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp +++ b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp @@ -107,7 +107,7 @@ ABISysV_x86_64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) bool ABISysV_x86_64::PrepareTrivialCall(Thread &thread, addr_t sp, addr_t func_addr, addr_t return_addr, llvm::ArrayRef args) const { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (log) { StreamString s; diff --git a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp index 5e8f8b1..6d99796 100644 --- a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp +++ b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp @@ -123,7 +123,7 @@ ABIWindows_x86_64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &ar bool ABIWindows_x86_64::PrepareTrivialCall(Thread &thread, addr_t sp, addr_t func_addr, addr_t return_addr, llvm::ArrayRef args) const { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (log) { StreamString s; diff --git a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp index 865c72f..433f585 100644 --- a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp +++ b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp @@ -71,7 +71,7 @@ addr_t ArchitectureMips::GetOpcodeLoadAddress(addr_t opcode_addr, lldb::addr_t ArchitectureMips::GetBreakableLoadAddress(lldb::addr_t addr, Target &target) const { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); Address resolved_addr; diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp index edc5f00..b9b3081 100644 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -795,8 +795,7 @@ public: } } - if (Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)) { + if (Log *log = GetLog(LLDBLog::Process)) { StreamString ss; ss.Printf("[%s] expands to %zu operands:\n", operands_string, diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index a5abce7..a6f8ccc 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -434,7 +434,7 @@ lldb_private::UUID DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress(lldb::addr_t addr, Process *process, bool *read_error) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); if (addr == LLDB_INVALID_ADDRESS) { if (read_error) *read_error = true; @@ -645,7 +645,7 @@ UUID DynamicLoaderDarwinKernel::KextImageInfo::GetUUID() const { bool DynamicLoaderDarwinKernel::KextImageInfo::ReadMemoryModule( Process *process) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); if (m_memory_module_sp.get() != nullptr) return true; if (m_load_address == LLDB_INVALID_ADDRESS) @@ -756,7 +756,7 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule( // for the kernel, we'll need to read the load commands out of memory to get it. if (m_uuid.IsValid() == false) { if (ReadMemoryModule(process) == false) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOGF(log, "Unable to read '%s' from memory at address 0x%" PRIx64 " to get the segment load addresses.", @@ -1062,7 +1062,7 @@ bool DynamicLoaderDarwinKernel::BreakpointHitCallback( bool DynamicLoaderDarwinKernel::BreakpointHit(StoppointCallbackContext *context, user_id_t break_id, user_id_t break_loc_id) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOGF(log, "DynamicLoaderDarwinKernel::BreakpointHit (...)\n"); ReadAllKextSummaries(); @@ -1158,7 +1158,7 @@ bool DynamicLoaderDarwinKernel::ReadKextSummaryHeader() { bool DynamicLoaderDarwinKernel::ParseKextSummaries( const Address &kext_summary_addr, uint32_t count) { KextImageInfo::collection kext_summaries; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOGF(log, "Kexts-changed breakpoint hit, there are %d kexts currently.\n", count); @@ -1514,7 +1514,7 @@ ThreadPlanSP DynamicLoaderDarwinKernel::GetStepThroughTrampolinePlan(Thread &thread, bool stop_others) { ThreadPlanSP thread_plan_sp; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOGF(log, "Could not find symbol for step through."); return thread_plan_sp; } diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp index 82c50a3..d1a27a6 100644 --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp @@ -254,7 +254,7 @@ void DynamicLoaderHexagonDYLD::UnloadSections(const ModuleSP module) { // Place a breakpoint on <_rtld_debug_state> bool DynamicLoaderHexagonDYLD::SetRendezvousBreakpoint() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); // This is the original code, which want to look in the rendezvous structure // to find the breakpoint address. Its backwards for us, since we can easily @@ -304,7 +304,7 @@ bool DynamicLoaderHexagonDYLD::SetRendezvousBreakpoint() { bool DynamicLoaderHexagonDYLD::RendezvousBreakpointHit( void *baton, StoppointCallbackContext *context, user_id_t break_id, user_id_t break_loc_id) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOGF(log, "Rendezvous breakpoint hit!"); @@ -337,7 +337,7 @@ bool DynamicLoaderHexagonDYLD::RendezvousBreakpointHit( /// Helper method for RendezvousBreakpointHit. Updates LLDB's current set /// of loaded modules. void DynamicLoaderHexagonDYLD::RefreshModules() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); if (!m_rendezvous.Resolve()) return; @@ -457,7 +457,7 @@ void DynamicLoaderHexagonDYLD::LoadAllCurrentModules() { ModuleList module_list; if (!m_rendezvous.Resolve()) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOGF( log, "DynamicLoaderHexagonDYLD::%s unable to resolve rendezvous address", @@ -478,7 +478,7 @@ void DynamicLoaderHexagonDYLD::LoadAllCurrentModules() { if (module_sp.get()) { module_list.Append(module_sp); } else { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOGF(log, "DynamicLoaderHexagonDYLD::%s failed loading module %s at " "0x%" PRIx64, @@ -589,7 +589,7 @@ DynamicLoaderHexagonDYLD::GetThreadLocalData(const lldb::ModuleSP module, addr_t tls_block = ReadPointer(dtv_slot + metadata.tls_offset); Module *mod = module.get(); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOGF(log, "DynamicLoaderHexagonDYLD::Performed TLS lookup: " "module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64 diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index 319d0ea..f51f8f5b 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -166,7 +166,7 @@ void DynamicLoaderDarwin::UnloadImages( if (m_process->GetStopID() == m_dyld_image_infos_stop_id) return; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); Target &target = m_process->GetTarget(); LLDB_LOGF(log, "Removing %" PRId64 " modules.", (uint64_t)solib_addresses.size()); @@ -209,7 +209,7 @@ void DynamicLoaderDarwin::UnloadImages( } void DynamicLoaderDarwin::UnloadAllImages() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); ModuleList unloaded_modules_list; Target &target = m_process->GetTarget(); @@ -533,7 +533,7 @@ void DynamicLoaderDarwin::UpdateSpecialBinariesFromNewImageInfos( uint32_t exe_idx = UINT32_MAX; uint32_t dyld_idx = UINT32_MAX; Target &target = m_process->GetTarget(); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); ConstString g_dyld_sim_filename("dyld_sim"); ArchSpec target_arch = target.GetArchitecture(); @@ -615,7 +615,7 @@ bool DynamicLoaderDarwin::AddModulesUsingImageInfos( std::lock_guard guard(m_mutex); // Now add these images to the main list. ModuleList loaded_module_list; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); Target &target = m_process->GetTarget(); ModuleList &target_images = target.GetImages(); @@ -850,7 +850,7 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread, const SymbolContext ¤t_context = current_frame->GetSymbolContext(eSymbolContextSymbol); Symbol *current_symbol = current_context.symbol; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); TargetSP target_sp(thread.CalculateTarget()); if (current_symbol != nullptr) { @@ -1134,7 +1134,7 @@ DynamicLoaderDarwin::GetThreadLocalData(const lldb::ModuleSP module_sp, } bool DynamicLoaderDarwin::UseDYLDSPI(Process *process) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); bool use_new_spi_interface = false; llvm::VersionTuple version = process->GetHostOSVersion(); diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp index a9033d1..b6ced65 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -155,7 +155,7 @@ void DynamicLoaderMacOS::ClearNotificationBreakpoint() { // (available on SnowLeopard only). If that fails, then check in the default // addresses. void DynamicLoaderMacOS::DoInitialImageFetch() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); // Remove any binaries we pre-loaded in the Target before // launching/attaching. If the same binaries are present in the process, @@ -310,7 +310,7 @@ bool DynamicLoaderMacOS::NotifyBreakpointHit(void *baton, void DynamicLoaderMacOS::AddBinaries( const std::vector &load_addresses) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); ImageInfo::collection image_infos; LLDB_LOGF(log, "Adding %" PRId64 " modules.", diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index 866b89f..1cf70c5 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -533,7 +533,7 @@ bool DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure() { bool DynamicLoaderMacOSXDYLD::AddModulesUsingImageInfosAddress( lldb::addr_t image_infos_addr, uint32_t image_infos_count) { ImageInfo::collection image_infos; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOGF(log, "Adding %d modules.\n", image_infos_count); std::lock_guard guard(m_mutex); @@ -574,7 +574,7 @@ bool DynamicLoaderMacOSXDYLD::AddModulesUsingImageInfosAddress( bool DynamicLoaderMacOSXDYLD::RemoveModulesUsingImageInfosAddress( lldb::addr_t image_infos_addr, uint32_t image_infos_count) { ImageInfo::collection image_infos; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); std::lock_guard guard(m_mutex); std::lock_guard baseclass_guard(GetMutex()); @@ -698,7 +698,7 @@ bool DynamicLoaderMacOSXDYLD::ReadImageInfos( // thereof). Only do this if this is the first time we're reading the dyld // infos. Return true if we actually read anything, and false otherwise. bool DynamicLoaderMacOSXDYLD::InitializeFromAllImageInfos() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); std::lock_guard guard(m_mutex); std::lock_guard baseclass_guard(GetMutex()); diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp index 7e80dc2..9b00eb6 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp @@ -34,7 +34,7 @@ DYLDRendezvous::DYLDRendezvous(Process *process) } addr_t DYLDRendezvous::ResolveRendezvousAddress() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); addr_t info_location; addr_t info_addr; Status error; @@ -113,7 +113,7 @@ addr_t DYLDRendezvous::ResolveRendezvousAddress() { void DYLDRendezvous::UpdateExecutablePath() { if (m_process) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); Module *exe_mod = m_process->GetTarget().GetExecutableModulePointer(); if (exe_mod) { m_exe_file_spec = exe_mod->GetPlatformFileSpec(); @@ -129,7 +129,7 @@ void DYLDRendezvous::UpdateExecutablePath() { } bool DYLDRendezvous::Resolve() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); const size_t word_size = 4; Rendezvous info; diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 188b6da..5d1eab5 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -76,7 +76,7 @@ DynamicLoaderPOSIXDYLD::~DynamicLoaderPOSIXDYLD() { } void DynamicLoaderPOSIXDYLD::DidAttach() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s() pid %" PRIu64, __FUNCTION__, m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID); m_auxv = std::make_unique(m_process->GetAuxvData()); @@ -166,7 +166,7 @@ void DynamicLoaderPOSIXDYLD::DidAttach() { } void DynamicLoaderPOSIXDYLD::DidLaunch() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s()", __FUNCTION__); ModuleSP executable; @@ -214,7 +214,7 @@ void DynamicLoaderPOSIXDYLD::UnloadSections(const ModuleSP module) { } void DynamicLoaderPOSIXDYLD::ProbeEntry() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); const addr_t entry = GetEntryPoint(); if (entry == LLDB_INVALID_ADDRESS) { @@ -257,7 +257,7 @@ bool DynamicLoaderPOSIXDYLD::EntryBreakpointHit( if (!baton) return false; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); DynamicLoaderPOSIXDYLD *const dyld_instance = static_cast(baton); LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64, @@ -299,7 +299,7 @@ bool DynamicLoaderPOSIXDYLD::EntryBreakpointHit( } bool DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); if (m_dyld_bid != LLDB_INVALID_BREAK_ID) { LLDB_LOG(log, "Rendezvous breakpoint breakpoint id {0} for pid {1}" @@ -387,7 +387,7 @@ bool DynamicLoaderPOSIXDYLD::RendezvousBreakpointHit( if (!baton) return false; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); DynamicLoaderPOSIXDYLD *const dyld_instance = static_cast(baton); LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64, @@ -539,7 +539,7 @@ void DynamicLoaderPOSIXDYLD::LoadVDSO() { MemoryRegionInfo info; Status status = m_process->GetMemoryRegionInfo(m_vdso_base, info); if (status.Fail()) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOG(log, "Failed to get vdso region info: {0}", status); return; } @@ -560,7 +560,7 @@ ModuleSP DynamicLoaderPOSIXDYLD::LoadInterpreterModule() { Status status = m_process->GetMemoryRegionInfo(m_interpreter_base, info); if (status.Fail() || info.GetMapped() != MemoryRegionInfo::eYes || info.GetName().IsEmpty()) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOG(log, "Failed to get interpreter region info: {0}", status); return nullptr; } @@ -582,7 +582,7 @@ void DynamicLoaderPOSIXDYLD::LoadAllCurrentModules() { DYLDRendezvous::iterator I; DYLDRendezvous::iterator E; ModuleList module_list; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LoadVDSO(); @@ -613,7 +613,7 @@ void DynamicLoaderPOSIXDYLD::LoadAllCurrentModules() { I->file_spec.GetFilename()); module_list.Append(module_sp); } else { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOGF( log, "DynamicLoaderPOSIXDYLD::%s failed loading module %s at 0x%" PRIx64, @@ -722,7 +722,7 @@ DynamicLoaderPOSIXDYLD::GetThreadLocalData(const lldb::ModuleSP module_sp, addr_t dtv_slot = dtv + metadata.dtv_slot_size * modid; addr_t tls_block = ReadPointer(dtv_slot + metadata.tls_offset); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::Performed TLS lookup: " "module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64 @@ -738,7 +738,7 @@ DynamicLoaderPOSIXDYLD::GetThreadLocalData(const lldb::ModuleSP module_sp, void DynamicLoaderPOSIXDYLD::ResolveExecutableModule( lldb::ModuleSP &module_sp) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); if (m_process == nullptr) return; diff --git a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp index bf6dc57..afa0703 100644 --- a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp @@ -117,37 +117,37 @@ lldb::addr_t DynamicLoaderWindowsDYLD::GetLoadAddress(ModuleSP executable) { } void DynamicLoaderWindowsDYLD::DidAttach() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); - LLDB_LOGF(log, "DynamicLoaderWindowsDYLD::%s()", __FUNCTION__); + Log *log = GetLog(LLDBLog::DynamicLoader); + LLDB_LOGF(log, "DynamicLoaderWindowsDYLD::%s()", __FUNCTION__); - ModuleSP executable = GetTargetExecutable(); + ModuleSP executable = GetTargetExecutable(); - if (!executable.get()) - return; + if (!executable.get()) + return; - // Try to fetch the load address of the file from the process, since there - // could be randomization of the load address. - lldb::addr_t load_addr = GetLoadAddress(executable); - if (load_addr == LLDB_INVALID_ADDRESS) - return; + // Try to fetch the load address of the file from the process, since there + // could be randomization of the load address. + lldb::addr_t load_addr = GetLoadAddress(executable); + if (load_addr == LLDB_INVALID_ADDRESS) + return; - // Request the process base address. - lldb::addr_t image_base = m_process->GetImageInfoAddress(); - if (image_base == load_addr) - return; + // Request the process base address. + lldb::addr_t image_base = m_process->GetImageInfoAddress(); + if (image_base == load_addr) + return; - // Rebase the process's modules if there is a mismatch. - UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_addr, false); + // Rebase the process's modules if there is a mismatch. + UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_addr, false); - ModuleList module_list; - module_list.Append(executable); - m_process->GetTarget().ModulesDidLoad(module_list); - auto error = m_process->LoadModules(); - LLDB_LOG_ERROR(log, std::move(error), "failed to load modules: {0}"); + ModuleList module_list; + module_list.Append(executable); + m_process->GetTarget().ModulesDidLoad(module_list); + auto error = m_process->LoadModules(); + LLDB_LOG_ERROR(log, std::move(error), "failed to load modules: {0}"); } void DynamicLoaderWindowsDYLD::DidLaunch() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOGF(log, "DynamicLoaderWindowsDYLD::%s()", __FUNCTION__); ModuleSP executable = GetTargetExecutable(); diff --git a/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp b/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp index 1634372..15ca9db 100644 --- a/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp @@ -51,7 +51,7 @@ DynamicLoader *DynamicLoaderWasmDYLD::CreateInstance(Process *process, } void DynamicLoaderWasmDYLD::DidAttach() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); LLDB_LOGF(log, "DynamicLoaderWasmDYLD::%s()", __FUNCTION__); // Ask the process for the list of loaded WebAssembly modules. diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp index 7844f27..7999022 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -53,7 +53,7 @@ void ASTResultSynthesizer::Initialize(ASTContext &Context) { } void ASTResultSynthesizer::TransformTopLevelDecl(Decl *D) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (NamedDecl *named_decl = dyn_cast(D)) { if (log && log->GetVerbose()) { @@ -112,7 +112,7 @@ bool ASTResultSynthesizer::HandleTopLevelDecl(DeclGroupRef D) { } bool ASTResultSynthesizer::SynthesizeFunctionResult(FunctionDecl *FunDecl) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (!m_sema) return false; @@ -154,7 +154,7 @@ bool ASTResultSynthesizer::SynthesizeFunctionResult(FunctionDecl *FunDecl) { bool ASTResultSynthesizer::SynthesizeObjCMethodResult( ObjCMethodDecl *MethodDecl) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (!m_sema) return false; @@ -198,7 +198,7 @@ bool ASTResultSynthesizer::SynthesizeObjCMethodResult( bool ASTResultSynthesizer::SynthesizeBodyResult(CompoundStmt *Body, DeclContext *DC) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); ASTContext &Ctx(*m_ast_context); @@ -407,7 +407,7 @@ void ASTResultSynthesizer::MaybeRecordPersistentType(TypeDecl *D) { if (name.size() == 0 || name[0] != '$') return; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); ConstString name_cs(name.str().c_str()); @@ -427,7 +427,7 @@ void ASTResultSynthesizer::RecordPersistentDecl(NamedDecl *D) { if (name.size() == 0) return; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); ConstString name_cs(name.str().c_str()); @@ -455,7 +455,7 @@ void ASTResultSynthesizer::CommitPersistentDecls() { &scratch_ctx->getASTContext(), decl); if (!D_scratch) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (log) { std::string s; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp index 6ed3cc9..a74982e 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp @@ -49,8 +49,7 @@ CompilerType ClangASTImporter::CopyType(TypeSystemClang &dst_ast, llvm::Expected ret_or_error = delegate_sp->Import(src_qual_type); if (!ret_or_error) { - Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOG_ERROR(log, ret_or_error.takeError(), "Couldn't import type: {0}"); return CompilerType(); @@ -77,7 +76,7 @@ clang::Decl *ClangASTImporter::CopyDecl(clang::ASTContext *dst_ast, llvm::Expected result = delegate_sp->Import(decl); if (!result) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOG_ERROR(log, result.takeError(), "Couldn't import decl: {0}"); if (log) { lldb::user_id_t user_id = LLDB_INVALID_UID; @@ -170,7 +169,7 @@ private: void Override(clang::Decl *decl) { if (clang::Decl *escaped_child = GetEscapedChild(decl)) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOG(log, " [ClangASTImporter] DeclContextOverride couldn't " @@ -303,7 +302,7 @@ public: CompilerType ClangASTImporter::DeportType(TypeSystemClang &dst, const CompilerType &src_type) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); TypeSystemClang *src_ctxt = llvm::cast(src_type.GetTypeSystem()); @@ -326,7 +325,7 @@ CompilerType ClangASTImporter::DeportType(TypeSystemClang &dst, clang::Decl *ClangASTImporter::DeportDecl(clang::ASTContext *dst_ctx, clang::Decl *decl) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); clang::ASTContext *src_ctx = &decl->getASTContext(); LLDB_LOG(log, @@ -615,7 +614,7 @@ bool ClangASTImporter::CompleteAndFetchChildren(clang::QualType type) { if (!RequireCompleteType(type)) return false; - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *log = GetLog(LLDBLog::Expressions); if (const TagType *tag_type = type->getAs()) { TagDecl *tag_decl = tag_type->getDecl(); @@ -779,7 +778,7 @@ void ClangASTImporter::BuildNamespaceMap(const clang::NamespaceDecl *decl) { } void ClangASTImporter::ForgetDestination(clang::ASTContext *dst_ast) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOG(log, " [ClangASTImporter] Forgetting destination (ASTContext*){0}", @@ -792,7 +791,7 @@ void ClangASTImporter::ForgetSource(clang::ASTContext *dst_ast, clang::ASTContext *src_ast) { ASTContextMetadataSP md = MaybeGetContextMetadata(dst_ast); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOG(log, " [ClangASTImporter] Forgetting source->dest " @@ -865,7 +864,7 @@ ClangASTImporter::ASTImporterDelegate::ImportImpl(Decl *From) { const ClangASTMetadata *md = m_main.GetDeclMetadata(From); auto *td = dyn_cast(From); if (td && md && md->IsForcefullyCompleted()) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOG(log, "[ClangASTImporter] Searching for a complete definition of {0} in " "other modules", @@ -903,7 +902,7 @@ void ClangASTImporter::ASTImporterDelegate::ImportDefinitionTo( MapImported(from, to); ASTImporter::Imported(from, to); - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *log = GetLog(LLDBLog::Expressions); if (llvm::Error err = ImportDefinition(from)) { LLDB_LOG_ERROR(log, std::move(err), @@ -915,8 +914,7 @@ void ClangASTImporter::ASTImporterDelegate::ImportDefinitionTo( if (clang::TagDecl *from_tag = dyn_cast(from)) { to_tag->setCompleteDefinition(from_tag->isCompleteDefinition()); - if (Log *log_ast = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST)) { + if (Log *log_ast = GetLog(LLDBLog::AST)) { std::string name_string; if (NamedDecl *from_named_decl = dyn_cast(from)) { llvm::raw_string_ostream name_stream(name_string); @@ -1023,7 +1021,7 @@ RemapModule(OptionalClangModuleID from_id, void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from, clang::Decl *to) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); // Some decls shouldn't be tracked here because they were not created by // copying 'from' to 'to'. Just exit early for those. diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp index 510352e..ed96136 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -183,7 +183,7 @@ bool ClangASTSource::FindExternalVisibleDeclsByName( } TagDecl *ClangASTSource::FindCompleteType(const TagDecl *decl) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (const NamespaceDecl *namespace_context = dyn_cast(decl->getDeclContext())) { @@ -278,7 +278,7 @@ TagDecl *ClangASTSource::FindCompleteType(const TagDecl *decl) { } void ClangASTSource::CompleteType(TagDecl *tag_decl) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (log) { LLDB_LOG(log, @@ -307,7 +307,7 @@ void ClangASTSource::CompleteType(TagDecl *tag_decl) { } void ClangASTSource::CompleteType(clang::ObjCInterfaceDecl *interface_decl) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOG(log, " [CompleteObjCInterfaceDecl] on (ASTContext*){0} '{1}' " @@ -387,7 +387,7 @@ void ClangASTSource::FindExternalLexicalDecls( llvm::function_ref predicate, llvm::SmallVectorImpl &decls) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); const Decl *context_decl = dyn_cast(decl_context); @@ -520,7 +520,7 @@ void ClangASTSource::FindExternalVisibleDecls(NameSearchContext &context) { const ConstString name(context.m_decl_name.getAsString().c_str()); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (log) { if (!context.m_decl_context) @@ -597,7 +597,7 @@ void ClangASTSource::FindExternalVisibleDecls( CompilerDeclContext &namespace_decl) { assert(m_ast_context); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); SymbolContextList sc_list; @@ -668,7 +668,7 @@ void ClangASTSource::FillNamespaceMap( if (IgnoreName(name, true)) return; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (module_sp && namespace_decl) { CompilerDeclContext found_namespace_decl; @@ -833,7 +833,7 @@ bool ClangASTSource::FindObjCMethodDeclsWithOrigin( if (!copied_method_decl) continue; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOG(log, " CAS::FOMD found ({0}) {1}", log_info, ClangUtil::DumpDecl(copied_method_decl)); @@ -846,7 +846,7 @@ bool ClangASTSource::FindObjCMethodDeclsWithOrigin( void ClangASTSource::FindDeclInModules(NameSearchContext &context, ConstString name) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); std::shared_ptr modules_decl_vendor = GetClangModulesDeclVendor(); @@ -886,7 +886,7 @@ void ClangASTSource::FindDeclInModules(NameSearchContext &context, void ClangASTSource::FindDeclInObjCRuntime(NameSearchContext &context, ConstString name) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); lldb::ProcessSP process(m_target->GetProcessSP()); @@ -928,7 +928,7 @@ void ClangASTSource::FindDeclInObjCRuntime(NameSearchContext &context, } void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); const DeclarationName &decl_name(context.m_decl_name); const DeclContext *decl_ctx(context.m_decl_context); @@ -1208,7 +1208,7 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) { static bool FindObjCPropertyAndIvarDeclsWithOrigin( NameSearchContext &context, ClangASTSource &source, DeclFromUser &origin_iface_decl) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (origin_iface_decl.IsInvalid()) return false; @@ -1255,7 +1255,7 @@ static bool FindObjCPropertyAndIvarDeclsWithOrigin( } void ClangASTSource::FindObjCPropertyAndIvarDecls(NameSearchContext &context) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); DeclFromParser parser_iface_decl( cast(context.m_decl_context)); @@ -1391,7 +1391,7 @@ void ClangASTSource::LookupInNamespace(NameSearchContext &context) { const NamespaceDecl *namespace_context = dyn_cast(context.m_decl_context); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); ClangASTImporter::NamespaceMapSP namespace_map = m_ast_importer_sp->GetNamespaceMap(namespace_context); @@ -1498,7 +1498,7 @@ bool ClangASTSource::layoutRecordType(const RecordDecl *record, uint64_t &size, BaseOffsetMap &base_offsets, BaseOffsetMap &virtual_base_offsets) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOG(log, "LayoutRecordType on (ASTContext*){0} '{1}' for (RecordDecl*)" @@ -1620,7 +1620,7 @@ void ClangASTSource::CompleteNamespaceMap( ClangASTImporter::NamespaceMapSP &namespace_map, ConstString name, ClangASTImporter::NamespaceMapSP &parent_map) const { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (log) { if (parent_map && parent_map->size()) diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp index 4af5d41..c5d3c13 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -252,7 +252,7 @@ bool ClangExpressionDeclMap::AddPersistentVariable(const NamedDecl *decl, return true; } - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx; Target *target = exe_ctx.GetTargetPtr(); if (target == nullptr) @@ -328,7 +328,7 @@ bool ClangExpressionDeclMap::AddValueToStruct(const NamedDecl *decl, bool is_persistent_variable = false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); m_struct_vars->m_struct_laid_out = false; @@ -646,7 +646,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( const ConstString name(context.m_decl_name.getAsString().c_str()); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (log) { if (!context.m_decl_context) @@ -728,7 +728,7 @@ clang::NamedDecl *ClangExpressionDeclMap::GetPersistentDecl(ConstString name) { void ClangExpressionDeclMap::SearchPersistenDecls(NameSearchContext &context, const ConstString name) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); NamedDecl *persistent_decl = GetPersistentDecl(name); @@ -756,7 +756,7 @@ void ClangExpressionDeclMap::SearchPersistenDecls(NameSearchContext &context, } void ClangExpressionDeclMap::LookUpLldbClass(NameSearchContext &context) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); SymbolContext sym_ctx; @@ -857,7 +857,7 @@ void ClangExpressionDeclMap::LookUpLldbClass(NameSearchContext &context) { } void ClangExpressionDeclMap::LookUpLldbObjCClass(NameSearchContext &context) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); @@ -1014,7 +1014,7 @@ void ClangExpressionDeclMap::LookupLocalVarNamespace( void ClangExpressionDeclMap::LookupInModulesDeclVendor( NameSearchContext &context, ConstString name) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (!m_target) return; @@ -1331,7 +1331,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls( const CompilerDeclContext &namespace_decl) { assert(m_ast_context); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); const ConstString name(context.m_decl_name.getAsString().c_str()); if (IgnoreName(name, false)) @@ -1460,7 +1460,7 @@ bool ClangExpressionDeclMap::GetVariableValue(VariableSP &var, lldb_private::Value &var_location, TypeFromUser *user_type, TypeFromParser *parser_type) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); Type *var_type = var->GetType(); @@ -1546,7 +1546,7 @@ void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context, ValueObjectSP valobj) { assert(m_parser_vars.get()); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); TypeFromUser ut; TypeFromParser pt; @@ -1600,7 +1600,7 @@ void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context, void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context, ExpressionVariableSP &pvar_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); TypeFromUser user_type( llvm::cast(pvar_sp.get())->GetTypeFromUser()); @@ -1633,7 +1633,7 @@ void ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext &context, const Symbol &symbol) { assert(m_parser_vars.get()); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); @@ -1683,7 +1683,7 @@ void ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext &context, void ClangExpressionDeclMap::AddOneRegister(NameSearchContext &context, const RegisterInfo *reg_info) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); CompilerType clang_type = m_clang_ast_context->GetBuiltinTypeForEncodingAndBitSize( @@ -1725,7 +1725,7 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context, Symbol *symbol) { assert(m_parser_vars.get()); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); NamedDecl *function_decl = nullptr; Address fun_address; @@ -1895,7 +1895,7 @@ void ClangExpressionDeclMap::AddContextClassType(NameSearchContext &context, const TypeFromUser &ut) { CompilerType copied_clang_type = GuardedCopyType(ut); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (!copied_clang_type) { LLDB_LOG(log, @@ -1961,7 +1961,7 @@ void ClangExpressionDeclMap::AddOneType(NameSearchContext &context, CompilerType copied_clang_type = GuardedCopyType(ut); if (!copied_clang_type) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOG(log, "ClangExpressionDeclMap::AddOneType - Couldn't import the type"); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp index 51f3436..6c647a4 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -189,7 +189,7 @@ public: // when we move the expression result ot the ScratchASTContext). Let's at // least log these diagnostics until we find a way to properly render // them and display them to the user. - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (log) { llvm::SmallVector diag_str; Info.FormatDiagnostic(diag_str); @@ -282,7 +282,7 @@ private: static void SetupModuleHeaderPaths(CompilerInstance *compiler, std::vector include_directories, lldb::TargetSP target_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); HeaderSearchOptions &search_opts = compiler->getHeaderSearchOpts(); @@ -364,7 +364,7 @@ ClangExpressionParser::ClangExpressionParser( m_pp_callbacks(nullptr), m_include_directories(std::move(include_directories)), m_filename(std::move(filename)) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); // We can't compile expressions without a target. So if the exe_scope is // null or doesn't have a target, then we just need to get out of here. I'll @@ -1325,7 +1325,7 @@ lldb_private::Status ClangExpressionParser::PrepareForExecution( bool &can_interpret, ExecutionPolicy execution_policy) { func_addr = LLDB_INVALID_ADDRESS; func_end = LLDB_INVALID_ADDRESS; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); lldb_private::Status err; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp index 2cfa9a4..1bdb533 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp @@ -180,7 +180,7 @@ ClangFunctionCaller::CompileFunction(lldb::ThreadSP thread_to_use_sp, m_wrapper_function_text.append(args_list_buffer); m_wrapper_function_text.append(");\n}\n"); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOGF(log, "Expression: \n\n%s\n\n", m_wrapper_function_text.c_str()); // Okay, now compile this expression diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp index b76fa6f..b092388 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp @@ -29,7 +29,7 @@ using namespace lldb_private; static bool VerifyClangPath(const llvm::Twine &clang_path) { if (FileSystem::Instance().IsDirectory(clang_path)) return true; - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); LLDB_LOGF(log, "VerifyClangPath(): " "failed to stat clang resource directory at \"%s\"", @@ -47,7 +47,7 @@ static bool VerifyClangPath(const llvm::Twine &clang_path) { static bool DefaultComputeClangResourceDirectory(FileSpec &lldb_shlib_spec, FileSpec &file_spec, bool verify) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); std::string raw_path = lldb_shlib_spec.GetPath(); llvm::StringRef parent_dir = llvm::sys::path::parent_path(raw_path); @@ -157,7 +157,7 @@ FileSpec lldb_private::GetClangResourceDir() { if (FileSpec lldb_file_spec = HostInfo::GetShlibDir()) ComputeClangResourceDirectory(lldb_file_spec, g_cached_resource_dir, true); - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); LLDB_LOGF(log, "GetClangResourceDir() => '%s'", g_cached_resource_dir.GetPath().c_str()); }); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp index 336058a..95dc078 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp @@ -130,7 +130,7 @@ private: } // anonymous namespace StoringDiagnosticConsumer::StoringDiagnosticConsumer() { - m_log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + m_log = GetLog(LLDBLog::Expressions); clang::DiagnosticOptions *m_options = new clang::DiagnosticOptions(); m_os = std::make_shared(m_output); @@ -656,7 +656,7 @@ ClangModulesDeclVendor::Create(Target &target) { for (const std::string &arg : compiler_invocation_arguments) compiler_invocation_argument_cstrs.push_back(arg.c_str()); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOG(log, "ClangModulesDeclVendor's compiler flags {0:$[ ]}", llvm::make_range(compiler_invocation_arguments.begin(), compiler_invocation_arguments.end())); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp index 1437d7b..fe06715 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp @@ -89,7 +89,7 @@ ClangUserExpression::ClangUserExpression( ClangUserExpression::~ClangUserExpression() = default; void ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Status &err) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOGF(log, "ClangUserExpression::ScanContext()"); @@ -456,14 +456,14 @@ static bool SupportsCxxModuleImport(lldb::LanguageType language) { /// Utility method that puts a message into the expression log and /// returns an invalid module configuration. static CppModuleConfiguration LogConfigError(const std::string &msg) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOG(log, "[C++ module config] {0}", msg); return CppModuleConfiguration(); } CppModuleConfiguration GetModuleConfig(lldb::LanguageType language, ExecutionContext &exe_ctx) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); // Don't do anything if this is not a C++ module configuration. if (!SupportsCxxModuleImport(language)) @@ -621,7 +621,7 @@ bool ClangUserExpression::TryParse( } void ClangUserExpression::SetupCppModuleImports(ExecutionContext &exe_ctx) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); CppModuleConfiguration module_config = GetModuleConfig(m_language, exe_ctx); m_imported_cpp_modules = module_config.GetImportedModules(); @@ -647,7 +647,7 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager, lldb_private::ExecutionPolicy execution_policy, bool keep_result_in_memory, bool generate_debug_info) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); if (!PrepareForParsing(diagnostic_manager, exe_ctx, /*for_completion*/ false)) return false; @@ -806,7 +806,7 @@ static void AbsPosToLineColumnPos(size_t abs_pos, llvm::StringRef code, bool ClangUserExpression::Complete(ExecutionContext &exe_ctx, CompletionRequest &request, unsigned complete_pos) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); // We don't want any visible feedback when completing an expression. Mostly // because the results we get from an incomplete invocation are probably not diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp index fecffd1..93ae566 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp @@ -180,7 +180,7 @@ T *createDecl(ASTImporter &importer, Decl *from_d, Args &&... args) { } llvm::Optional CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *log = GetLog(LLDBLog::Expressions); // If we don't have a template to instiantiate, then there is nothing to do. auto td = dyn_cast(d); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp index 8b132b5..7df2470 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp @@ -316,7 +316,7 @@ public: protected: bool InstrumentInstruction(llvm::Instruction *inst) override { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOGF(log, "Instrumenting load/store instruction: %s\n", PrintValue(inst).c_str()); @@ -467,7 +467,7 @@ protected: } bool InspectInstruction(llvm::Instruction &i) override { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); CallInst *call_inst = dyn_cast(&i); @@ -538,7 +538,7 @@ IRDynamicChecks::IRDynamicChecks( IRDynamicChecks::~IRDynamicChecks() = default; bool IRDynamicChecks::runOnModule(llvm::Module &M) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); llvm::Function *function = M.getFunction(StringRef(m_func_name)); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index e0e4192..91f3ec8 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -41,6 +41,7 @@ #include using namespace llvm; +using lldb_private::LLDBLog; typedef SmallVector InstrList; @@ -158,8 +159,7 @@ static bool isGuardVariableSymbol(llvm::StringRef mangled_symbol, } bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); if (!m_resolve_vars) return true; @@ -399,8 +399,7 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) { bool IRForTarget::RewriteObjCConstString(llvm::GlobalVariable *ns_str, llvm::GlobalVariable *cstr) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); Type *ns_str_ty = ns_str->getType(); @@ -537,8 +536,7 @@ bool IRForTarget::RewriteObjCConstString(llvm::GlobalVariable *ns_str, } bool IRForTarget::RewriteObjCConstStrings() { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); ValueSymbolTable &value_symbol_table = m_module->getValueSymbolTable(); @@ -750,8 +748,7 @@ static bool IsObjCSelectorRef(Value *value) { // This function does not report errors; its callers are responsible. bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); LoadInst *load = dyn_cast(selector_load); @@ -877,8 +874,7 @@ bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) { } bool IRForTarget::RewriteObjCSelectors(BasicBlock &basic_block) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); InstrList selector_loads; @@ -912,8 +908,7 @@ static bool IsObjCClassReference(Value *value) { // This function does not report errors; its callers are responsible. bool IRForTarget::RewriteObjCClassReference(Instruction *class_load) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); LoadInst *load = dyn_cast(class_load); @@ -1029,8 +1024,7 @@ bool IRForTarget::RewriteObjCClassReference(Instruction *class_load) { } bool IRForTarget::RewriteObjCClassReferences(BasicBlock &basic_block) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); InstrList class_loads; @@ -1057,8 +1051,7 @@ bool IRForTarget::RewriteObjCClassReferences(BasicBlock &basic_block) { // This function does not report errors; its callers are responsible. bool IRForTarget::RewritePersistentAlloc(llvm::Instruction *persistent_alloc) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); AllocaInst *alloc = dyn_cast(persistent_alloc); @@ -1129,8 +1122,7 @@ bool IRForTarget::RewritePersistentAllocs(llvm::BasicBlock &basic_block) { if (!m_resolve_vars) return true; - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); InstrList pvar_allocs; @@ -1171,8 +1163,7 @@ bool IRForTarget::RewritePersistentAllocs(llvm::BasicBlock &basic_block) { // This function does not report errors; its callers are responsible. bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); LLDB_LOG(log, "MaybeHandleVariable ({0})", PrintValue(llvm_value_ptr)); @@ -1266,8 +1257,7 @@ bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) { // This function does not report errors; its callers are responsible. bool IRForTarget::HandleSymbol(Value *symbol) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); lldb_private::ConstString name(symbol->getName().str().c_str()); @@ -1298,8 +1288,7 @@ bool IRForTarget::HandleSymbol(Value *symbol) { } bool IRForTarget::MaybeHandleCallArguments(CallInst *Old) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); LLDB_LOG(log, "MaybeHandleCallArguments({0})", PrintValue(Old)); @@ -1317,8 +1306,7 @@ bool IRForTarget::MaybeHandleCallArguments(CallInst *Old) { } bool IRForTarget::HandleObjCClass(Value *classlist_reference) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); GlobalVariable *global_variable = dyn_cast(classlist_reference); @@ -1419,8 +1407,7 @@ bool IRForTarget::ResolveCalls(BasicBlock &basic_block) { } bool IRForTarget::ResolveExternals(Function &llvm_function) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); for (GlobalVariable &global_var : m_module->globals()) { llvm::StringRef global_name = global_var.getName(); @@ -1638,8 +1625,7 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) { if (!m_resolve_vars) return true; - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); m_decl_map->DoStructLayout(); @@ -1827,8 +1813,7 @@ bool IRForTarget::ReplaceVariables(Function &llvm_function) { } bool IRForTarget::runOnModule(Module &llvm_module) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(GetLog(LLDBLog::Expressions)); m_module = &llvm_module; m_target_data = std::make_unique(m_module); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/NameSearchContext.cpp b/lldb/source/Plugins/ExpressionParser/Clang/NameSearchContext.cpp index 8709c2b..0cafc63 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/NameSearchContext.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/NameSearchContext.cpp @@ -106,7 +106,7 @@ clang::NamedDecl *NameSearchContext::AddFunDecl(const CompilerType &type, func_decl->setParams(ArrayRef(parm_var_decls)); } else { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOG(log, "Function type wasn't a FunctionProtoType"); } diff --git a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp index dcfad8e..e45d0fe 100644 --- a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp +++ b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp @@ -210,7 +210,7 @@ bool EmulateInstructionPPC64::EmulateMFSPR(uint32_t opcode) { if (rt != gpr_r0_ppc64le || spr != SPR_LR) return false; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); LLDB_LOG(log, "EmulateMFSPR: {0:X+8}: mfspr r0, lr", m_addr); bool success; @@ -237,7 +237,7 @@ bool EmulateInstructionPPC64::EmulateLD(uint32_t opcode) { if (ra != gpr_r1_ppc64le || rt != gpr_r1_ppc64le || ids != 0) return false; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); LLDB_LOG(log, "EmulateLD: {0:X+8}: ld r{1}, {2}(r{3})", m_addr, rt, ids, ra); RegisterInfo r1_info; @@ -274,7 +274,7 @@ bool EmulateInstructionPPC64::EmulateSTD(uint32_t opcode) { return false; int32_t ids = llvm::SignExtend32<16>(ds << 2); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); LLDB_LOG(log, "EmulateSTD: {0:X+8}: std{1} r{2}, {3}(r{4})", m_addr, u ? "u" : "", rs, ids, ra); @@ -331,7 +331,7 @@ bool EmulateInstructionPPC64::EmulateOR(uint32_t opcode) { (ra != gpr_r30_ppc64le && ra != gpr_r31_ppc64le) || rb != gpr_r1_ppc64le) return false; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); LLDB_LOG(log, "EmulateOR: {0:X+8}: mr r{1}, r{2}", m_addr, ra, rb); // set context @@ -366,7 +366,7 @@ bool EmulateInstructionPPC64::EmulateADDI(uint32_t opcode) { return false; int32_t si_val = llvm::SignExtend32<16>(si); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); LLDB_LOG(log, "EmulateADDI: {0:X+8}: addi r1, r1, {1}", m_addr, si_val); // set context diff --git a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp index e4994e1..8f3b2bf 100644 --- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp +++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp @@ -186,7 +186,7 @@ void JITLoaderGDB::SetJITBreakpoint(lldb_private::ModuleList &module_list) { if (DidSetJITBreakpoint()) return; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_JIT_LOADER)); + Log *log = GetLog(LLDBLog::JITLoader); LLDB_LOGF(log, "JITLoaderGDB::%s looking for JIT register hook", __FUNCTION__); @@ -218,7 +218,7 @@ bool JITLoaderGDB::JITDebugBreakpointHit(void *baton, StoppointCallbackContext *context, user_id_t break_id, user_id_t break_loc_id) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_JIT_LOADER)); + Log *log = GetLog(LLDBLog::JITLoader); LLDB_LOGF(log, "JITLoaderGDB::%s hit JIT breakpoint", __FUNCTION__); JITLoaderGDB *instance = static_cast(baton); return instance->ReadJITDescriptor(false); @@ -282,7 +282,7 @@ bool JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries) { if (m_jit_descriptor_addr == LLDB_INVALID_ADDRESS) return false; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_JIT_LOADER)); + Log *log = GetLog(LLDBLog::JITLoader); Target &target = m_process->GetTarget(); ModuleList &module_list = target.GetImages(); diff --git a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp index 1c498a2..6ec7784 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp @@ -43,9 +43,8 @@ public: auto type_system_or_err = target_sp->GetScratchTypeSystemForLanguage( lldb::eLanguageTypeC_plus_plus); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS), - std::move(err), "Failed to get scratch TypeSystemClang"); + LLDB_LOG_ERROR(GetLog(LLDBLog::DataFormatters), std::move(err), + "Failed to get scratch TypeSystemClang"); return; } diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index 0fb65f5..c373835 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -337,7 +337,7 @@ protected: } ConstString substituteImpl(llvm::StringRef Mangled) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = GetLog(LLDBLog::Language); if (this->parse() == nullptr) { LLDB_LOG(log, "Failed to substitute mangling in {0}", Mangled); return ConstString(); diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp index 0d7cd67..e7bb011 100644 --- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp +++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp @@ -426,7 +426,7 @@ bool lldb_private::formatters::NSNumberSummaryProvider( if (!process_sp) return false; - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS); + Log *log = GetLog(LLDBLog::DataFormatters); ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp); if (!runtime) diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp index 92f732f..3b7226d 100644 --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -76,8 +76,7 @@ TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress( const char *name = symbol->GetMangled().GetDemangledName().AsCString(); if (name && strstr(name, vtable_demangled_prefix) == name) { - Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOGF(log, "0x%16.16" PRIx64 ": static-type = '%s' has vtable symbol '%s'\n", diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp index 162ccad..2620a78 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp @@ -542,7 +542,7 @@ void ClassDescriptorV2::iVarsStorage::fill(AppleObjCRuntimeV2 &runtime, if (m_filled) return; std::lock_guard guard(m_mutex); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES)); + Log *log = GetLog(LLDBLog::Commands); LLDB_LOGV(log, "class_name = {0}", descriptor.GetClassName()); m_filled = true; ObjCLanguageRuntime::EncodingToTypeSP encoding_to_type_sp( diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp index af11109a..191b6bb 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp @@ -31,8 +31,8 @@ public: bool FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx, clang::DeclarationName name) override { - Log *log(GetLogIfAllCategoriesSet( - LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? + Log *log(GetLog( + LLDBLog::Expressions)); // FIXME - a more appropriate log channel? if (log) { LLDB_LOGF(log, @@ -68,8 +68,8 @@ public: void CompleteType(clang::TagDecl *tag_decl) override { - Log *log(GetLogIfAllCategoriesSet( - LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? + Log *log(GetLog( + LLDBLog::Expressions)); // FIXME - a more appropriate log channel? LLDB_LOGF(log, "AppleObjCExternalASTSource::CompleteType on " @@ -84,8 +84,8 @@ public: void CompleteType(clang::ObjCInterfaceDecl *interface_decl) override { - Log *log(GetLogIfAllCategoriesSet( - LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? + Log *log(GetLog( + LLDBLog::Expressions)); // FIXME - a more appropriate log channel? if (log) { LLDB_LOGF(log, @@ -394,8 +394,8 @@ private: }; bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) { - Log *log(GetLogIfAllCategoriesSet( - LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? + Log *log( + GetLog(LLDBLog::Expressions)); // FIXME - a more appropriate log channel? ClangASTMetadata *metadata = m_ast_ctx.GetMetadata(interface_decl); ObjCLanguageRuntime::ObjCISA objc_isa = 0; @@ -525,8 +525,8 @@ uint32_t AppleObjCDeclVendor::FindDecls(ConstString name, bool append, uint32_t max_matches, std::vector &decls) { - Log *log(GetLogIfAllCategoriesSet( - LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? + Log *log( + GetLog(LLDBLog::Expressions)); // FIXME - a more appropriate log channel? LLDB_LOGF(log, "AppleObjCDeclVendor::FindDecls ('%s', %s, %u, )", (const char *)name.AsCString(), append ? "true" : "false", diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp index 88e86c5..ca90c6e 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -504,7 +504,7 @@ ValueObjectSP AppleObjCRuntime::GetExceptionObjectForThread( /// GetBacktraceThreadFromException. LLVM_NODISCARD static ThreadSP FailExceptionParsing(llvm::StringRef msg) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); LLDB_LOG(log, "Failed getting backtrace from exception: {0}", msg); return ThreadSP(); } diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp index 609e8e9..eb546031 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp @@ -318,7 +318,7 @@ void AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded() { // map, whether it was successful or not. m_isa_to_descriptor_stop_id = process->GetStopID(); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); ProcessSP process_sp = process->shared_from_this(); diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index f2cf25f..1665736 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -1466,7 +1466,7 @@ AppleObjCRuntimeV2::GetClassDescriptor(ValueObject &valobj) { objc_class_sp = GetClassDescriptorFromISA(isa); if (isa && !objc_class_sp) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands); LLDB_LOGF(log, "0x%" PRIx64 ": AppleObjCRuntimeV2::GetClassDescriptor() ISA was " "not in class descriptor cache 0x%" PRIx64, @@ -1538,7 +1538,7 @@ lldb::addr_t AppleObjCRuntimeV2::GetISAHashTablePointer() { std::unique_ptr AppleObjCRuntimeV2::DynamicClassInfoExtractor::GetClassInfoUtilityFunctionImpl( ExecutionContext &exe_ctx, std::string code, std::string name) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands); LLDB_LOG(log, "Creating utility function {0}", name); @@ -1643,7 +1643,7 @@ AppleObjCRuntimeV2::DynamicClassInfoExtractor::ComputeHelper() const { std::unique_ptr AppleObjCRuntimeV2::SharedCacheClassInfoExtractor:: GetClassInfoUtilityFunctionImpl(ExecutionContext &exe_ctx) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands); LLDB_LOG(log, "Creating utility function {0}", g_get_shared_cache_class_info_name); @@ -1746,7 +1746,7 @@ AppleObjCRuntimeV2::DynamicClassInfoExtractor::UpdateISAToDescriptorMap( uint32_t num_class_infos = 0; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands); ExecutionContext exe_ctx; @@ -1822,7 +1822,7 @@ AppleObjCRuntimeV2::DynamicClassInfoExtractor::UpdateISAToDescriptorMap( // Only dump the runtime classes from the expression evaluation if the log is // verbose: - Log *type_log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES); + Log *type_log = GetLog(LLDBLog::Commands); bool dump_log = type_log && type_log->GetVerbose(); arguments.GetValueAtIndex(3)->GetScalar() = dump_log ? 1 : 0; @@ -1902,7 +1902,7 @@ uint32_t AppleObjCRuntimeV2::ParseClassInfoArray(const DataExtractor &data, // uint32_t hash; // } __attribute__((__packed__)); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES)); + Log *log = GetLog(LLDBLog::Commands); bool should_log = log && log->GetVerbose(); uint32_t num_parsed = 0; @@ -1975,7 +1975,7 @@ AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::UpdateISAToDescriptorMap() { if (process == nullptr) return DescriptorMapUpdateResult::Fail(); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands); ExecutionContext exe_ctx; @@ -2055,7 +2055,7 @@ AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::UpdateISAToDescriptorMap() { arguments.GetValueAtIndex(4)->GetScalar() = class_infos_byte_size; // Only dump the runtime classes from the expression evaluation if the log is // verbose: - Log *type_log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES); + Log *type_log = GetLog(LLDBLog::Commands); bool dump_log = type_log && type_log->GetVerbose(); arguments.GetValueAtIndex(5)->GetScalar() = dump_log ? 1 : 0; @@ -2213,7 +2213,7 @@ lldb::addr_t AppleObjCRuntimeV2::GetSharedCacheBaseAddress() { void AppleObjCRuntimeV2::UpdateISAToDescriptorMapIfNeeded() { LLDB_SCOPED_TIMER(); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands); // Else we need to check with our process to see when the map was updated. Process *process = GetProcess(); @@ -2300,7 +2300,7 @@ bool AppleObjCRuntimeV2::RealizedClassGenerationCountChanged() { objc_debug_realized_class_generation_count) return false; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands); LLDB_LOG(log, "objc_debug_realized_class_generation_count changed from {0} to {1}", m_realized_class_generation_count, @@ -2454,7 +2454,7 @@ AppleObjCRuntimeV2::NonPointerISACache::CreateInstance( Status error; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES)); + Log *log = GetLog(LLDBLog::Commands); auto objc_debug_isa_magic_mask = ExtractRuntimeGlobalSymbol( process, ConstString("objc_debug_isa_magic_mask"), objc_module_sp, error); @@ -2884,7 +2884,7 @@ AppleObjCRuntimeV2::NonPointerISACache::GetClassDescriptor(ObjCISA isa) { bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA( ObjCISA isa, ObjCISA &ret_isa) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES)); + Log *log = GetLog(LLDBLog::Commands); LLDB_LOGF(log, "AOCRT::NPI Evaluate(isa = 0x%" PRIx64 ")", (uint64_t)isa); diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp index ff41f18..d5c4dfb 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -575,7 +575,7 @@ bool AppleObjCTrampolineHandler::AppleObjCVTables::ReadRegions( if (!process_sp) return false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); // We aren't starting at the trampoline symbol. InitializeVTableSymbols(); @@ -794,7 +794,7 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread, ValueList &dispatch_values) { ThreadSP thread_sp(thread.shared_from_this()); ExecutionContext exe_ctx(thread_sp); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); lldb::addr_t args_addr = LLDB_INVALID_ADDRESS; FunctionCaller *impl_function_caller = nullptr; @@ -911,7 +911,7 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread, } if (this_dispatch) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); // We are decoding a method dispatch. First job is to pull the // arguments out: diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp index f935ae7..0a126e3 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp @@ -141,7 +141,7 @@ bool AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) { } Address target_so_addr; target_so_addr.SetOpcodeLoadAddress(target_addr, exc_ctx.GetTargetPtr()); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (target_addr == 0) { LLDB_LOGF(log, "Got target implementation of 0x0, stopping."); SetPlanComplete(); @@ -354,7 +354,7 @@ bool AppleThreadPlanStepThroughDirectDispatch::ShouldStop(Event *event_ptr) { // If we have a step through plan, then w're in the process of getting // through an ObjC msgSend. If we arrived at the target function, then // check whether we have debug info, and if we do, stop. - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (m_objc_step_through_sp && m_objc_step_through_sp->IsPlanComplete()) { // If the plan failed for some reason, we should probably just let the diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp index 0cc96e4..619ea7f 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp @@ -63,7 +63,7 @@ bool ObjCLanguageRuntime::AddClass(ObjCISA isa, void ObjCLanguageRuntime::AddToMethodCache(lldb::addr_t class_addr, lldb::addr_t selector, lldb::addr_t impl_addr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log) { LLDB_LOGF(log, "Caching: class 0x%" PRIx64 " selector 0x%" PRIx64 diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp index c990c73..3e0a291 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp @@ -77,8 +77,7 @@ static bool registerRSDefaultTargetOpts(clang::TargetOptions &proto, bool RenderScriptRuntimeModulePass::runOnModule(llvm::Module &module) { bool changed_module = false; - Log *log( - GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Language | LLDBLog::Expressions); std::string err; llvm::StringRef real_triple = diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index d6de658..362ae01 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -120,7 +120,7 @@ struct GetArgsCtx { }; bool GetArgsX86(const GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = GetLog(LLDBLog::Language); Status err; @@ -148,7 +148,7 @@ bool GetArgsX86(const GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { } bool GetArgsX86_64(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = GetLog(LLDBLog::Language); // number of arguments passed in registers static const uint32_t args_in_reg = 6; @@ -224,7 +224,7 @@ bool GetArgsArm(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { // number of arguments passed in registers static const uint32_t args_in_reg = 4; - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = GetLog(LLDBLog::Language); Status err; @@ -268,7 +268,7 @@ bool GetArgsAarch64(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { // number of arguments passed in registers static const uint32_t args_in_reg = 8; - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = GetLog(LLDBLog::Language); for (size_t i = 0; i < num_args; ++i) { bool success = false; @@ -301,7 +301,7 @@ bool GetArgsMipsel(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { // register file offset to first argument static const uint32_t reg_offset = 4; - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = GetLog(LLDBLog::Language); Status err; @@ -346,7 +346,7 @@ bool GetArgsMips64el(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { // register file offset to first argument static const uint32_t reg_offset = 4; - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = GetLog(LLDBLog::Language); Status err; @@ -388,7 +388,7 @@ bool GetArgsMips64el(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { } bool GetArgs(ExecutionContext &exe_ctx, ArgItem *arg_list, size_t num_args) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = GetLog(LLDBLog::Language); // verify that we have a target if (!exe_ctx.GetTargetPtr()) { @@ -465,7 +465,7 @@ bool ParseCoordinate(llvm::StringRef coord_s, RSCoordinate &coord) { } bool SkipPrologue(lldb::ModuleSP &module, Address &addr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); SymbolContext sc; uint32_t resolved_flags = module->ResolveSymbolContextForAddress(addr, eSymbolContextFunction, sc); @@ -833,7 +833,7 @@ RSReduceBreakpointResolver::SearchCallback(lldb_private::SearchFilter &filter, // identifiable by parsing the .rs.info packet, or finding the expand symbol. // We therefore need access to the list of parsed rs modules to properly // resolve reduction names. - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); ModuleSP module = context.module_sp; if (!module || !IsRenderScriptScriptModule(module)) @@ -893,7 +893,7 @@ Searcher::CallbackReturn RSScriptGroupBreakpointResolver::SearchCallback( if (!breakpoint_sp) return eCallbackReturnContinue; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); ModuleSP &module = context.module_sp; if (!module || !IsRenderScriptScriptModule(module)) @@ -1105,7 +1105,7 @@ bool RenderScriptRuntime::HookCallback(void *baton, void RenderScriptRuntime::HookCallback(RuntimeHook *hook, ExecutionContext &exe_ctx) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); LLDB_LOGF(log, "%s - '%s'", __FUNCTION__, hook->defn->name); @@ -1116,7 +1116,7 @@ void RenderScriptRuntime::HookCallback(RuntimeHook *hook, void RenderScriptRuntime::CaptureDebugHintScriptGroup2( RuntimeHook *hook_info, ExecutionContext &context) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); enum { eGroupName = 0, @@ -1254,7 +1254,7 @@ void RenderScriptRuntime::CaptureDebugHintScriptGroup2( void RenderScriptRuntime::CaptureScriptInvokeForEachMulti( RuntimeHook *hook, ExecutionContext &exe_ctx) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); enum { eRsContext = 0, @@ -1354,7 +1354,7 @@ void RenderScriptRuntime::CaptureScriptInvokeForEachMulti( void RenderScriptRuntime::CaptureSetGlobalVar(RuntimeHook *hook, ExecutionContext &context) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); enum { eRsContext, @@ -1401,7 +1401,7 @@ void RenderScriptRuntime::CaptureSetGlobalVar(RuntimeHook *hook, void RenderScriptRuntime::CaptureAllocationInit(RuntimeHook *hook, ExecutionContext &exe_ctx) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); enum { eRsContext, eRsAlloc, eRsForceZero }; @@ -1429,7 +1429,7 @@ void RenderScriptRuntime::CaptureAllocationInit(RuntimeHook *hook, void RenderScriptRuntime::CaptureAllocationDestroy(RuntimeHook *hook, ExecutionContext &exe_ctx) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); enum { eRsContext, @@ -1466,7 +1466,7 @@ void RenderScriptRuntime::CaptureAllocationDestroy(RuntimeHook *hook, void RenderScriptRuntime::CaptureScriptInit(RuntimeHook *hook, ExecutionContext &exe_ctx) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); Status err; Process *process = exe_ctx.GetProcessPtr(); @@ -1527,7 +1527,7 @@ void RenderScriptRuntime::CaptureScriptInit(RuntimeHook *hook, void RenderScriptRuntime::LoadRuntimeHooks(lldb::ModuleSP module, ModuleKind kind) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); if (!module) { return; @@ -1619,7 +1619,7 @@ void RenderScriptRuntime::FixupScriptDetails(RSModuleDescriptorSP rsmodule_sp) { if (!rsmodule_sp) return; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); const ModuleSP module = rsmodule_sp->m_module; const FileSpec &file = module->GetPlatformFileSpec(); @@ -1675,7 +1675,7 @@ void RenderScriptRuntime::FixupScriptDetails(RSModuleDescriptorSP rsmodule_sp) { bool RenderScriptRuntime::EvalRSExpression(const char *expr, StackFrame *frame_ptr, uint64_t *result) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); LLDB_LOGF(log, "%s(%s)", __FUNCTION__, expr); ValueObjectSP expr_result; @@ -1822,7 +1822,7 @@ const char *JITTemplate(ExpressionStrings e) { bool RenderScriptRuntime::JITDataPointer(AllocationDetails *alloc, StackFrame *frame_ptr, uint32_t x, uint32_t y, uint32_t z) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); if (!alloc->address.isValid()) { LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__); @@ -1857,7 +1857,7 @@ bool RenderScriptRuntime::JITDataPointer(AllocationDetails *alloc, // success, false otherwise bool RenderScriptRuntime::JITTypePointer(AllocationDetails *alloc, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); if (!alloc->address.isValid() || !alloc->context.isValid()) { LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__); @@ -1892,7 +1892,7 @@ bool RenderScriptRuntime::JITTypePointer(AllocationDetails *alloc, // the result. Returns true on success, false otherwise bool RenderScriptRuntime::JITTypePacked(AllocationDetails *alloc, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); if (!alloc->type_ptr.isValid() || !alloc->context.isValid()) { LLDB_LOGF(log, "%s - Failed to find allocation details.", __FUNCTION__); @@ -1953,7 +1953,7 @@ bool RenderScriptRuntime::JITTypePacked(AllocationDetails *alloc, bool RenderScriptRuntime::JITElementPacked(Element &elem, const lldb::addr_t context, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); if (!elem.element_ptr.isValid()) { LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__); @@ -2010,7 +2010,7 @@ bool RenderScriptRuntime::JITElementPacked(Element &elem, bool RenderScriptRuntime::JITSubelements(Element &elem, const lldb::addr_t context, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); if (!elem.element_ptr.isValid() || !elem.field_count.isValid()) { LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__); @@ -2093,7 +2093,7 @@ bool RenderScriptRuntime::JITSubelements(Element &elem, // allocation. Returns true on success, false otherwise bool RenderScriptRuntime::JITAllocationSize(AllocationDetails *alloc, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); if (!alloc->address.isValid() || !alloc->dimension.isValid() || !alloc->data_ptr.isValid() || !alloc->element.datum_size.isValid()) { @@ -2159,7 +2159,7 @@ bool RenderScriptRuntime::JITAllocationSize(AllocationDetails *alloc, // 16-byte aligned. Returns true on success, false otherwise bool RenderScriptRuntime::JITAllocationStride(AllocationDetails *alloc, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); if (!alloc->address.isValid() || !alloc->data_ptr.isValid()) { LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__); @@ -2220,7 +2220,7 @@ bool RenderScriptRuntime::RefreshAllocation(AllocationDetails *alloc, // represents. We need this string for pretty printing the Element to users. void RenderScriptRuntime::FindStructTypeName(Element &elem, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); if (!elem.type_name.IsEmpty()) // Name already set return; @@ -2304,7 +2304,7 @@ void RenderScriptRuntime::FindStructTypeName(Element &elem, // single instance including padding. Assumes the relevant allocation // information has already been jitted. void RenderScriptRuntime::SetElementSize(Element &elem) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); const Element::DataType type = *elem.type.get(); assert(type >= Element::RS_TYPE_NONE && type <= Element::RS_TYPE_FONT && "Invalid allocation type"); @@ -2348,7 +2348,7 @@ void RenderScriptRuntime::SetElementSize(Element &elem) { std::shared_ptr RenderScriptRuntime::GetAllocationData(AllocationDetails *alloc, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); // JIT all the allocation details if (alloc->ShouldRefresh()) { @@ -2396,7 +2396,7 @@ RenderScriptRuntime::GetAllocationData(AllocationDetails *alloc, bool RenderScriptRuntime::LoadAllocation(Stream &strm, const uint32_t alloc_id, const char *path, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); // Find allocation with the given id AllocationDetails *alloc = FindAllocByID(strm, alloc_id); @@ -2616,7 +2616,7 @@ size_t RenderScriptRuntime::CalculateElementHeaderSize(const Element &elem) { bool RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id, const char *path, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); // Find allocation with the given id AllocationDetails *alloc = FindAllocByID(strm, alloc_id); @@ -2735,7 +2735,7 @@ bool RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id, } bool RenderScriptRuntime::LoadModule(const lldb::ModuleSP &module_sp) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); if (module_sp) { for (const auto &rs_module : m_rsmodules) { @@ -2867,7 +2867,7 @@ bool RSModuleDescriptor::ParseExportReduceCount(llvm::StringRef *lines, // a function is not explicitly named by the user, or is not generated by the // compiler, it is named "." so the dash separated list should always be 8 // items long - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = GetLog(LLDBLog::Language); // Skip the exportReduceCount line ++lines; for (; n_lines--; ++lines) { @@ -2958,7 +2958,7 @@ bool RSModuleDescriptor::ParseExportVarCount(llvm::StringRef *lines, // be parsed. The string is basic and is parsed on a line by line basis. bool RSModuleDescriptor::ParseRSInfo() { assert(m_module); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); const Symbol *info_sym = m_module->FindFirstSymbolWithNameAndType( ConstString(".rs.info"), eSymbolTypeData); if (!info_sym) @@ -3165,7 +3165,7 @@ RenderScriptRuntime::FindAllocByID(Stream &strm, const uint32_t alloc_id) { // file bool RenderScriptRuntime::DumpAllocation(Stream &strm, StackFrame *frame_ptr, const uint32_t id) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); // Check we can find the desired allocation AllocationDetails *alloc = FindAllocByID(strm, id); @@ -3453,8 +3453,7 @@ void RenderScriptRuntime::BreakOnModuleKernels( // or disable breaking on all kernels. When do_break is true we want to enable // this functionality. When do_break is false we want to disable it. void RenderScriptRuntime::SetBreakAllKernels(bool do_break, TargetSP target) { - Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Language | LLDBLog::Breakpoints); InitSearchFilter(target); @@ -3482,8 +3481,7 @@ void RenderScriptRuntime::SetBreakAllKernels(bool do_break, TargetSP target) { // breakpoint resolver, and returns the Breakpoint shared pointer. BreakpointSP RenderScriptRuntime::CreateKernelBreakpoint(ConstString name) { - Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Language | LLDBLog::Breakpoints); if (!m_filtersp) { LLDB_LOGF(log, "%s - error, no breakpoint search filter set.", @@ -3510,8 +3508,7 @@ RenderScriptRuntime::CreateKernelBreakpoint(ConstString name) { BreakpointSP RenderScriptRuntime::CreateReductionBreakpoint(ConstString name, int kernel_types) { - Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Language | LLDBLog::Breakpoints); if (!m_filtersp) { LLDB_LOGF(log, "%s - error, no breakpoint search filter set.", @@ -3542,7 +3539,7 @@ RenderScriptRuntime::CreateReductionBreakpoint(ConstString name, bool RenderScriptRuntime::GetFrameVarAsUnsigned(const StackFrameSP frame_sp, const char *var_name, uint64_t &val) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); Status err; VariableSP var_sp; @@ -3580,7 +3577,7 @@ bool RenderScriptRuntime::GetKernelCoordinate(RSCoordinate &coord, static const char *const y_expr = "p->current.y"; static const char *const z_expr = "p->current.z"; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log = GetLog(LLDBLog::Language); if (!thread_ptr) { LLDB_LOGF(log, "%s - Error, No thread pointer", __FUNCTION__); @@ -3646,8 +3643,7 @@ bool RenderScriptRuntime::KernelBreakpointHit(void *baton, StoppointCallbackContext *ctx, user_id_t break_id, user_id_t break_loc_id) { - Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Language | LLDBLog::Breakpoints); assert(baton && "Error: null baton in conditional kernel breakpoint callback"); @@ -3742,8 +3738,7 @@ bool RenderScriptRuntime::PlaceBreakpointOnKernel(TargetSP target, BreakpointSP RenderScriptRuntime::CreateScriptGroupBreakpoint(ConstString name, bool stop_on_all) { - Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Language | LLDBLog::Breakpoints); if (!m_filtersp) { LLDB_LOGF(log, "%s - error, no breakpoint search filter set.", @@ -3839,7 +3834,7 @@ RenderScriptRuntime::LookUpAllocation(addr_t address) { RenderScriptRuntime::AllocationDetails * RenderScriptRuntime::CreateAllocation(addr_t address) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = GetLog(LLDBLog::Language); // Remove any previous allocation which contains the same address auto it = m_allocations.begin(); @@ -3862,7 +3857,7 @@ RenderScriptRuntime::CreateAllocation(addr_t address) { bool RenderScriptRuntime::ResolveKernelName(lldb::addr_t kernel_addr, ConstString &name) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = GetLog(LLDBLog::Symbols); Target &target = GetProcess()->GetTarget(); Address resolved; diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp index f3b7c9d..20bcf3e 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp @@ -85,8 +85,7 @@ static llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) { // create a return type by getting the pointer type of the old return type, // and inserting a new initial argument of pointer type of the original // return type. - Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Language | LLDBLog::Expressions); assert(call_inst && "no CallInst"); llvm::Function *orig = call_inst->getCalledFunction(); diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 96e94ef..9547149 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -235,7 +235,7 @@ bool ELFNote::Parse(const DataExtractor &data, lldb::offset_t *offset) { const char *cstr = data.GetCStr(offset, llvm::alignTo(n_namesz, 4)); if (cstr == nullptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); + Log *log = GetLog(LLDBLog::Symbols); LLDB_LOGF(log, "Failed to parse note name lacking nul terminator"); return false; @@ -504,7 +504,7 @@ size_t ObjectFileELF::GetModuleSpecifications( const lldb_private::FileSpec &file, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, lldb::offset_t file_offset, lldb::offset_t length, lldb_private::ModuleSpecList &specs) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES)); + Log *log = GetLog(LLDBLog::Modules); const size_t initial_count = specs.GetSize(); @@ -998,7 +998,7 @@ lldb_private::Status ObjectFileELF::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data, lldb_private::ArchSpec &arch_spec, lldb_private::UUID &uuid) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES)); + Log *log = GetLog(LLDBLog::Modules); Status error; lldb::offset_t offset = 0; @@ -1365,7 +1365,7 @@ size_t ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl §ion_headers, if (header.e_shnum == 0) return 0; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES)); + Log *log = GetLog(LLDBLog::Modules); section_headers.resize(header.e_shnum); if (section_headers.size() != header.e_shnum) @@ -1680,7 +1680,7 @@ class VMAddressProvider { VMMap::Allocator Alloc; VMMap Segments = VMMap(Alloc); VMMap Sections = VMMap(Alloc); - lldb_private::Log *Log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES); + lldb_private::Log *Log = GetLog(LLDBLog::Modules); size_t SegmentCount = 0; std::string SegmentName; @@ -2616,8 +2616,7 @@ unsigned ObjectFileELF::ApplyRelocations( ((int64_t)value > INT32_MAX && (int64_t)value < INT32_MIN)) || (reloc_type(rel) == R_AARCH64_ABS32 && ((int64_t)value > INT32_MAX && (int64_t)value < INT32_MIN))) { - Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES); + Log *log = GetLog(LLDBLog::Modules); LLDB_LOGF(log, "Failed to apply debug info relocations"); break; } diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 36ef7b5..22ca13f 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -1666,7 +1666,7 @@ void ObjectFileMachO::ProcessSegmentCommand( // addresses will differ from what the ObjectFile had originally, // and what the dSYM has. if (is_dsym && unified_section_sp->GetFileAddress() != load_cmd.vmaddr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); + Log *log = GetLog(LLDBLog::Symbols); if (log) { log->Printf( "Installing dSYM's %s segment file address over ObjectFile's " @@ -2174,7 +2174,7 @@ UUID ObjectFileMachO::GetSharedCacheUUID(FileSpec dyld_shared_cache, dsc_uuid = UUID::fromOptionalData( dsc_header_data.GetData(&offset, sizeof(uuid_t)), sizeof(uuid_t)); } - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); + Log *log = GetLog(LLDBLog::Symbols); if (log && dsc_uuid.IsValid()) { LLDB_LOGF(log, "Shared cache %s has UUID %s", dyld_shared_cache.GetPath().c_str(), @@ -2235,7 +2235,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic); uint32_t i; FileSpecList dylib_files; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); + Log *log = GetLog(LLDBLog::Symbols); llvm::StringRef g_objc_v2_prefix_class("_OBJC_CLASS_$_"); llvm::StringRef g_objc_v2_prefix_metaclass("_OBJC_METACLASS_$_"); llvm::StringRef g_objc_v2_prefix_ivar("_OBJC_IVAR_$_"); @@ -2593,8 +2593,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { // sections - we should not make any assumptions about them based on that. if (function_starts_count == 0 && CalculateStrata() == eStrataUser) { m_allow_assembly_emulation_unwind_plans = false; - Log *unwind_or_symbol_log(lldb_private::GetLogIfAnyCategoriesSet( - LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_UNWIND)); + Log *unwind_or_symbol_log(GetLog(LLDBLog::Symbols | LLDBLog::Unwind)); if (unwind_or_symbol_log) module_sp->LogMessage( @@ -4908,8 +4907,7 @@ struct OSEnv { llvm::Triple::getEnvironmentTypeName(llvm::Triple::Simulator); return; default: { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::Symbols | LLDBLog::Process)); LLDB_LOGF(log, "unsupported platform in LC_BUILD_VERSION"); } } @@ -5838,8 +5836,7 @@ void ObjectFileMachO::GetProcessSharedCacheUUID(Process *process, dl->GetSharedCacheInformation(base_addr, uuid, using_shared_cache, private_shared_cache); } - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::Symbols | LLDBLog::Process)); LLDB_LOGF( log, "inferior process shared cache has a UUID of %s, base address 0x%" PRIx64, @@ -5933,8 +5930,7 @@ void ObjectFileMachO::GetLLDBSharedCacheUUID(addr_t &base_addr, UUID &uuid) { } } } - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::Symbols | LLDBLog::Process)); if (log && uuid.IsValid()) LLDB_LOGF(log, "lldb's in-memory shared cache has a UUID of %s base address of " @@ -6942,7 +6938,7 @@ ObjectFileMachO::GetCorefileAllImageInfos() { bool ObjectFileMachO::LoadCoreFileImages(lldb_private::Process &process) { MachOCorefileAllImageInfos image_infos = GetCorefileAllImageInfos(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); ModuleList added_modules; for (const MachOCorefileImageEntry &image : image_infos.all_image_infos) { diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index f69f3c3..62f7759 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -132,7 +132,7 @@ size_t ObjectFilePECOFF::GetModuleSpecifications( if (!data_sp || !ObjectFilePECOFF::MagicBytesMatch(data_sp)) return initial_count; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); if (data_sp->GetByteSize() < length) if (DataBufferSP full_sp = MapFileData(file, -1, file_offset)) @@ -212,7 +212,7 @@ bool ObjectFilePECOFF::CreateBinary() { if (m_binary) return true; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); auto binary = llvm::object::createBinary(llvm::MemoryBufferRef( toStringRef(m_data.GetData()), m_file.GetFilename().GetStringRef())); @@ -884,7 +884,7 @@ uint32_t ObjectFilePECOFF::ParseDependentModules() { if (!CreateBinary()) return 0; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOG(log, "this = {0}, module = {1} ({2}), file = {3}, binary = {4}", this, GetModule().get(), GetModule()->GetSpecificationDescription(), m_file.GetPath(), m_binary.get()); diff --git a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp index 7445f83..43a9559 100644 --- a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp +++ b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp @@ -90,7 +90,7 @@ ObjectFile * ObjectFileWasm::CreateInstance(const ModuleSP &module_sp, DataBufferSP &data_sp, offset_t data_offset, const FileSpec *file, offset_t file_offset, offset_t length) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); if (!data_sp) { data_sp = MapFileData(*file, length, file_offset); diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index 7d14f02..ee5029c 100644 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -115,7 +115,7 @@ DynamicRegisterInfo *OperatingSystemPython::GetDynamicRegisterInfo() { if (m_register_info_up == nullptr) { if (!m_interpreter || !m_python_object_sp) return nullptr; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OS)); + Log *log = GetLog(LLDBLog::OS); LLDB_LOGF(log, "OperatingSystemPython::GetDynamicRegisterInfo() fetching " @@ -141,7 +141,7 @@ bool OperatingSystemPython::UpdateThreadList(ThreadList &old_thread_list, if (!m_interpreter || !m_python_object_sp) return false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OS)); + Log *log = GetLog(LLDBLog::OS); // First thing we have to do is to try to get the API lock, and the // interpreter lock. We're going to change the thread content of the process, @@ -301,7 +301,7 @@ OperatingSystemPython::CreateRegisterContextForThread(Thread *thread, (void)api_lock.try_lock(); // See above. auto interpreter_lock = m_interpreter->AcquireInterpreterLock(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); if (reg_data_addr != LLDB_INVALID_ADDRESS) { // The registers data is in contiguous memory, just create the register @@ -363,7 +363,7 @@ OperatingSystemPython::CreateThreadStopReason(lldb_private::Thread *thread) { lldb::ThreadSP OperatingSystemPython::CreateThread(lldb::tid_t tid, addr_t context) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); LLDB_LOGF(log, "OperatingSystemPython::CreateThread (tid = 0x%" PRIx64 diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp index 3d48bd10..4ce88ee 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -58,7 +58,7 @@ void PlatformAndroid::Terminate() { } PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); if (log) { const char *arch_name; if (arch && arch->GetArchitectureName()) @@ -190,7 +190,7 @@ Status PlatformAndroid::GetFile(const FileSpec &source, auto source_file = source_spec.GetCString(false); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "Got mode == 0 on '%s': try to get file via 'shell cat'", source_file); @@ -265,7 +265,7 @@ uint32_t PlatformAndroid::GetSdkVersion() { version_string = llvm::StringRef(version_string).trim().str(); if (error.Fail() || version_string.empty()) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "Get SDK version failed. (error: %s, output: %s)", error.AsCString(), version_string.c_str()); return 0; @@ -313,7 +313,7 @@ Status PlatformAndroid::DownloadSymbolFile(const lldb::ModuleSP &module_sp, command.Printf("rm -rf %s", s->c_str()); Status error = adb.Shell(command.GetData(), seconds(5), nullptr); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); if (log && error.Fail()) LLDB_LOGF(log, "Failed to remove temp directory: %s", error.AsCString()); }); diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp index 4765bed..f0c62bd 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp @@ -28,7 +28,7 @@ static Status ForwardPortWithAdb( llvm::StringRef remote_socket_name, const llvm::Optional &socket_namespace, std::string &device_id) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); AdbClient adb; auto error = AdbClient::CreateByDeviceID(device_id, adb); @@ -89,7 +89,7 @@ bool PlatformAndroidRemoteGDBServer::LaunchGDBServer(lldb::pid_t &pid, socket_name)) return false; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); auto error = MakeConnectURL(pid, remote_port, socket_name.c_str(), connect_url); @@ -137,7 +137,7 @@ Status PlatformAndroidRemoteGDBServer::ConnectRemote(Args &args) { args.ReplaceArgumentAtIndex(0, connect_url); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "Rewritten platform connect URL: %s", connect_url.c_str()); error = PlatformRemoteGDBServer::ConnectRemote(args); @@ -153,7 +153,7 @@ Status PlatformAndroidRemoteGDBServer::DisconnectRemote() { } void PlatformAndroidRemoteGDBServer::DeleteForwardPort(lldb::pid_t pid) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); auto it = m_port_forwards.find(pid); if (it == m_port_forwards.end()) diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index 2bf0a44..821d179 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -45,7 +45,7 @@ static uint32_t g_initialize_count = 0; PlatformSP PlatformFreeBSD::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force, arch ? arch->GetArchitectureName() : "", arch ? arch->GetTriple().getTriple() : ""); diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp index 92f44b7..97c65c4 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -42,7 +42,7 @@ static uint32_t g_initialize_count = 0; PlatformSP PlatformLinux::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force, arch ? arch->GetArchitectureName() : "", arch ? arch->GetTriple().getTriple() : ""); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp index 8f27f6a..e1b8131 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -281,7 +281,7 @@ PlatformSP PlatformAppleSimulator::CreateInstance( llvm::StringRef sdk, lldb_private::XcodeSDK::Type sdk_type, CoreSimulatorSupport::DeviceType::ProductFamilyID kind, bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); if (log) { const char *arch_name; if (arch && arch->GetArchitectureName()) diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 461a21f..8522ffc 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -223,7 +223,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache( const lldb_private::FileSpecList *module_search_paths_ptr, llvm::SmallVectorImpl *old_modules, bool *did_create_ptr) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "[%s] Trying to find module %s/%s - platform path %s/%s symbol " "path %s/%s", @@ -283,7 +283,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache( if (err.Fail()) return err; if (FileSystem::Instance().Exists(module_cache_spec)) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "[%s] module %s/%s was rsynced and is now there", (IsHost() ? "host" : "remote"), module_spec.GetFileSpec().GetDirectory().AsCString(), @@ -313,7 +313,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache( low_remote, high_remote); if (low_local != low_remote || high_local != high_remote) { // bring in the remote file - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "[%s] module %s/%s needs to be replaced from remote copy", (IsHost() ? "host" : "remote"), @@ -329,7 +329,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache( ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture()); module_sp = std::make_shared(local_spec); module_sp->SetPlatformFileSpec(module_spec.GetFileSpec()); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "[%s] module %s/%s was found in the cache", (IsHost() ? "host" : "remote"), module_spec.GetFileSpec().GetDirectory().AsCString(), @@ -346,7 +346,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache( if (err.Fail()) return err; if (FileSystem::Instance().Exists(module_cache_spec)) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "[%s] module %s/%s is now cached and fine", (IsHost() ? "host" : "remote"), module_spec.GetFileSpec().GetDirectory().AsCString(), @@ -892,7 +892,7 @@ PlatformDarwin::ParseVersionBuildDir(llvm::StringRef dir) { llvm::Expected PlatformDarwin::FetchExtendedCrashInformation(Process &process) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); StructuredData::ArraySP annotations = ExtractCrashInfoAnnotations(process); @@ -911,7 +911,7 @@ PlatformDarwin::FetchExtendedCrashInformation(Process &process) { StructuredData::ArraySP PlatformDarwin::ExtractCrashInfoAnnotations(Process &process) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); ConstString section_name("__crash_info"); Target &target = process.GetTarget(); @@ -1089,11 +1089,10 @@ void PlatformDarwin::AddClangModuleCompilationOptionsForSDKType( case XcodeSDK::Type::bridgeOS: case XcodeSDK::Type::Linux: case XcodeSDK::Type::unknown: - if (lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST)) { + if (Log *log = GetLog(LLDBLog::Host)) { XcodeSDK::Info info; info.type = sdk_type; - LLDB_LOGF(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), - "Clang modules on %s are not supported", + LLDB_LOGF(log, "Clang modules on %s are not supported", XcodeSDK::GetCanonicalName(info).c_str()); } return; @@ -1256,7 +1255,7 @@ lldb_private::Status PlatformDarwin::FindBundleBinaryInExecSearchPaths( size_t num_module_search_paths = module_search_paths_ptr->GetSize(); for (size_t i = 0; i < num_module_search_paths; ++i) { - Log *log_verbose = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log_verbose = GetLog(LLDBLog::Host); LLDB_LOGF( log_verbose, "PlatformRemoteDarwinDevice::GetSharedModule searching for binary in " diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp index 75271ca..42f7adf 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -69,7 +69,7 @@ void PlatformDarwinKernel::Terminate() { PlatformSP PlatformDarwinKernel::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); if (log) { const char *arch_name; if (arch && arch->GetArchitectureName()) @@ -279,7 +279,7 @@ void PlatformDarwinKernel::GetStatus(Stream &strm) { strm.Printf(" Number of Kernel dSYM.yaa's indexed: %d\n", (int)m_kernel_dsyms_yaas.size()); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); if (log) { LLDB_LOGF(log, "\nkexts with dSYMs"); for (auto pos : m_name_to_kext_path_map_with_dsyms) { @@ -483,7 +483,7 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper( FileSpec file_spec(path); ConstString file_spec_extension = file_spec.GetFileNameExtension(); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGV(log, "PlatformDarwinKernel examining '{0}'", file_spec); @@ -575,7 +575,7 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper( void PlatformDarwinKernel::AddKextToMap(PlatformDarwinKernel *thisp, const FileSpec &file_spec) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); CFCBundle bundle(file_spec.GetPath().c_str()); CFStringRef bundle_id(bundle.GetIdentifier()); if (bundle_id && CFGetTypeID(bundle_id) == CFStringGetTypeID()) { diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp index 495e861..d4c4cee 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp @@ -57,7 +57,7 @@ void PlatformRemoteAppleBridge::Terminate() { PlatformSP PlatformRemoteAppleBridge::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); if (log) { const char *arch_name; if (arch && arch->GetArchitectureName()) diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp index d11e13c..c16cc39 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp @@ -58,7 +58,7 @@ void PlatformRemoteAppleTV::Terminate() { PlatformSP PlatformRemoteAppleTV::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); if (log) { const char *arch_name; if (arch && arch->GetArchitectureName()) diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp index e1d78be..b312e6e 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp @@ -55,7 +55,7 @@ void PlatformRemoteAppleWatch::Terminate() { PlatformSP PlatformRemoteAppleWatch::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); if (log) { const char *arch_name; if (arch && arch->GetArchitectureName()) diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp index 5bc90e7..9c1d475 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp @@ -136,7 +136,7 @@ PlatformRemoteDarwinDevice::GetContainedFilesIntoVectorOfStringsCallback( } bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); std::lock_guard guard(m_sdk_dir_mutex); if (m_sdk_directory_infos.empty()) { // A --sysroot option was supplied - add it to our list of SDKs to check @@ -382,7 +382,7 @@ const char *PlatformRemoteDarwinDevice::GetDeviceSupportDirectoryForOSVersion() uint32_t PlatformRemoteDarwinDevice::FindFileInAllSDKs(const char *platform_file_path, FileSpecList &file_list) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); if (platform_file_path && platform_file_path[0] && UpdateSDKDirectoryInfosIfNeeded()) { const uint32_t num_sdk_infos = m_sdk_directory_infos.size(); @@ -402,7 +402,7 @@ uint32_t PlatformRemoteDarwinDevice::FindFileInAllSDKs(const char *platform_file bool PlatformRemoteDarwinDevice::GetFileInSDK(const char *platform_file_path, uint32_t sdk_idx, lldb_private::FileSpec &local_file) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); if (sdk_idx < m_sdk_directory_infos.size()) { std::string sdkroot_path = m_sdk_directory_infos[sdk_idx].directory.GetPath(); @@ -435,7 +435,7 @@ bool PlatformRemoteDarwinDevice::GetFileInSDK(const char *platform_file_path, Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file, const UUID *uuid_ptr, FileSpec &local_file) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); Status error; char platform_file_path[PATH_MAX]; if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path))) { @@ -500,7 +500,7 @@ Status PlatformRemoteDarwinDevice::GetSharedModule( // we ask for the file in the cached SDK, then we attempt to get a shared // module for the right architecture with the right UUID. const FileSpec &platform_file = module_spec.GetFileSpec(); - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); Status error; char platform_file_path[PATH_MAX]; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp index 1ddfee6..1b46412 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp @@ -58,7 +58,7 @@ void PlatformRemoteMacOSX::Terminate() { PlatformSP PlatformRemoteMacOSX::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); if (log) { const char *arch_name; if (arch && arch->GetArchitectureName()) diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp index 94e2317..7ec0459 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -52,7 +52,7 @@ void PlatformRemoteiOS::Terminate() { } PlatformSP PlatformRemoteiOS::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); if (log) { const char *arch_name; if (arch && arch->GetArchitectureName()) diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp index ddba64b..7f191e3 100644 --- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp +++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp @@ -40,7 +40,7 @@ static uint32_t g_initialize_count = 0; PlatformSP PlatformNetBSD::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force, arch ? arch->GetArchitectureName() : "", arch ? arch->GetTriple().getTriple() : ""); diff --git a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp index 84d9ff7..eaf7c8c 100644 --- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp +++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp @@ -40,7 +40,7 @@ static uint32_t g_initialize_count = 0; PlatformSP PlatformOpenBSD::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force, arch ? arch->GetArchitectureName() : "", arch ? arch->GetTriple().getTriple() : ""); diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp index 1d989b2..7c32e79 100644 --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -89,7 +89,7 @@ lldb_private::Status PlatformPOSIX::PutFile(const lldb_private::FileSpec &source, const lldb_private::FileSpec &destination, uint32_t uid, uint32_t gid) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); if (IsHost()) { if (source == destination) @@ -154,7 +154,7 @@ lldb_private::Status PlatformPOSIX::GetFile( const lldb_private::FileSpec &source, // remote file path const lldb_private::FileSpec &destination) // local file path { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); // Check the args, first. std::string src_path(source.GetPath()); @@ -360,7 +360,7 @@ lldb::ProcessSP PlatformPOSIX::Attach(ProcessAttachInfo &attach_info, Debugger &debugger, Target *target, Status &error) { lldb::ProcessSP process_sp; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); if (IsHost()) { if (target == nullptr) { @@ -413,7 +413,7 @@ lldb::ProcessSP PlatformPOSIX::Attach(ProcessAttachInfo &attach_info, lldb::ProcessSP PlatformPOSIX::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target &target, Status &error) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOG(log, "target {0}", &target); ProcessSP process_sp; diff --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp index dd7546d..db7404a 100644 --- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp +++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp @@ -160,7 +160,7 @@ static Environment ComputeLaunchEnvironment(Environment target, lldb::ProcessSP PlatformQemuUser::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target &target, Status &error) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = GetLog(LLDBLog::Platform); FileSpec qemu = GetGlobalProperties().GetEmulatorPath(); if (!qemu) diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp index 0929a06..46a6c12 100644 --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -92,7 +92,7 @@ llvm::StringRef PlatformRemoteGDBServer::GetDescription() { bool PlatformRemoteGDBServer::GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = GetLog(LLDBLog::Platform); const auto module_path = module_file_spec.GetPath(false); @@ -171,7 +171,7 @@ ArchSpec PlatformRemoteGDBServer::GetRemoteSystemArchitecture() { FileSpec PlatformRemoteGDBServer::GetRemoteWorkingDirectory() { if (IsConnected()) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = GetLog(LLDBLog::Platform); FileSpec working_dir; if (m_gdb_client_up->GetWorkingDir(working_dir) && log) LLDB_LOGF(log, @@ -188,7 +188,7 @@ bool PlatformRemoteGDBServer::SetRemoteWorkingDirectory( if (IsConnected()) { // Clear the working directory it case it doesn't get set correctly. This // will for use to re-read it - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "PlatformRemoteGDBServer::SetRemoteWorkingDirectory('%s')", working_dir.GetCString()); return m_gdb_client_up->SetWorkingDir(working_dir) == 0; @@ -318,7 +318,7 @@ bool PlatformRemoteGDBServer::GetProcessInfo( } Status PlatformRemoteGDBServer::LaunchProcess(ProcessLaunchInfo &launch_info) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); Status error; LLDB_LOGF(log, "PlatformRemoteGDBServer::%s() called", __FUNCTION__); @@ -539,7 +539,7 @@ Status PlatformRemoteGDBServer::MakeDirectory(const FileSpec &file_spec, if (!IsConnected()) return Status("Not connected."); Status error = m_gdb_client_up->MakeDirectory(file_spec, mode); - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "PlatformRemoteGDBServer::MakeDirectory(path='%s', mode=%o) " "error = %u (%s)", @@ -553,7 +553,7 @@ Status PlatformRemoteGDBServer::GetFilePermissions(const FileSpec &file_spec, return Status("Not connected."); Status error = m_gdb_client_up->GetFilePermissions(file_spec, file_permissions); - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "PlatformRemoteGDBServer::GetFilePermissions(path='%s', " "file_permissions=%o) error = %u (%s)", @@ -568,7 +568,7 @@ Status PlatformRemoteGDBServer::SetFilePermissions(const FileSpec &file_spec, return Status("Not connected."); Status error = m_gdb_client_up->SetFilePermissions(file_spec, file_permissions); - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "PlatformRemoteGDBServer::SetFilePermissions(path='%s', " "file_permissions=%o) error = %u (%s)", @@ -637,7 +637,7 @@ Status PlatformRemoteGDBServer::CreateSymlink( if (!IsConnected()) return Status("Not connected."); Status error = m_gdb_client_up->CreateSymlink(src, dst); - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "PlatformRemoteGDBServer::CreateSymlink(src='%s', dst='%s') " "error = %u (%s)", @@ -650,7 +650,7 @@ Status PlatformRemoteGDBServer::Unlink(const FileSpec &file_spec) { if (!IsConnected()) return Status("Not connected."); Status error = m_gdb_client_up->Unlink(file_spec); - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "PlatformRemoteGDBServer::Unlink(path='%s') error = %u (%s)", file_spec.GetCString(), error.GetError(), error.AsCString()); return error; diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index e4dec0e..3e2b453 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -429,7 +429,7 @@ Status NativeProcessLinux::SetDefaultPtraceOpts(lldb::pid_t pid) { // Handles all waitpid events from the inferior process. void NativeProcessLinux::MonitorCallback(NativeThreadLinux &thread, WaitStatus status) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // Certain activities differ based on whether the pid is the tid of the main // thread. @@ -714,8 +714,7 @@ void NativeProcessLinux::MonitorTrace(NativeThreadLinux &thread) { } void NativeProcessLinux::MonitorBreakpoint(NativeThreadLinux &thread) { - Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Breakpoints); LLDB_LOG(log, "received breakpoint event, pid = {0}", thread.GetID()); // Mark the thread as stopped at breakpoint. @@ -731,8 +730,7 @@ void NativeProcessLinux::MonitorBreakpoint(NativeThreadLinux &thread) { void NativeProcessLinux::MonitorWatchpoint(NativeThreadLinux &thread, uint32_t wp_index) { - Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Watchpoints); LLDB_LOG(log, "received watchpoint event, pid = {0}, wp_index = {1}", thread.GetID(), wp_index); @@ -1828,8 +1826,7 @@ void NativeProcessLinux::SignalIfAllThreadsStopped() { } // We have a pending notification and all threads have stopped. - Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Breakpoints); // Clear any temporary breakpoints we used to implement software single // stepping. diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp index a5187a6..91bca7e 100644 --- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp @@ -110,7 +110,7 @@ lldb::StateType NativeThreadLinux::GetState() { return m_state; } bool NativeThreadLinux::GetStopReason(ThreadStopInfo &stop_info, std::string &description) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); description.clear(); @@ -277,7 +277,7 @@ Status NativeThreadLinux::SingleStep(uint32_t signo) { void NativeThreadLinux::SetStoppedBySignal(uint32_t signo, const siginfo_t *info) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); LLDB_LOGF(log, "NativeThreadLinux::%s called with signal 0x%02" PRIx32, __FUNCTION__, signo); @@ -391,7 +391,7 @@ void NativeThreadLinux::SetStopped() { } void NativeThreadLinux::SetStoppedByExec() { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); LLDB_LOGF(log, "NativeThreadLinux::%s()", __FUNCTION__); SetStopped(); @@ -493,7 +493,7 @@ void NativeThreadLinux::SetExited() { } Status NativeThreadLinux::RequestStop() { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); NativeProcessLinux &process = GetProcess(); @@ -519,7 +519,7 @@ Status NativeThreadLinux::RequestStop() { } void NativeThreadLinux::MaybeLogStateChange(lldb::StateType new_state) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); // If we're not logging, we're done. if (!log) return; diff --git a/lldb/source/Plugins/Process/Utility/HistoryThread.cpp b/lldb/source/Plugins/Process/Utility/HistoryThread.cpp index d73b132..7b0aeed 100644 --- a/lldb/source/Plugins/Process/Utility/HistoryThread.cpp +++ b/lldb/source/Plugins/Process/Utility/HistoryThread.cpp @@ -33,14 +33,14 @@ HistoryThread::HistoryThread(lldb_private::Process &process, lldb::tid_t tid, m_queue_id(LLDB_INVALID_QUEUE_ID) { m_unwinder_up = std::make_unique(*this, pcs, pcs_are_call_addresses); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOGF(log, "%p HistoryThread::HistoryThread", static_cast(this)); } // Destructor HistoryThread::~HistoryThread() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOGF(log, "%p HistoryThread::~HistoryThread (tid=0x%" PRIx64 ")", static_cast(this), GetID()); DestroyThread(); diff --git a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.cpp b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.cpp index feee857..dca5359 100644 --- a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.cpp +++ b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.cpp @@ -29,7 +29,7 @@ static constexpr inline uint64_t GetSizeBits(int size) { } uint32_t NativeRegisterContextDBReg_arm64::NumSupportedHardwareBreakpoints() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); llvm::Error error = ReadHardwareDebugInfo(); if (error) { LLDB_LOG_ERROR(log, std::move(error), @@ -43,7 +43,7 @@ uint32_t NativeRegisterContextDBReg_arm64::NumSupportedHardwareBreakpoints() { uint32_t NativeRegisterContextDBReg_arm64::SetHardwareBreakpoint(lldb::addr_t addr, size_t size) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOG(log, "addr: {0:x}, size: {1:x}", addr, size); // Read hardware breakpoint and watchpoint information. @@ -104,7 +104,7 @@ NativeRegisterContextDBReg_arm64::SetHardwareBreakpoint(lldb::addr_t addr, bool NativeRegisterContextDBReg_arm64::ClearHardwareBreakpoint( uint32_t hw_idx) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOG(log, "hw_idx: {0}", hw_idx); // Read hardware breakpoint and watchpoint information. @@ -144,7 +144,7 @@ bool NativeRegisterContextDBReg_arm64::ClearHardwareBreakpoint( Status NativeRegisterContextDBReg_arm64::GetHardwareBreakHitIndex( uint32_t &bp_index, lldb::addr_t trap_addr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "NativeRegisterContextDBReg_arm64::%s()", __FUNCTION__); @@ -164,7 +164,7 @@ Status NativeRegisterContextDBReg_arm64::GetHardwareBreakHitIndex( } Status NativeRegisterContextDBReg_arm64::ClearAllHardwareBreakpoints() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "NativeRegisterContextDBReg_arm64::%s()", __FUNCTION__); @@ -206,7 +206,7 @@ bool NativeRegisterContextDBReg_arm64::BreakpointIsEnabled(uint32_t bp_index) { } uint32_t NativeRegisterContextDBReg_arm64::NumSupportedHardwareWatchpoints() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); llvm::Error error = ReadHardwareDebugInfo(); if (error) { LLDB_LOG_ERROR(log, std::move(error), @@ -219,7 +219,7 @@ uint32_t NativeRegisterContextDBReg_arm64::NumSupportedHardwareWatchpoints() { uint32_t NativeRegisterContextDBReg_arm64::SetHardwareWatchpoint( lldb::addr_t addr, size_t size, uint32_t watch_flags) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOG(log, "addr: {0:x}, size: {1:x} watch_flags: {2:x}", addr, size, watch_flags); @@ -312,7 +312,7 @@ uint32_t NativeRegisterContextDBReg_arm64::SetHardwareWatchpoint( bool NativeRegisterContextDBReg_arm64::ClearHardwareWatchpoint( uint32_t wp_index) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}", wp_index); // Read hardware breakpoint and watchpoint information. @@ -384,7 +384,7 @@ Status NativeRegisterContextDBReg_arm64::ClearAllHardwareWatchpoints() { uint32_t NativeRegisterContextDBReg_arm64::GetWatchpointSize(uint32_t wp_index) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}", wp_index); switch ((m_hwp_regs[wp_index].control >> 5) & 0xff) { @@ -402,7 +402,7 @@ NativeRegisterContextDBReg_arm64::GetWatchpointSize(uint32_t wp_index) { } bool NativeRegisterContextDBReg_arm64::WatchpointIsEnabled(uint32_t wp_index) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}", wp_index); if ((m_hwp_regs[wp_index].control & g_enable_bit) != 0) @@ -413,7 +413,7 @@ bool NativeRegisterContextDBReg_arm64::WatchpointIsEnabled(uint32_t wp_index) { Status NativeRegisterContextDBReg_arm64::GetWatchpointHitIndex( uint32_t &wp_index, lldb::addr_t trap_addr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}, trap_addr: {1:x}", wp_index, trap_addr); // Read hardware breakpoint and watchpoint information. @@ -444,7 +444,7 @@ Status NativeRegisterContextDBReg_arm64::GetWatchpointHitIndex( lldb::addr_t NativeRegisterContextDBReg_arm64::GetWatchpointAddress(uint32_t wp_index) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}", wp_index); if (wp_index >= m_max_hwp_supported) @@ -457,7 +457,7 @@ NativeRegisterContextDBReg_arm64::GetWatchpointAddress(uint32_t wp_index) { lldb::addr_t NativeRegisterContextDBReg_arm64::GetWatchpointHitAddress(uint32_t wp_index) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOG(log, "wp_index: {0}", wp_index); if (wp_index >= m_max_hwp_supported) diff --git a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.cpp b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.cpp index 56c1757..9664c26 100644 --- a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.cpp +++ b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.cpp @@ -242,7 +242,7 @@ Status NativeRegisterContextDBReg_x86::ClearAllHardwareWatchpoints() { uint32_t NativeRegisterContextDBReg_x86::SetHardwareWatchpoint( lldb::addr_t addr, size_t size, uint32_t watch_flags) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints(); for (uint32_t wp_index = 0; wp_index < num_hw_watchpoints; ++wp_index) { bool is_vacant; diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp index b2b16cd..f2e60bb 100644 --- a/lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp @@ -48,7 +48,7 @@ Status NativeThreadWindows::DoResume(lldb::StateType resume_state) { return Status(); if (resume_state == eStateStepping) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); uint32_t flags_index = GetRegisterContext().ConvertRegisterKindToRegisterNumber( @@ -118,7 +118,7 @@ void NativeThreadWindows::SetStopReason(ThreadStopInfo stop_info, bool NativeThreadWindows::GetStopReason(ThreadStopInfo &stop_info, std::string &description) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); switch (m_state) { case eStateStopped: diff --git a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp index 9810d21..ed6651c 100644 --- a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp @@ -61,7 +61,7 @@ RegisterContextSP TargetThreadWindows::CreateRegisterContextForFrame(StackFrame *frame) { RegisterContextSP reg_ctx_sp; uint32_t concrete_frame_idx = 0; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); if (frame) concrete_frame_idx = frame->GetConcreteFrameIndex(); @@ -131,7 +131,7 @@ Status TargetThreadWindows::DoResume() { return Status(); if (resume_state == eStateStepping) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); uint32_t flags_index = GetRegisterContext()->ConvertRegisterKindToRegisterNumber( diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp index 65dbc8e..9f0321d 100644 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -402,7 +402,7 @@ static void ParseFreeBSDPrStatus(ThreadData &thread_data, lldb::offset_t offset = 0; int pr_version = data.GetU32(&offset); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); if (log) { if (pr_version > 1) LLDB_LOGF(log, "FreeBSD PRSTATUS unexpected version %d", pr_version); @@ -430,7 +430,7 @@ static void ParseFreeBSDPrPsInfo(ProcessElfCore &process, lldb::offset_t offset = 0; int pr_version = data.GetU32(&offset); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); if (log) { if (pr_version > 1) LLDB_LOGF(log, "FreeBSD PRPSINFO unexpected version %d", pr_version); diff --git a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp index 937d074..92a5bde 100644 --- a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp @@ -64,7 +64,7 @@ RegisterContextSP ThreadElfCore::CreateRegisterContextForFrame(StackFrame *frame) { RegisterContextSP reg_ctx_sp; uint32_t concrete_frame_idx = 0; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); if (frame) concrete_frame_idx = frame->GetConcreteFrameIndex(); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 91b9151..3e30ae3 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -2778,7 +2778,7 @@ bool GDBRemoteCommunicationClient::GetThreadStopInfo( uint8_t GDBRemoteCommunicationClient::SendGDBStoppointTypePacket( GDBStoppointType type, bool insert, addr_t addr, uint32_t length, std::chrono::seconds timeout) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "GDBRemoteCommunicationClient::%s() %s at addr = 0x%" PRIx64, __FUNCTION__, insert ? "add" : "remove", addr); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp index f371649..2eac2db 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -426,7 +426,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerCommon::Handle_qUserName( StringExtractorGDBRemote &packet) { #if LLDB_ENABLE_POSIX - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "GDBRemoteCommunicationServerCommon::%s begin", __FUNCTION__); // Packet format: "qUserName:%i" where %i is the uid @@ -1020,7 +1020,7 @@ GDBRemoteCommunicationServerCommon::Handle_A(StringExtractorGDBRemote &packet) { // encoded argument value list, but we will stay true to the documented // version of the 'A' packet here... - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); int actual_arg_index = 0; packet.SetFilePos(1); // Skip the 'A' diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp index 123a819..495498e 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -241,7 +241,7 @@ void GDBRemoteCommunicationServerLLGS::SetLaunchInfo(const ProcessLaunchInfo &in } Status GDBRemoteCommunicationServerLLGS::LaunchProcess() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); if (!m_process_launch_info.GetArguments().GetArgumentCount()) return Status("%s: no process command line specified to launch", @@ -323,7 +323,7 @@ Status GDBRemoteCommunicationServerLLGS::LaunchProcess() { } Status GDBRemoteCommunicationServerLLGS::AttachToProcess(lldb::pid_t pid) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64, __FUNCTION__, pid); @@ -370,7 +370,7 @@ Status GDBRemoteCommunicationServerLLGS::AttachToProcess(lldb::pid_t pid) { Status GDBRemoteCommunicationServerLLGS::AttachWaitProcess( llvm::StringRef process_name, bool include_existing) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); std::chrono::milliseconds polling_interval = std::chrono::milliseconds(1); @@ -440,7 +440,7 @@ Status GDBRemoteCommunicationServerLLGS::AttachWaitProcess( void GDBRemoteCommunicationServerLLGS::InitializeDelegate( NativeProcessProtocol *process) { assert(process && "process cannot be NULL"); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); if (log) { LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called with " @@ -454,7 +454,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::SendWResponse( NativeProcessProtocol *process) { assert(process && "process cannot be NULL"); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // send W notification auto wait_status = process->GetExitStatus(); @@ -608,7 +608,7 @@ static void WriteRegisterValueInHexFixedWidth( static llvm::Optional GetRegistersAsJSON(NativeThreadProtocol &thread) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); NativeRegisterContext& reg_ctx = thread.GetRegisterContext(); @@ -693,7 +693,7 @@ static const char *GetStopReasonString(StopReason stop_reason) { static llvm::Expected GetJSONThreadsInfo(NativeProcessProtocol &process, bool abridged) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Thread); json::Array threads_array; @@ -766,7 +766,7 @@ GetJSONThreadsInfo(NativeProcessProtocol &process, bool abridged) { GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread( lldb::tid_t tid) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Thread); // Ensure we have a debugged process. if (!m_current_process || @@ -979,7 +979,7 @@ void GDBRemoteCommunicationServerLLGS::HandleInferiorState_Exited( NativeProcessProtocol *process) { assert(process && "process cannot be NULL"); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__); PacketResult result = SendStopReasonForState(StateType::eStateExited); @@ -1003,7 +1003,7 @@ void GDBRemoteCommunicationServerLLGS::HandleInferiorState_Stopped( NativeProcessProtocol *process) { assert(process && "process cannot be NULL"); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__); // Send the stop reason unless this is the stop after the launch or attach. @@ -1028,7 +1028,7 @@ void GDBRemoteCommunicationServerLLGS::HandleInferiorState_Stopped( void GDBRemoteCommunicationServerLLGS::ProcessStateChanged( NativeProcessProtocol *process, lldb::StateType state) { assert(process && "process cannot be NULL"); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); if (log) { LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called with " @@ -1171,7 +1171,7 @@ void GDBRemoteCommunicationServerLLGS::StartSTDIOForwarding() { if (!m_stdio_handle_up) { // Not much we can do about the failure. Log it and continue without // forwarding. - if (Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)) + if (Log *log = GetLog(LLDBLog::Process)) LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s Failed to set up stdio " "forwarding: %s", @@ -1198,7 +1198,7 @@ void GDBRemoteCommunicationServerLLGS::SendProcessOutput() { case eConnectionStatusEndOfFile: case eConnectionStatusError: case eConnectionStatusNoConnection: - if (Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)) + if (Log *log = GetLog(LLDBLog::Process)) LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s Stopping stdio " "forwarding as communication returned status %d (error: " @@ -1356,7 +1356,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qC(StringExtractorGDBRemote &packet) { GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_k(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); StopSTDIOForwarding(); @@ -1425,7 +1425,7 @@ GDBRemoteCommunicationServerLLGS::Handle_QListThreadsInStopReply( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_C(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Thread); LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__); // Ensure we have a native process. @@ -1506,7 +1506,7 @@ GDBRemoteCommunicationServerLLGS::Handle_C(StringExtractorGDBRemote &packet) { GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_c(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Thread); LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__); packet.SetFilePos(packet.GetFilePos() + ::strlen("c")); @@ -1556,7 +1556,7 @@ GDBRemoteCommunicationServerLLGS::Handle_vCont_actions( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_vCont( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s handling vCont packet", __FUNCTION__); @@ -1661,7 +1661,7 @@ GDBRemoteCommunicationServerLLGS::Handle_vCont( } void GDBRemoteCommunicationServerLLGS::SetCurrentThreadID(lldb::tid_t tid) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); LLDB_LOG(log, "setting current thread id to {0}", tid); m_current_tid = tid; @@ -1670,7 +1670,7 @@ void GDBRemoteCommunicationServerLLGS::SetCurrentThreadID(lldb::tid_t tid) { } void GDBRemoteCommunicationServerLLGS::SetContinueThreadID(lldb::tid_t tid) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); LLDB_LOG(log, "setting continue thread id to {0}", tid); m_continue_tid = tid; @@ -1691,7 +1691,7 @@ GDBRemoteCommunicationServerLLGS::Handle_stop_reason( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::SendStopReasonForState( lldb::StateType process_state) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); switch (process_state) { case eStateAttaching: @@ -1822,7 +1822,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qRegisterInfo( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_qfThreadInfo( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); // Fail if we don't have a current process. if (!m_current_process || @@ -1864,7 +1864,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qsThreadInfo( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_g(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); // Move past packet name. packet.SetFilePos(strlen("g")); @@ -1919,7 +1919,7 @@ GDBRemoteCommunicationServerLLGS::Handle_g(StringExtractorGDBRemote &packet) { GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_p(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); // Parse out the register number from the request. packet.SetFilePos(strlen("p")); @@ -1995,7 +1995,7 @@ GDBRemoteCommunicationServerLLGS::Handle_p(StringExtractorGDBRemote &packet) { GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_P(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); // Ensure there is more content. if (packet.GetBytesLeft() < 1) @@ -2075,7 +2075,7 @@ GDBRemoteCommunicationServerLLGS::Handle_P(StringExtractorGDBRemote &packet) { GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_H(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); // Parse out which variant of $H is requested. packet.SetFilePos(strlen("H")); @@ -2166,7 +2166,7 @@ GDBRemoteCommunicationServerLLGS::Handle_H(StringExtractorGDBRemote &packet) { GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_I(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); // Fail if we don't have a current process. if (!m_current_process || @@ -2202,7 +2202,7 @@ GDBRemoteCommunicationServerLLGS::Handle_I(StringExtractorGDBRemote &packet) { GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_interrupt( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Thread); // Fail if we don't have a current process. if (!m_current_process || @@ -2228,7 +2228,7 @@ GDBRemoteCommunicationServerLLGS::Handle_interrupt( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_memory_read( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); if (!m_current_process || (m_current_process->GetID() == LLDB_INVALID_PROCESS_ID)) { @@ -2308,7 +2308,7 @@ GDBRemoteCommunicationServerLLGS::Handle_memory_read( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle__M(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); if (!m_current_process || (m_current_process->GetID() == LLDB_INVALID_PROCESS_ID)) { @@ -2357,7 +2357,7 @@ GDBRemoteCommunicationServerLLGS::Handle__M(StringExtractorGDBRemote &packet) { GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle__m(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); if (!m_current_process || (m_current_process->GetID() == LLDB_INVALID_PROCESS_ID)) { @@ -2385,7 +2385,7 @@ GDBRemoteCommunicationServerLLGS::Handle__m(StringExtractorGDBRemote &packet) { GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_M(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); if (!m_current_process || (m_current_process->GetID() == LLDB_INVALID_PROCESS_ID)) { @@ -2465,7 +2465,7 @@ GDBRemoteCommunicationServerLLGS::Handle_M(StringExtractorGDBRemote &packet) { GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfoSupported( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // Currently only the NativeProcessProtocol knows if it can handle a // qMemoryRegionInfoSupported request, but we're not guaranteed to be @@ -2498,7 +2498,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfoSupported( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfo( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // Ensure we have a process. if (!m_current_process || @@ -2580,7 +2580,7 @@ GDBRemoteCommunicationServerLLGS::Handle_Z(StringExtractorGDBRemote &packet) { // Ensure we have a process. if (!m_current_process || (m_current_process->GetID() == LLDB_INVALID_PROCESS_ID)) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOG(log, "failed, no process available"); return SendErrorResponse(0x15); } @@ -2652,7 +2652,7 @@ GDBRemoteCommunicationServerLLGS::Handle_Z(StringExtractorGDBRemote &packet) { m_current_process->SetBreakpoint(addr, size, want_hardware); if (error.Success()) return SendOKResponse(); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOG(log, "pid {0} failed to set breakpoint: {1}", m_current_process->GetID(), error); return SendErrorResponse(0x09); @@ -2662,7 +2662,7 @@ GDBRemoteCommunicationServerLLGS::Handle_Z(StringExtractorGDBRemote &packet) { addr, size, watch_flags, want_hardware); if (error.Success()) return SendOKResponse(); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOG(log, "pid {0} failed to set watchpoint: {1}", m_current_process->GetID(), error); return SendErrorResponse(0x09); @@ -2674,7 +2674,7 @@ GDBRemoteCommunicationServerLLGS::Handle_z(StringExtractorGDBRemote &packet) { // Ensure we have a process. if (!m_current_process || (m_current_process->GetID() == LLDB_INVALID_PROCESS_ID)) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOG(log, "failed, no process available"); return SendErrorResponse(0x15); } @@ -2740,7 +2740,7 @@ GDBRemoteCommunicationServerLLGS::Handle_z(StringExtractorGDBRemote &packet) { m_current_process->RemoveBreakpoint(addr, want_hardware); if (error.Success()) return SendOKResponse(); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOG(log, "pid {0} failed to remove breakpoint: {1}", m_current_process->GetID(), error); return SendErrorResponse(0x09); @@ -2749,7 +2749,7 @@ GDBRemoteCommunicationServerLLGS::Handle_z(StringExtractorGDBRemote &packet) { const Status error = m_current_process->RemoveWatchpoint(addr); if (error.Success()) return SendOKResponse(); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOG(log, "pid {0} failed to remove watchpoint: {1}", m_current_process->GetID(), error); return SendErrorResponse(0x09); @@ -2758,7 +2758,7 @@ GDBRemoteCommunicationServerLLGS::Handle_z(StringExtractorGDBRemote &packet) { GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_s(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Thread); // Ensure we have a process. if (!m_continue_process || @@ -2815,7 +2815,7 @@ GDBRemoteCommunicationServerLLGS::BuildTargetXml() { return llvm::createStringError(llvm::inconvertibleErrorCode(), "No thread available"); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Thread); // Get the register context for the first thread. NativeRegisterContext ®_context = thread->GetRegisterContext(); @@ -3032,7 +3032,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qXfer( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_QSaveRegisterState( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); // Move past packet name. packet.SetFilePos(strlen("QSaveRegisterState")); @@ -3080,7 +3080,7 @@ GDBRemoteCommunicationServerLLGS::Handle_QSaveRegisterState( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_QRestoreRegisterState( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); // Parse out save id. packet.SetFilePos(strlen("QRestoreRegisterState:")); @@ -3141,7 +3141,7 @@ GDBRemoteCommunicationServerLLGS::Handle_QRestoreRegisterState( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_vAttach( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // Consume the ';' after vAttach. packet.SetFilePos(strlen("vAttach")); @@ -3177,7 +3177,7 @@ GDBRemoteCommunicationServerLLGS::Handle_vAttach( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_vAttachWait( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // Consume the ';' after the identifier. packet.SetFilePos(strlen("vAttachWait")); @@ -3213,7 +3213,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qVAttachOrWaitSupported( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_vAttachOrWait( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // Consume the ';' after the identifier. packet.SetFilePos(strlen("vAttachOrWait")); @@ -3243,7 +3243,7 @@ GDBRemoteCommunicationServerLLGS::Handle_vAttachOrWait( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_vRun( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); llvm::StringRef s = packet.GetStringRef(); if (!s.consume_front("vRun;")) @@ -3322,7 +3322,7 @@ GDBRemoteCommunicationServerLLGS::Handle_D(StringExtractorGDBRemote &packet) { GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_qThreadStopInfo( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); packet.SetFilePos(strlen("qThreadStopInfo")); const lldb::tid_t tid = packet.GetHexMaxU64(false, LLDB_INVALID_THREAD_ID); @@ -3339,7 +3339,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qThreadStopInfo( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_jThreadsInfo( StringExtractorGDBRemote &) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Thread); // Ensure we have a debugged process. if (!m_current_process || @@ -3455,7 +3455,7 @@ GDBRemoteCommunicationServerLLGS::Handle_QPassSignals( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_qMemTags( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // Ensure we have a process. if (!m_current_process || @@ -3536,7 +3536,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qMemTags( GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_QMemTags( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // Ensure we have a process. if (!m_current_process || @@ -3657,7 +3657,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qSaveCore( } void GDBRemoteCommunicationServerLLGS::MaybeCloseInferiorTerminalConnection() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // Tell the stdio connection to shut down. if (m_stdio_communication.IsConnected()) { @@ -3701,7 +3701,7 @@ NativeThreadProtocol *GDBRemoteCommunicationServerLLGS::GetThreadFromSuffix( return m_current_process->GetThreadByID(current_tid); } - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); // Parse out the ';'. if (packet.GetBytesLeft() < 1 || packet.GetChar() != ';') { @@ -3752,7 +3752,7 @@ uint32_t GDBRemoteCommunicationServerLLGS::GetNextSavedRegistersID() { } void GDBRemoteCommunicationServerLLGS::ClearProcessSpecificData() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOG(log, "clearing {0} xfer buffers", m_xfer_buffer_map.size()); m_xfer_buffer_map.clear(); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp index a63b98e..3baed6b 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -178,7 +178,7 @@ Status GDBRemoteCommunicationServerPlatform::LaunchGDBServer( if (hostname.empty()) hostname = "127.0.0.1"; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "Launching debugserver with: %s:%u...", hostname.c_str(), *port); @@ -228,7 +228,7 @@ GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer( // Spawn a local debugserver as a platform so we can then attach or launch a // process... - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "GDBRemoteCommunicationServerPlatform::%s() called", __FUNCTION__); diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 82357cd..1acd19e 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -606,7 +606,7 @@ Status ProcessGDBRemote::DoConnectRemote(llvm::StringRef remote_url) { ReadModuleFromMemory(FileSpec(namebuf), standalone_value); } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); if (module_sp.get()) { target.GetImages().AppendIfNeeded(module_sp, false); @@ -2919,8 +2919,7 @@ size_t ProcessGDBRemote::DoWriteMemory(addr_t addr, const void *buf, lldb::addr_t ProcessGDBRemote::DoAllocateMemory(size_t size, uint32_t permissions, Status &error) { - Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_EXPRESSIONS)); + Log *log = GetLog(LLDBLog::Process | LLDBLog::Expressions); addr_t allocated_addr = LLDB_INVALID_ADDRESS; if (m_gdb_comm.SupportsAllocDeallocMemory() != eLazyBoolNo) { @@ -3544,8 +3543,7 @@ bool ProcessGDBRemote::StartAsyncThread() { llvm::Expected async_thread = ThreadLauncher::LaunchThread( "", ProcessGDBRemote::AsyncThread, this); if (!async_thread) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), - async_thread.takeError(), + LLDB_LOG_ERROR(GetLog(LLDBLog::Host), async_thread.takeError(), "failed to launch host thread: {}"); return false; } @@ -3781,7 +3779,7 @@ bool ProcessGDBRemote::NewThreadNotifyBreakpointHit( // I don't think I have to do anything here, just make sure I notice the new // thread when it starts to // run so I can stop it if that's what I want to do. - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOGF(log, "Hit New Thread Notification breakpoint."); return false; } @@ -3824,7 +3822,7 @@ Status ProcessGDBRemote::UpdateAutomaticSignalFiltering() { } bool ProcessGDBRemote::StartNoticingNewThreads() { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (m_thread_create_bp_sp) { if (log && log->GetVerbose()) LLDB_LOGF(log, "Enabled noticing new thread breakpoint."); @@ -3850,7 +3848,7 @@ bool ProcessGDBRemote::StartNoticingNewThreads() { } bool ProcessGDBRemote::StopNoticingNewThreads() { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log && log->GetVerbose()) LLDB_LOGF(log, "Disabling new thread notification breakpoint."); @@ -4116,7 +4114,7 @@ void ProcessGDBRemote::SetUserSpecifiedMaxMemoryTransferSize( bool ProcessGDBRemote::GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = GetLog(LLDBLog::Platform); const ModuleCacheKey key(module_file_spec.GetPath(), arch.GetTriple().getTriple()); @@ -4495,7 +4493,7 @@ llvm::Expected ProcessGDBRemote::GetLoadedModuleList() { return llvm::createStringError(llvm::inconvertibleErrorCode(), "XML parsing not available"); - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "ProcessGDBRemote::%s", __FUNCTION__); LoadedModuleInfoList list; diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index 4b3e244d..6d32d12 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -124,8 +124,7 @@ ProcessMachCore::~ProcessMachCore() { } bool ProcessMachCore::GetDynamicLoaderAddress(lldb::addr_t addr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::DynamicLoader | LLDBLog::Process)); llvm::MachO::mach_header header; Status error; if (DoReadMemory(addr, &header, sizeof(header), error) != sizeof(header)) @@ -252,8 +251,7 @@ static bool load_standalone_binary(UUID uuid, addr_t value, // Process Control Status ProcessMachCore::DoLoadCore() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::DynamicLoader | LLDBLog::Process)); Status error; if (!m_core_module_sp) { error.SetErrorString("invalid core module"); diff --git a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp index 61106eb..097bbcd 100644 --- a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp +++ b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp @@ -84,8 +84,7 @@ llvm::ArrayRef MinidumpParser::GetThreads() { if (ExpectedThreads) return *ExpectedThreads; - LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD), - ExpectedThreads.takeError(), + LLDB_LOG_ERROR(GetLog(LLDBLog::Thread), ExpectedThreads.takeError(), "Failed to read thread list: {0}"); return {}; } @@ -141,8 +140,7 @@ ArchSpec MinidumpParser::GetArchitecture() { llvm::Expected system_info = m_file->getSystemInfo(); if (!system_info) { - LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS), - system_info.takeError(), + LLDB_LOG_ERROR(GetLog(LLDBLog::Process), system_info.takeError(), "Failed to read SystemInfo stream: {0}"); return m_arch; } @@ -200,8 +198,7 @@ ArchSpec MinidumpParser::GetArchitecture() { triple.setOS(llvm::Triple::OSType::UnknownOS); auto ExpectedCSD = m_file->getString(system_info->CSDVersionRVA); if (!ExpectedCSD) { - LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS), - ExpectedCSD.takeError(), + LLDB_LOG_ERROR(GetLog(LLDBLog::Process), ExpectedCSD.takeError(), "Failed to CSD Version string: {0}"); } else { if (ExpectedCSD->find("Linux") != std::string::npos) @@ -251,8 +248,7 @@ llvm::ArrayRef MinidumpParser::GetModuleList() { if (ExpectedModules) return *ExpectedModules; - LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES), - ExpectedModules.takeError(), + LLDB_LOG_ERROR(GetLog(LLDBLog::Modules), ExpectedModules.takeError(), "Failed to read module list: {0}"); return {}; } @@ -264,7 +260,7 @@ CreateRegionsCacheFromLinuxMaps(MinidumpParser &parser, if (data.empty()) return false; - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *log = GetLog(LLDBLog::Expressions); ParseLinuxMapRegions( llvm::toStringRef(data), [®ions, &log](llvm::Expected region) -> bool { @@ -345,7 +341,7 @@ static bool CheckForLinuxExecutable(ConstString path, } std::vector MinidumpParser::GetFilteredModuleList() { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES); + Log *log = GetLog(LLDBLog::Modules); auto ExpectedModules = GetMinidumpFile().getModuleList(); if (!ExpectedModules) { LLDB_LOG_ERROR(log, ExpectedModules.takeError(), @@ -425,8 +421,7 @@ const minidump::ExceptionStream *MinidumpParser::GetExceptionStream() { if (ExpectedStream) return &*ExpectedStream; - LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS), - ExpectedStream.takeError(), + LLDB_LOG_ERROR(GetLog(LLDBLog::Process), ExpectedStream.takeError(), "Failed to read minidump exception stream: {0}"); return nullptr; } @@ -434,7 +429,7 @@ const minidump::ExceptionStream *MinidumpParser::GetExceptionStream() { llvm::Optional MinidumpParser::FindMemoryRange(lldb::addr_t addr) { llvm::ArrayRef data64 = GetStream(StreamType::Memory64List); - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES); + Log *log = GetLog(LLDBLog::Modules); auto ExpectedMemory = GetMinidumpFile().getMemoryList(); if (!ExpectedMemory) { @@ -519,7 +514,7 @@ llvm::ArrayRef MinidumpParser::GetMemory(lldb::addr_t addr, static bool CreateRegionsCacheFromMemoryInfoList(MinidumpParser &parser, std::vector ®ions) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES); + Log *log = GetLog(LLDBLog::Modules); auto ExpectedInfo = parser.GetMinidumpFile().getMemoryInfoList(); if (!ExpectedInfo) { LLDB_LOG_ERROR(log, ExpectedInfo.takeError(), @@ -556,7 +551,7 @@ CreateRegionsCacheFromMemoryInfoList(MinidumpParser &parser, static bool CreateRegionsCacheFromMemoryList(MinidumpParser &parser, std::vector ®ions) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES); + Log *log = GetLog(LLDBLog::Modules); auto ExpectedMemory = parser.GetMinidumpFile().getMemoryList(); if (!ExpectedMemory) { LLDB_LOG_ERROR(log, ExpectedMemory.takeError(), diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp index 37ee546..9e99c6d 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -480,7 +480,7 @@ bool ProcessMinidump::DoUpdateThreadList(ThreadList &old_thread_list, ModuleSP ProcessMinidump::GetOrCreateModule(UUID minidump_uuid, llvm::StringRef name, ModuleSpec module_spec) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); Status error; ModuleSP module_sp = @@ -528,7 +528,7 @@ void ProcessMinidump::ReadModuleList() { std::vector filtered_modules = m_minidump_parser->GetFilteredModuleList(); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); for (auto module : filtered_modules) { std::string name = cantFail(m_minidump_parser->GetMinidumpFile().getString( diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp index 5eb7cb0..9ada076 100644 --- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp +++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp @@ -66,8 +66,7 @@ lldb::ProcessSP ScriptedProcess::CreateInstance(lldb::TargetSP target_sp, if (error.Fail() || !process_sp || !process_sp->m_script_object_sp || !process_sp->m_script_object_sp->IsValid()) { - LLDB_LOGF(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS), "%s", - error.AsCString()); + LLDB_LOGF(GetLog(LLDBLog::Process), "%s", error.AsCString()); return nullptr; } @@ -175,7 +174,7 @@ void ScriptedProcess::DidLaunch() { Status ScriptedProcess::DoResume() { CheckInterpreterAndScriptObject(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // FIXME: Fetch data from thread. const StateType thread_resume_state = eStateRunning; LLDB_LOGF(log, "ScriptedProcess::%s thread_resume_state = %s", __FUNCTION__, @@ -199,7 +198,7 @@ Status ScriptedProcess::DoResume() { Status ScriptedProcess::DoStop() { CheckInterpreterAndScriptObject(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); if (GetInterface().ShouldStop()) { SetPrivateState(eStateStopped); diff --git a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp index b6cbb62f..753213f 100644 --- a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp +++ b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp @@ -125,7 +125,7 @@ ScriptedThread::CreateRegisterContextForFrame(StackFrame *frame) { if (!reg_data) return GetInterface()->ErrorWithMessage( LLVM_PRETTY_FUNCTION, "Failed to get scripted thread registers data.", - error, LIBLLDB_LOG_THREAD); + error, LLDBLog::Thread); DataBufferSP data_sp( std::make_shared(reg_data->c_str(), reg_data->size())); @@ -133,7 +133,7 @@ ScriptedThread::CreateRegisterContextForFrame(StackFrame *frame) { if (!data_sp->GetByteSize()) return GetInterface()->ErrorWithMessage( LLVM_PRETTY_FUNCTION, "Failed to copy raw registers data.", error, - LIBLLDB_LOG_THREAD); + LLDBLog::Thread); std::shared_ptr reg_ctx_memory = std::make_shared( @@ -141,7 +141,7 @@ ScriptedThread::CreateRegisterContextForFrame(StackFrame *frame) { if (!reg_ctx_memory) return GetInterface()->ErrorWithMessage( LLVM_PRETTY_FUNCTION, "Failed to create a register context.", error, - LIBLLDB_LOG_THREAD); + LLDBLog::Thread); reg_ctx_memory->SetAllRegisterData(data_sp); m_reg_context_sp = reg_ctx_memory; @@ -156,7 +156,7 @@ bool ScriptedThread::CalculateStopInfo() { if (!dict_sp) return GetInterface()->ErrorWithMessage( LLVM_PRETTY_FUNCTION, "Failed to get scripted thread stop info.", error, - LIBLLDB_LOG_THREAD); + LLDBLog::Thread); lldb::StopInfoSP stop_info_sp; lldb::StopReason stop_reason_type; @@ -165,14 +165,14 @@ bool ScriptedThread::CalculateStopInfo() { return GetInterface()->ErrorWithMessage( LLVM_PRETTY_FUNCTION, "Couldn't find value for key 'type' in stop reason dictionary.", error, - LIBLLDB_LOG_THREAD); + LLDBLog::Thread); StructuredData::Dictionary *data_dict; if (!dict_sp->GetValueForKeyAsDictionary("data", data_dict)) return GetInterface()->ErrorWithMessage( LLVM_PRETTY_FUNCTION, "Couldn't find value for key 'data' in stop reason dictionary.", error, - LIBLLDB_LOG_THREAD); + LLDBLog::Thread); switch (stop_reason_type) { case lldb::eStopReasonNone: @@ -206,7 +206,7 @@ bool ScriptedThread::CalculateStopInfo() { llvm::Twine("Unsupported stop reason type (" + llvm::Twine(stop_reason_type) + llvm::Twine(").")) .str(), - error, LIBLLDB_LOG_THREAD); + error, LLDBLog::Thread); } if (!stop_info_sp) @@ -236,7 +236,7 @@ std::shared_ptr ScriptedThread::GetDynamicRegisterInfo() { ->ErrorWithMessage>( LLVM_PRETTY_FUNCTION, "Failed to get scripted thread registers info.", error, - LIBLLDB_LOG_THREAD); + LLDBLog::Thread); m_register_info_sp = std::make_shared( *reg_info, m_scripted_process.GetTarget().GetArchitecture()); diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp index 68f4e90..907978d 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp @@ -1050,7 +1050,7 @@ PythonException::PythonException(const char *caller) { PyErr_Clear(); } } - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT); + Log *log = GetLog(LLDBLog::Script); if (caller) LLDB_LOGF(log, "%s failed with exception: %s", caller, toCString()); else diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 1bf647e..f64effe 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -131,7 +131,7 @@ public: ~InitializePythonRAII() { if (m_was_already_initialized) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); + Log *log = GetLog(LLDBLog::Script); LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked", m_gil_state == PyGILState_UNLOCKED ? "un" : ""); PyGILState_Release(m_gil_state); @@ -201,7 +201,7 @@ private: #endif if (PyEval_ThreadsInitialized()) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); + Log *log = GetLog(LLDBLog::Script); m_was_already_initialized = true; m_gil_state = PyGILState_Ensure(); @@ -380,7 +380,7 @@ ScriptInterpreterPythonImpl::Locker::Locker( } bool ScriptInterpreterPythonImpl::Locker::DoAcquireLock() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); + Log *log = GetLog(LLDBLog::Script); m_GILState = PyGILState_Ensure(); LLDB_LOGV(log, "Ensured PyGILState. Previous state = {0}locked", m_GILState == PyGILState_UNLOCKED ? "un" : ""); @@ -404,7 +404,7 @@ bool ScriptInterpreterPythonImpl::Locker::DoInitSession(uint16_t on_entry_flags, } bool ScriptInterpreterPythonImpl::Locker::DoFreeLock() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); + Log *log = GetLog(LLDBLog::Script); LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked", m_GILState == PyGILState_UNLOCKED ? "un" : ""); PyGILState_Release(m_GILState); @@ -590,7 +590,7 @@ ScriptInterpreterPythonImpl::CreateInstance(Debugger &debugger) { } void ScriptInterpreterPythonImpl::LeaveSession() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); + Log *log = GetLog(LLDBLog::Script); if (log) log->PutCString("ScriptInterpreterPythonImpl::LeaveSession()"); @@ -660,7 +660,7 @@ bool ScriptInterpreterPythonImpl::EnterSession(uint16_t on_entry_flags, FileSP err_sp) { // If we have already entered the session, without having officially 'left' // it, then there is no need to 'enter' it again. - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); + Log *log = GetLog(LLDBLog::Script); if (m_session_is_active) { LLDB_LOGF( log, @@ -962,7 +962,7 @@ bool ScriptInterpreterPythonImpl::Interrupt() { // just our (hardcoded) input signal code SIGINT, so that's not useful at all. return true; #else - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); + Log *log = GetLog(LLDBLog::Script); if (IsExecutingPython()) { PyThreadState *state = PyThreadState_GET(); diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp index b024854..4b379a1 100644 --- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -958,7 +958,7 @@ public: }; EnableOptionsSP ParseAutoEnableOptions(Status &error, Debugger &debugger) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); + Log *log = GetLog(LLDBLog::Process); // We are abusing the options data model here so that we can parse options // without requiring the Debugger instance. @@ -1062,7 +1062,7 @@ bool StructuredDataDarwinLog::SupportsStructuredDataType( void StructuredDataDarwinLog::HandleArrivalOfStructuredData( Process &process, ConstString type_name, const StructuredData::ObjectSP &object_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); if (log) { StreamString json_stream; if (object_sp) @@ -1211,7 +1211,7 @@ void StructuredDataDarwinLog::SetEnabled(bool enabled) { void StructuredDataDarwinLog::ModulesDidLoad(Process &process, ModuleList &module_list) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "StructuredDataDarwinLog::%s called (process uid %u)", __FUNCTION__, process.GetUniqueID()); @@ -1388,7 +1388,7 @@ Status StructuredDataDarwinLog::FilterLaunchInfo(ProcessLaunchInfo &launch_info, // done by adding an environment variable to the process on launch. (This // also means it is not possible to suppress this behavior if attaching to an // already-running app). - // Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + // Log *log = GetLog(LLDBLog::Platform); // If the target architecture is not one that supports DarwinLog, we have // nothing to do here. @@ -1466,7 +1466,7 @@ bool StructuredDataDarwinLog::InitCompletionHookCallback( // finishes and control returns to our new thread plan, that is the time when // we can execute our logic to enable the logging support. - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "StructuredDataDarwinLog::%s() called", __FUNCTION__); // Get the current thread. @@ -1570,7 +1570,7 @@ bool StructuredDataDarwinLog::InitCompletionHookCallback( } void StructuredDataDarwinLog::AddInitCompletionHook(Process &process) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "StructuredDataDarwinLog::%s() called (process uid %u)", __FUNCTION__, process.GetUniqueID()); @@ -1769,7 +1769,7 @@ size_t StructuredDataDarwinLog::HandleDisplayOfEvent( } void StructuredDataDarwinLog::EnableNow() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "StructuredDataDarwinLog::%s() called", __FUNCTION__); // Run the enable command. diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp index 9d23f1b..d23959d 100644 --- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp +++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp @@ -228,7 +228,7 @@ FunctionSP SymbolFileBreakpad::GetOrCreateFunction(CompileUnit &comp_unit) { if (FunctionSP func_sp = comp_unit.FindFunctionByUID(id)) return func_sp; - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = GetLog(LLDBLog::Symbols); FunctionSP func_sp; addr_t base = GetBaseFileAddress(); if (base == LLDB_INVALID_ADDRESS) { @@ -347,7 +347,7 @@ void SymbolFileBreakpad::ParseInlineOriginRecords() { return; m_inline_origins.emplace(); - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = GetLog(LLDBLog::Symbols); for (llvm::StringRef line : lines(Record::InlineOrigin)) { auto record = InlineOriginRecord::parse(line); if (!record) { @@ -455,7 +455,7 @@ void SymbolFileBreakpad::FindTypes( llvm::DenseSet &searched_symbol_files, TypeMap &types) {} void SymbolFileBreakpad::AddSymbols(Symtab &symtab) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = GetLog(LLDBLog::Symbols); Module &module = *m_objfile_sp->GetModule(); addr_t base = GetBaseFileAddress(); if (base == LLDB_INVALID_ADDRESS) { @@ -581,7 +581,7 @@ llvm::ArrayRef SymbolFileBreakpad::SaveAsDWARF(postfix::Node &node) { bool SymbolFileBreakpad::ParseCFIUnwindRow(llvm::StringRef unwind_rules, const RegisterInfoResolver &resolver, UnwindPlan::Row &row) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = GetLog(LLDBLog::Symbols); llvm::BumpPtrAllocator node_alloc; llvm::Triple triple = m_objfile_sp->GetArchitecture().GetTriple(); @@ -690,7 +690,7 @@ SymbolFileBreakpad::ParseCFIUnwindPlan(const Bookmark &bookmark, UnwindPlanSP SymbolFileBreakpad::ParseWinUnwindPlan(const Bookmark &bookmark, const RegisterInfoResolver &resolver) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = GetLog(LLDBLog::Symbols); addr_t base = GetBaseFileAddress(); if (base == LLDB_INVALID_ADDRESS) return nullptr; @@ -794,7 +794,7 @@ void SymbolFileBreakpad::ParseFileRecords() { return; m_files.emplace(); - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = GetLog(LLDBLog::Symbols); for (llvm::StringRef line : lines(Record::File)) { auto record = FileRecord::parse(line); if (!record) { @@ -815,7 +815,7 @@ void SymbolFileBreakpad::ParseCUData() { return; m_cu_data.emplace(); - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = GetLog(LLDBLog::Symbols); addr_t base = GetBaseFileAddress(); if (base == LLDB_INVALID_ADDRESS) { LLDB_LOG(log, "SymbolFile parsing failed: Unable to fetch the base address " @@ -894,7 +894,7 @@ void SymbolFileBreakpad::ParseUnwindData() { return; m_unwind_data.emplace(); - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = GetLog(LLDBLog::Symbols); addr_t base = GetBaseFileAddress(); if (base == LLDB_INVALID_ADDRESS) { LLDB_LOG(log, "SymbolFile parsing failed: Unable to fetch the base address " diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 027a4ca..ef68549 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -825,8 +825,8 @@ Function *SymbolFileDWARF::ParseFunction(CompileUnit &comp_unit, auto type_system_or_err = GetTypeSystemForLanguage(GetLanguage(*die.GetCU())); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), "Unable to parse function"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Unable to parse function"); return nullptr; } DWARFASTParser *dwarf_ast = type_system_or_err->GetDWARFParser(); @@ -2098,8 +2098,7 @@ bool SymbolFileDWARF::DeclContextMatchesThisSymbolFile( auto type_system_or_err = GetTypeSystemForLanguage( decl_ctx_type_system->GetMinimumLanguage(nullptr)); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), "Unable to match namespace decl using TypeSystem"); return false; } @@ -2868,10 +2867,9 @@ TypeSP SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext( if (language != eLanguageTypeUnknown) { auto type_system_or_err = GetTypeSystemForLanguage(language); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), "Cannot get TypeSystem for language {}", - Language::GetNameForLanguageType(language)); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Cannot get TypeSystem for language {}", + Language::GetNameForLanguageType(language)); } else { type_system = &type_system_or_err.get(); } @@ -2967,8 +2965,8 @@ TypeSP SymbolFileDWARF::ParseType(const SymbolContext &sc, const DWARFDIE &die, auto type_system_or_err = GetTypeSystemForLanguage(GetLanguage(*die.GetCU())); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), "Unable to parse type"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Unable to parse type"); return {}; } @@ -3801,7 +3799,7 @@ SymbolFileDWARF::CollectCallEdges(ModuleSP module, DWARFDIE function_die) { if (!has_call_edges) return {}; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOG(log, "CollectCallEdges: Found call site info in {0}", function_die.GetPubname()); @@ -4025,8 +4023,8 @@ llvm::Expected SymbolFileDWARF::GetTypeSystem(DWARFUnit &unit) { DWARFASTParser *SymbolFileDWARF::GetDWARFParser(DWARFUnit &unit) { auto type_system_or_err = GetTypeSystem(unit); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), "Unable to get DWARFASTParser"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Unable to get DWARFASTParser"); return nullptr; } return type_system_or_err->GetDWARFParser(); diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp index a035a79..225dd72 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -302,8 +302,8 @@ void SymbolFileNativePDB::InitializeObject() { auto ts_or_err = m_objfile_sp->GetModule()->GetTypeSystemForLanguage( lldb::eLanguageTypeC_plus_plus); if (auto err = ts_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), "Failed to initialize"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Failed to initialize"); } else { ts_or_err->SetSymbolFile(this); auto *clang = llvm::cast_or_null(&ts_or_err.get()); diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp index d0b27bc..7fc762c 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp @@ -169,7 +169,7 @@ Error UdtRecordCompleter::visitKnownMember( TypeSystemClang::SetIntegerInitializerForVariable( decl, constant.Value.extOrTrunc(type_width)); } else { - LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST), + LLDB_LOG(GetLog(LLDBLog::AST), "Class '{0}' has a member '{1}' of type '{2}' ({3} bits) " "which resolves to a wider constant value ({4} bits). " "Ignoring constant.", @@ -190,7 +190,7 @@ Error UdtRecordCompleter::visitKnownMember( decl->setConstexpr(true); } else { LLDB_LOG( - GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST), + GetLog(LLDBLog::AST), "Class '{0}' has a member '{1}' of type '{2}' ({3} bits) " "which resolves to a constant value of mismatched width " "({4} bits). Ignoring constant.", diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp index f45287f..59517c7 100644 --- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -1298,7 +1298,7 @@ void PDBASTParser::AddRecordMembers( TypeSystemClang::SetIntegerInitializerForVariable( decl, value.toAPSInt().extOrTrunc(type_width)); } else { - LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST), + LLDB_LOG(GetLog(LLDBLog::AST), "Class '{0}' has a member '{1}' of type '{2}' ({3} bits) " "which resolves to a wider constant value ({4} bits). " "Ignoring constant.", @@ -1316,7 +1316,7 @@ void PDBASTParser::AddRecordMembers( decl, value.toAPFloat()); decl->setConstexpr(true); } else { - LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST), + LLDB_LOG(GetLog(LLDBLog::AST), "Class '{0}' has a member '{1}' of type '{2}' ({3} " "bits) which resolves to a constant value of mismatched " "width ({4} bits). Ignoring constant.", diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp index a40b6ec..f165452 100644 --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -307,8 +307,8 @@ SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc(const PDBSymbolFunc &pdb_func, LanguageType lang = ParseLanguage(comp_unit); auto type_system_or_err = GetTypeSystemForLanguage(lang); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), "Unable to parse PDBFunc"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Unable to parse PDBFunc"); return nullptr; } @@ -557,8 +557,8 @@ lldb_private::Type *SymbolFilePDB::ResolveTypeUID(lldb::user_id_t type_uid) { auto type_system_or_err = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), "Unable to ResolveTypeUID"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Unable to ResolveTypeUID"); return nullptr; } @@ -594,8 +594,8 @@ bool SymbolFilePDB::CompleteType(lldb_private::CompilerType &compiler_type) { auto type_system_or_err = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), "Unable to get dynamic array info for UID"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Unable to get dynamic array info for UID"); return false; } @@ -616,8 +616,8 @@ lldb_private::CompilerDecl SymbolFilePDB::GetDeclForUID(lldb::user_id_t uid) { auto type_system_or_err = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), "Unable to get decl for UID"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Unable to get decl for UID"); return CompilerDecl(); } @@ -646,8 +646,8 @@ SymbolFilePDB::GetDeclContextForUID(lldb::user_id_t uid) { auto type_system_or_err = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), "Unable to get DeclContext for UID"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Unable to get DeclContext for UID"); return CompilerDeclContext(); } @@ -676,8 +676,8 @@ SymbolFilePDB::GetDeclContextContainingUID(lldb::user_id_t uid) { auto type_system_or_err = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), "Unable to get DeclContext containing UID"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Unable to get DeclContext containing UID"); return CompilerDeclContext(); } @@ -705,8 +705,8 @@ void SymbolFilePDB::ParseDeclsForContext( auto type_system_or_err = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), "Unable to parse decls for context"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Unable to parse decls for context"); return; } @@ -1445,8 +1445,8 @@ void SymbolFilePDB::DumpClangAST(Stream &s) { auto type_system_or_err = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), "Unable to dump ClangAST"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Unable to dump ClangAST"); return; } @@ -1658,8 +1658,8 @@ PDBASTParser *SymbolFilePDB::GetPDBAstParser() { auto type_system_or_err = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), "Unable to get PDB AST parser"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Unable to get PDB AST parser"); return nullptr; } @@ -1678,9 +1678,8 @@ SymbolFilePDB::FindNamespace(lldb_private::ConstString name, auto type_system_or_err = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), "Unable to find namespace {}", - name.AsCString()); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Unable to find namespace {}", name.AsCString()); return CompilerDeclContext(); } @@ -1974,8 +1973,7 @@ bool SymbolFilePDB::DeclContextMatchesThisSymbolFile( decl_ctx_type_system->GetMinimumLanguage(nullptr)); if (auto err = type_system_or_err.takeError()) { LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), + GetLog(LLDBLog::Symbols), std::move(err), "Unable to determine if DeclContext matches this symbol file"); return false; } diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp index 7ece7f5..75d108f 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp @@ -129,7 +129,7 @@ lldb::addr_t AppleGetItemInfoHandler::SetupGetItemInfoFunction( Thread &thread, ValueList &get_item_info_arglist) { ExecutionContext exe_ctx(thread.shared_from_this()); DiagnosticManager diagnostics; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log = GetLog(LLDBLog::SystemRuntime); lldb::addr_t args_addr = LLDB_INVALID_ADDRESS; FunctionCaller *get_item_info_caller = nullptr; @@ -218,7 +218,7 @@ AppleGetItemInfoHandler::GetItemInfo(Thread &thread, uint64_t item, TargetSP target_sp(thread.CalculateTarget()); TypeSystemClang *clang_ast_context = ScratchTypeSystemClang::GetForTarget(*target_sp); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log = GetLog(LLDBLog::SystemRuntime); GetItemInfoReturnInfo return_value; return_value.item_buffer_ptr = LLDB_INVALID_ADDRESS; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp index 82b71b8..f081e39 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp @@ -133,7 +133,7 @@ lldb::addr_t AppleGetPendingItemsHandler::SetupGetPendingItemsFunction( ThreadSP thread_sp(thread.shared_from_this()); ExecutionContext exe_ctx(thread_sp); DiagnosticManager diagnostics; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log = GetLog(LLDBLog::SystemRuntime); lldb::addr_t args_addr = LLDB_INVALID_ADDRESS; FunctionCaller *get_pending_items_caller = nullptr; @@ -217,7 +217,7 @@ AppleGetPendingItemsHandler::GetPendingItems(Thread &thread, addr_t queue, TargetSP target_sp(thread.CalculateTarget()); TypeSystemClang *clang_ast_context = ScratchTypeSystemClang::GetForTarget(*target_sp); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log = GetLog(LLDBLog::SystemRuntime); GetPendingItemsReturnInfo return_value; return_value.items_buffer_ptr = LLDB_INVALID_ADDRESS; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp index f471871..703598b 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp @@ -146,7 +146,7 @@ AppleGetQueuesHandler::SetupGetQueuesFunction(Thread &thread, Address impl_code_address; DiagnosticManager diagnostics; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log = GetLog(LLDBLog::SystemRuntime); lldb::addr_t args_addr = LLDB_INVALID_ADDRESS; FunctionCaller *get_queues_caller = nullptr; @@ -222,7 +222,7 @@ AppleGetQueuesHandler::GetCurrentQueues(Thread &thread, addr_t page_to_free, TargetSP target_sp(thread.CalculateTarget()); TypeSystemClang *clang_ast_context = ScratchTypeSystemClang::GetForTarget(*target_sp); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log = GetLog(LLDBLog::SystemRuntime); GetQueuesReturnInfo return_value; return_value.queues_buffer_ptr = LLDB_INVALID_ADDRESS; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp index 7837dca..a31c7d3 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp @@ -140,7 +140,7 @@ lldb::addr_t AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction( ExecutionContext exe_ctx(thread_sp); Address impl_code_address; DiagnosticManager diagnostics; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log = GetLog(LLDBLog::SystemRuntime); lldb::addr_t args_addr = LLDB_INVALID_ADDRESS; FunctionCaller *get_thread_item_info_caller = nullptr; @@ -224,7 +224,7 @@ AppleGetThreadItemInfoHandler::GetThreadItemInfo(Thread &thread, TargetSP target_sp(thread.CalculateTarget()); TypeSystemClang *clang_ast_context = ScratchTypeSystemClang::GetForTarget(*target_sp); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log = GetLog(LLDBLog::SystemRuntime); GetThreadItemInfoReturnInfo return_value; return_value.item_buffer_ptr = LLDB_INVALID_ADDRESS; diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp index a490829..f9b2072 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -880,7 +880,7 @@ void SystemRuntimeMacOSX::PopulateQueuesUsingLibBTR( lldb_private::QueueList &queue_list) { Status error; DataBufferHeap data(queues_buffer_size, 0); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log = GetLog(LLDBLog::SystemRuntime); if (m_process->ReadMemory(queues_buffer, data.GetBytes(), queues_buffer_size, error) == queues_buffer_size && error.Success()) { diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 418f613..9808671 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -688,9 +688,7 @@ ASTContext &TypeSystemClang::getASTContext() { class NullDiagnosticConsumer : public DiagnosticConsumer { public: - NullDiagnosticConsumer() { - m_log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); - } + NullDiagnosticConsumer() { m_log = GetLog(LLDBLog::Expressions); } void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const clang::Diagnostic &info) override { @@ -1148,7 +1146,7 @@ CompilerType TypeSystemClang::GetBuiltinTypeForDWARFEncodingAndBitSize( break; } - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES); + Log *log = GetLog(LLDBLog::Commands); LLDB_LOG(log, "error: need to add support for DW_TAG_base_type '{0}' " "encoded with DW_ATE = {1:x}, bit_size = {2}", @@ -1492,7 +1490,7 @@ static bool TemplateParameterAllowsValue(NamedDecl *param, // There is no way to create other parameter decls at the moment, so we // can't reach this case during normal LLDB usage. Log that this happened // and assert. - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *log = GetLog(LLDBLog::Expressions); LLDB_LOG(log, "Don't know how to compare template parameter to passed" " value. Decl kind of parameter is: {0}", @@ -9793,8 +9791,8 @@ ScratchTypeSystemClang::GetForTarget(Target &target, auto type_system_or_err = target.GetScratchTypeSystemForLanguage( lldb::eLanguageTypeC, create_on_demand); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET), - std::move(err), "Couldn't get scratch TypeSystemClang"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Target), std::move(err), + "Couldn't get scratch TypeSystemClang"); return nullptr; } ScratchTypeSystemClang &scratch_ast = diff --git a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp index ccaac68..539763d 100644 --- a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp +++ b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp @@ -72,7 +72,7 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly( m_arch, nullptr, nullptr, range.GetBaseAddress(), opcode_data, opcode_size, 99999, prefer_file_cache)); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); if (disasm_sp) { @@ -379,7 +379,7 @@ size_t UnwindAssemblyInstEmulation::ReadMemory( EmulateInstruction *instruction, void *baton, const EmulateInstruction::Context &context, lldb::addr_t addr, void *dst, size_t dst_len) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); if (log && log->GetVerbose()) { StreamString strm; @@ -411,7 +411,7 @@ size_t UnwindAssemblyInstEmulation::WriteMemory( instruction->GetArchitecture().GetByteOrder(), instruction->GetArchitecture().GetAddressByteSize()); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); if (log && log->GetVerbose()) { StreamString strm; @@ -492,7 +492,7 @@ bool UnwindAssemblyInstEmulation::ReadRegister(EmulateInstruction *instruction, RegisterValue ®_value) { bool synthetic = GetRegisterValue(*reg_info, reg_value); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); if (log && log->GetVerbose()) { @@ -518,7 +518,7 @@ bool UnwindAssemblyInstEmulation::WriteRegister( bool UnwindAssemblyInstEmulation::WriteRegister( EmulateInstruction *instruction, const EmulateInstruction::Context &context, const RegisterInfo *reg_info, const RegisterValue ®_value) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); if (log && log->GetVerbose()) { diff --git a/lldb/source/Symbol/Block.cpp b/lldb/source/Symbol/Block.cpp index 4aafef3..0fac8b0 100644 --- a/lldb/source/Symbol/Block.cpp +++ b/lldb/source/Symbol/Block.cpp @@ -334,7 +334,7 @@ void Block::FinalizeRanges() { void Block::AddRange(const Range &range) { Block *parent_block = GetParent(); if (parent_block && !parent_block->Contains(range)) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); + Log *log = GetLog(LLDBLog::Symbols); if (log) { ModuleSP module_sp(m_parent_scope->CalculateSymbolContextModule()); Function *function = m_parent_scope->CalculateSymbolContextFunction(); diff --git a/lldb/source/Symbol/CompactUnwindInfo.cpp b/lldb/source/Symbol/CompactUnwindInfo.cpp index 830fe55..8656b24 100644 --- a/lldb/source/Symbol/CompactUnwindInfo.cpp +++ b/lldb/source/Symbol/CompactUnwindInfo.cpp @@ -182,7 +182,7 @@ bool CompactUnwindInfo::GetUnwindPlan(Target &target, Address addr, if (ArchSpec arch = m_objfile.GetArchitecture()) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); if (log && log->GetVerbose()) { StreamString strm; addr.Dump( @@ -251,7 +251,7 @@ void CompactUnwindInfo::ScanIndex(const ProcessSP &process_sp) { return; } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); if (log) m_objfile.GetModule()->LogMessage( log, "Reading compact unwind first-level indexes"); diff --git a/lldb/source/Symbol/DWARFCallFrameInfo.cpp b/lldb/source/Symbol/DWARFCallFrameInfo.cpp index f0dce8f..fd60186 100644 --- a/lldb/source/Symbol/DWARFCallFrameInfo.cpp +++ b/lldb/source/Symbol/DWARFCallFrameInfo.cpp @@ -396,7 +396,7 @@ DWARFCallFrameInfo::ParseCIE(const dw_offset_t cie_offset) { void DWARFCallFrameInfo::GetCFIData() { if (!m_cfi_data_initialized) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); if (log) m_objfile.GetModule()->LogMessage(log, "Reading EH frame info"); m_objfile.ReadSectionData(m_section_sp.get(), m_cfi_data); @@ -525,7 +525,7 @@ void DWARFCallFrameInfo::GetFDEIndex() { bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset, Address startaddr, UnwindPlan &unwind_plan) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND); + Log *log = GetLog(LLDBLog::Unwind); lldb::offset_t offset = dwarf_offset; lldb::offset_t current_entry = offset; diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp index dda9ec2..aba1003 100644 --- a/lldb/source/Symbol/Function.cpp +++ b/lldb/source/Symbol/Function.cpp @@ -122,7 +122,7 @@ size_t InlineFunctionInfo::MemorySize() const { lldb::addr_t CallEdge::GetLoadAddress(lldb::addr_t unresolved_pc, Function &caller, Target &target) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); const Address &caller_start_addr = caller.GetAddressRange().GetBaseAddress(); @@ -152,7 +152,7 @@ void DirectCallEdge::ParseSymbolFileAndResolve(ModuleList &images) { if (resolved) return; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOG(log, "DirectCallEdge: Lazily parsing the call graph for {0}", lazy_callee.symbol_name); @@ -191,7 +191,7 @@ Function *DirectCallEdge::GetCallee(ModuleList &images, ExecutionContext &) { Function *IndirectCallEdge::GetCallee(ModuleList &images, ExecutionContext &exe_ctx) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); Status error; Value callee_addr_val; if (!call_target.Evaluate(&exe_ctx, exe_ctx.GetRegisterContext(), @@ -295,7 +295,7 @@ llvm::ArrayRef> Function::GetCallEdges() { if (m_call_edges_resolved) return m_call_edges; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOG(log, "GetCallEdges: Attempting to parse call site info for {0}", GetDisplayName()); diff --git a/lldb/source/Symbol/LocateSymbolFile.cpp b/lldb/source/Symbol/LocateSymbolFile.cpp index ba79bf6..49b5e22 100644 --- a/lldb/source/Symbol/LocateSymbolFile.cpp +++ b/lldb/source/Symbol/LocateSymbolFile.cpp @@ -152,7 +152,7 @@ static bool LookForDsymNextToExecutablePath(const ModuleSpec &mod_spec, static bool LocateDSYMInVincinityOfExecutable(const ModuleSpec &module_spec, FileSpec &dsym_fspec) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); const FileSpec &exec_fspec = module_spec.GetFileSpec(); if (exec_fspec) { if (::LookForDsymNextToExecutablePath(module_spec, exec_fspec, diff --git a/lldb/source/Symbol/LocateSymbolFileMacOSX.cpp b/lldb/source/Symbol/LocateSymbolFileMacOSX.cpp index a13b4a7..f53a260 100644 --- a/lldb/source/Symbol/LocateSymbolFileMacOSX.cpp +++ b/lldb/source/Symbol/LocateSymbolFileMacOSX.cpp @@ -44,7 +44,7 @@ static CFDictionaryRef (*g_dlsym_DBGCopyDSYMPropertyLists)(CFURLRef dsym_url) = int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec, ModuleSpec &return_module_spec) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); if (!ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup()) { LLDB_LOGF(log, "Spotlight lookup for .dSYM bundles is disabled."); return 0; @@ -306,7 +306,7 @@ FileSpec Symbols::FindSymbolFileInBundle(const FileSpec &dsym_bundle_fspec, static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict, ModuleSpec &module_spec) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); bool success = false; if (uuid_dict != NULL && CFGetTypeID(uuid_dict) == CFDictionaryGetTypeID()) { std::string str; @@ -592,7 +592,7 @@ bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec, g_dsym_for_uuid_exe_path, file_path); if (!command.GetString().empty()) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); int exit_status = -1; int signo = -1; std::string command_output; diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index e7b19f5..b09252b 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -251,7 +251,7 @@ ObjectFile::ObjectFile(const lldb::ModuleSP &module_sp, m_file = *file_spec_ptr; if (data_sp) m_data.SetData(data_sp, data_offset, length); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOGF(log, "%p ObjectFile::ObjectFile() module = %p (%s), file = %s, " "file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64, @@ -270,7 +270,7 @@ ObjectFile::ObjectFile(const lldb::ModuleSP &module_sp, m_symtab_up(), m_symtab_once_up(new llvm::once_flag()) { if (header_data_sp) m_data.SetData(header_data_sp, 0, header_data_sp->GetByteSize()); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOGF(log, "%p ObjectFile::ObjectFile() module = %p (%s), process = %p, " "header_addr = 0x%" PRIx64, @@ -280,7 +280,7 @@ ObjectFile::ObjectFile(const lldb::ModuleSP &module_sp, } ObjectFile::~ObjectFile() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOGF(log, "%p ObjectFile::~ObjectFile ()\n", static_cast(this)); } @@ -573,7 +573,7 @@ bool ObjectFile::SplitArchivePathWithObject(llvm::StringRef path_with_object, void ObjectFile::ClearSymtab() { ModuleSP module_sp(GetModule()); if (module_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOGF(log, "%p ObjectFile::ClearSymtab () symtab = %p", static_cast(this), static_cast(m_symtab_up.get())); diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp index f1c3a9e..bb53895 100644 --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -477,7 +477,7 @@ bool SymbolContext::GetParentOfInlinedScope(const Address &curr_frame_pc, curr_inlined_block_inlined_info->GetCallSite().GetColumn(); return true; } else { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); + Log *log = GetLog(LLDBLog::Symbols); if (log) { LLDB_LOGF( diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index d6c82ed..f725425 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -535,10 +535,8 @@ bool Type::ResolveCompilerType(ResolveState compiler_type_resolve_state) { auto type_system_or_err = m_symbol_file->GetTypeSystemForLanguage(eLanguageTypeC); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), - std::move(err), - "Unable to construct void type from TypeSystemClang"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err), + "Unable to construct void type from TypeSystemClang"); } else { CompilerType void_compiler_type = type_system_or_err->GetBasicTypeFromAST(eBasicTypeVoid); diff --git a/lldb/source/Symbol/UnwindPlan.cpp b/lldb/source/Symbol/UnwindPlan.cpp index 5547998..4c91b28 100644 --- a/lldb/source/Symbol/UnwindPlan.cpp +++ b/lldb/source/Symbol/UnwindPlan.cpp @@ -406,7 +406,7 @@ const UnwindPlan::RowSP UnwindPlan::GetRowAtIndex(uint32_t idx) const { if (idx < m_row_list.size()) return m_row_list[idx]; else { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); LLDB_LOGF(log, "error: UnwindPlan::GetRowAtIndex(idx = %u) invalid index " "(number rows is %u)", @@ -417,7 +417,7 @@ const UnwindPlan::RowSP UnwindPlan::GetRowAtIndex(uint32_t idx) const { const UnwindPlan::RowSP UnwindPlan::GetLastRow() const { if (m_row_list.empty()) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); LLDB_LOGF(log, "UnwindPlan::GetLastRow() when rows are empty"); return UnwindPlan::RowSP(); } @@ -434,7 +434,7 @@ void UnwindPlan::SetPlanValidAddressRange(const AddressRange &range) { bool UnwindPlan::PlanValidAtAddress(Address addr) { // If this UnwindPlan has no rows, it is an invalid UnwindPlan. if (GetRowCount() == 0) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); if (log) { StreamString s; if (addr.Dump(&s, nullptr, Address::DumpStyleSectionNameOffset)) { @@ -457,7 +457,7 @@ bool UnwindPlan::PlanValidAtAddress(Address addr) { if (GetRowAtIndex(0).get() == nullptr || GetRowAtIndex(0)->GetCFAValue().GetValueType() == Row::FAValue::unspecified) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); if (log) { StreamString s; if (addr.Dump(&s, nullptr, Address::DumpStyleSectionNameOffset)) { diff --git a/lldb/source/Target/ABI.cpp b/lldb/source/Target/ABI.cpp index 6e8772c..5901910 100644 --- a/lldb/source/Target/ABI.cpp +++ b/lldb/source/Target/ABI.cpp @@ -203,7 +203,7 @@ std::unique_ptr ABI::MakeMCRegisterInfo(const ArchSpec &ar const llvm::Target *target = llvm::TargetRegistry::lookupTarget(triple, lookup_error); if (!target) { - LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS), + LLDB_LOG(GetLog(LLDBLog::Process), "Failed to create an llvm target for {0}: {1}", triple, lookup_error); return nullptr; diff --git a/lldb/source/Target/AssertFrameRecognizer.cpp b/lldb/source/Target/AssertFrameRecognizer.cpp index a2315b6..b6ed42c 100644 --- a/lldb/source/Target/AssertFrameRecognizer.cpp +++ b/lldb/source/Target/AssertFrameRecognizer.cpp @@ -53,7 +53,7 @@ bool GetAbortLocation(llvm::Triple::OSType os, SymbolLocation &location) { location.symbols_are_regex = true; break; default: - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); LLDB_LOG(log, "AssertFrameRecognizer::GetAbortLocation Unsupported OS"); return false; } @@ -83,7 +83,7 @@ bool GetAssertLocation(llvm::Triple::OSType os, SymbolLocation &location) { location.symbols.push_back(ConstString("__GI___assert_fail")); break; default: - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); LLDB_LOG(log, "AssertFrameRecognizer::GetAssertLocation Unsupported OS"); return false; } @@ -151,7 +151,7 @@ AssertFrameRecognizer::RecognizeFrame(lldb::StackFrameSP frame_sp) { prev_frame_sp = thread_sp->GetStackFrameAtIndex(frame_index); if (!prev_frame_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); LLDB_LOG(log, "Abort Recognizer: Hit unwinding bound ({1} frames)!", frames_to_fetch); break; diff --git a/lldb/source/Target/DynamicRegisterInfo.cpp b/lldb/source/Target/DynamicRegisterInfo.cpp index 9f894f8..bad67b5 100644 --- a/lldb/source/Target/DynamicRegisterInfo.cpp +++ b/lldb/source/Target/DynamicRegisterInfo.cpp @@ -192,7 +192,7 @@ llvm::Expected DynamicRegisterInfo::ByteOffsetFromRegInfoDict( size_t DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict, const ArchSpec &arch) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT); + Log *log = GetLog(LLDBLog::Object); assert(!m_finalized); StructuredData::Array *sets = nullptr; if (dict.GetValueForKeyAsArray("sets", sets)) { diff --git a/lldb/source/Target/Memory.cpp b/lldb/source/Target/Memory.cpp index 806e92a..cea8b4d 100644 --- a/lldb/source/Target/Memory.cpp +++ b/lldb/source/Target/Memory.cpp @@ -265,8 +265,8 @@ lldb::addr_t AllocatedBlock::ReserveBlock(uint32_t size) { // We must return something valid for zero bytes. if (size == 0) size = 1; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); - + Log *log = GetLog(LLDBLog::Process); + const size_t free_count = m_free_blocks.GetSize(); for (size_t i=0; i {2}", this, addr, success); return success; } @@ -351,7 +351,7 @@ AllocatedMemoryCache::AllocatePage(uint32_t byte_size, uint32_t permissions, addr_t addr = m_process.DoAllocateMemory(page_byte_size, permissions, error); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); if (log) { LLDB_LOGF(log, "Process::DoAllocateMemory (byte_size = 0x%8.8" PRIx32 @@ -390,7 +390,7 @@ lldb::addr_t AllocatedMemoryCache::AllocateMemory(size_t byte_size, if (block_sp) addr = block_sp->ReserveBlock(byte_size); } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "AllocatedMemoryCache::AllocateMemory (byte_size = 0x%8.8" PRIx32 ", permissions = %s) => 0x%16.16" PRIx64, @@ -410,7 +410,7 @@ bool AllocatedMemoryCache::DeallocateMemory(lldb::addr_t addr) { break; } } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "AllocatedMemoryCache::DeallocateMemory (addr = 0x%16.16" PRIx64 ") => %i", diff --git a/lldb/source/Target/ModuleCache.cpp b/lldb/source/Target/ModuleCache.cpp index 7143fcd..1d74c31 100644 --- a/lldb/source/Target/ModuleCache.cpp +++ b/lldb/source/Target/ModuleCache.cpp @@ -80,7 +80,7 @@ FileSpec GetSymbolFileSpec(const FileSpec &module_file_spec) { void DeleteExistingModule(const FileSpec &root_dir_spec, const FileSpec &sysroot_module_path_spec) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES)); + Log *log = GetLog(LLDBLog::Modules); UUID module_uuid; { auto module_sp = diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index 3c331c8..147bcb5 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -391,7 +391,7 @@ Platform::Platform(bool is_host) m_ignores_remote_hostname(false), m_trap_handlers(), m_calculated_trap_handlers(false), m_module_cache(std::make_unique()) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOGF(log, "%p Platform::Platform()", static_cast(this)); } @@ -623,7 +623,7 @@ RecurseCopy_Callback(void *baton, llvm::sys::fs::file_type ft, Status Platform::Install(const FileSpec &src, const FileSpec &dst) { Status error; - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "Platform::Install (src='%s', dst='%s')", src.GetPath().c_str(), dst.GetPath().c_str()); FileSpec fixed_dst(dst); @@ -733,7 +733,7 @@ Status Platform::Install(const FileSpec &src, const FileSpec &dst) { bool Platform::SetWorkingDirectory(const FileSpec &file_spec) { if (IsHost()) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOG(log, "{0}", file_spec); if (std::error_code ec = llvm::sys::fs::set_current_path(file_spec.GetPath())) { LLDB_LOG(log, "error: {0}", ec.message()); @@ -802,7 +802,7 @@ ConstString Platform::GetFullNameForDylib(ConstString basename) { } bool Platform::SetRemoteWorkingDirectory(const FileSpec &working_dir) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "Platform::SetRemoteWorkingDirectory('%s')", working_dir.GetCString()); m_working_dir = working_dir; @@ -1056,7 +1056,7 @@ uint32_t Platform::FindProcesses(const ProcessInstanceInfoMatch &match_info, Status Platform::LaunchProcess(ProcessLaunchInfo &launch_info) { Status error; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "Platform::%s()", __FUNCTION__); // Take care of the host case so that each subclass can just call this @@ -1109,7 +1109,7 @@ Status Platform::ShellExpandArguments(ProcessLaunchInfo &launch_info) { } Status Platform::KillProcess(const lldb::pid_t pid) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "Platform::%s, pid %" PRIu64, __FUNCTION__, pid); if (!IsHost()) { @@ -1123,7 +1123,7 @@ Status Platform::KillProcess(const lldb::pid_t pid) { lldb::ProcessSP Platform::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target &target, Status &error) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOG(log, "target = {0})", &target); ProcessSP process_sp; @@ -1250,7 +1250,7 @@ bool Platform::IsCompatibleArchitecture(const ArchSpec &arch, Status Platform::PutFile(const FileSpec &source, const FileSpec &destination, uint32_t uid, uint32_t gid) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log = GetLog(LLDBLog::Platform); LLDB_LOGF(log, "[PutFile] Using block by block transfer....\n"); auto source_open_options = @@ -1646,7 +1646,7 @@ bool Platform::GetCachedSharedModule(const ModuleSpec &module_spec, !GetGlobalPlatformProperties().GetModuleCacheDirectory()) return false; - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = GetLog(LLDBLog::Platform); // Check local cache for a module. auto error = m_module_cache->GetAndPut( diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 94f3788..527c9e5 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -439,7 +439,7 @@ Process::Process(lldb::TargetSP target_sp, ListenerSP listener_sp, m_run_thread_plan_lock(), m_can_jit(eCanJITDontKnow) { CheckInWithManager(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOGF(log, "%p Process::Process()", static_cast(this)); if (!m_unix_signals_sp) @@ -489,7 +489,7 @@ Process::Process(lldb::TargetSP target_sp, ListenerSP listener_sp, } Process::~Process() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOGF(log, "%p Process::~Process()", static_cast(this)); StopPrivateStateThread(); @@ -630,7 +630,7 @@ void Process::SyncIOHandler(uint32_t iohandler_id, auto Result = m_iohandler_sync.WaitForValueNotEqualTo(iohandler_id, timeout); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); if (Result) { LLDB_LOG( log, @@ -657,7 +657,7 @@ StateType Process::WaitForProcessToStop(const Timeout &timeout, if (state == eStateDetached || state == eStateExited) return state; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOG(log, "timeout = {0}", timeout); if (!wait_always && StateIsStoppedState(state, true) && @@ -954,7 +954,7 @@ void Process::RestoreProcessEvents() { RestoreBroadcaster(); } StateType Process::GetStateChangedEvents(EventSP &event_sp, const Timeout &timeout, ListenerSP hijack_listener_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOG(log, "timeout = {0}, event_sp)...", timeout); ListenerSP listener_sp = hijack_listener_sp; @@ -976,7 +976,7 @@ StateType Process::GetStateChangedEvents(EventSP &event_sp, } Event *Process::PeekAtStateChangedEvents() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "Process::%s...", __FUNCTION__); @@ -997,7 +997,7 @@ Event *Process::PeekAtStateChangedEvents() { StateType Process::GetStateChangedEventsPrivate(EventSP &event_sp, const Timeout &timeout) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOG(log, "timeout = {0}, event_sp)...", timeout); StateType state = eStateInvalid; @@ -1016,7 +1016,7 @@ Process::GetStateChangedEventsPrivate(EventSP &event_sp, bool Process::GetEventsPrivate(EventSP &event_sp, const Timeout &timeout, bool control_only) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOG(log, "timeout = {0}, event_sp)...", timeout); if (control_only) @@ -1050,8 +1050,7 @@ bool Process::SetExitStatus(int status, const char *cstr) { // Use a mutex to protect setting the exit status. std::lock_guard guard(m_exit_status_mutex); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::State | LLDBLog::Process)); LLDB_LOGF( log, "Process::SetExitStatus (status=%i (0x%8.8x), description=%s%s%s)", status, status, cstr ? "\"" : "", cstr ? cstr : "NULL", cstr ? "\"" : ""); @@ -1106,7 +1105,7 @@ bool Process::SetProcessExitStatus( int signo, // Zero for no signal int exit_status // Exit value of process if signal is zero ) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "Process::SetProcessExitStatus (pid=%" PRIu64 ", exited=%i, signal=%i, exit_status=%i)\n", @@ -1307,8 +1306,7 @@ void Process::SetPublicState(StateType new_state, bool restarted) { GetTarget().GetStatistics().SetFirstPublicStopTime(); } - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::State | LLDBLog::Process)); LLDB_LOGF(log, "Process::SetPublicState (state = %s, restarted = %i)", StateAsCString(new_state), restarted); const StateType old_state = m_public_state.GetValue(); @@ -1337,8 +1335,7 @@ void Process::SetPublicState(StateType new_state, bool restarted) { } Status Process::Resume() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::State | LLDBLog::Process)); LLDB_LOGF(log, "Process::Resume -- locking run lock"); if (!m_public_run_lock.TrySetRunning()) { Status error("Resume request failed - process still running."); @@ -1356,8 +1353,7 @@ Status Process::Resume() { static const char *g_resume_sync_name = "lldb.Process.ResumeSynchronous.hijack"; Status Process::ResumeSynchronous(Stream *stream) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::State | LLDBLog::Process)); LLDB_LOGF(log, "Process::ResumeSynchronous -- locking run lock"); if (!m_public_run_lock.TrySetRunning()) { Status error("Resume request failed - process still running."); @@ -1416,8 +1412,7 @@ void Process::SetPrivateState(StateType new_state) { if (m_finalizing) return; - Log *log(lldb_private::GetLogIfAnyCategoriesSet( - LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_UNWIND)); + Log *log(GetLog(LLDBLog::State | LLDBLog::Process | LLDBLog::Unwind)); bool state_changed = false; LLDB_LOGF(log, "Process::SetPrivateState (%s)", StateAsCString(new_state)); @@ -1755,7 +1750,7 @@ size_t Process::GetSoftwareBreakpointTrapOpcode(BreakpointSite *bp_site) { Status Process::EnableSoftwareBreakpoint(BreakpointSite *bp_site) { Status error; assert(bp_site != nullptr); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); const addr_t bp_addr = bp_site->GetLoadAddress(); LLDB_LOGF( log, "Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64, @@ -1831,7 +1826,7 @@ Status Process::EnableSoftwareBreakpoint(BreakpointSite *bp_site) { Status Process::DisableSoftwareBreakpoint(BreakpointSite *bp_site) { Status error; assert(bp_site != nullptr); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); addr_t bp_addr = bp_site->GetLoadAddress(); lldb::user_id_t breakID = bp_site->GetID(); LLDB_LOGF(log, @@ -2265,7 +2260,7 @@ addr_t Process::AllocateMemory(size_t size, uint32_t permissions, return m_allocated_memory_cache.AllocateMemory(size, permissions, error); #else addr_t allocated_addr = DoAllocateMemory(size, permissions, error); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "Process::AllocateMemory(size=%" PRIu64 ", permissions=%s) => 0x%16.16" PRIx64 @@ -2289,7 +2284,7 @@ addr_t Process::CallocateMemory(size_t size, uint32_t permissions, bool Process::CanJIT() { if (m_can_jit == eCanJITDontKnow) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); Status err; uint64_t allocated_memory = AllocateMemory( @@ -2335,7 +2330,7 @@ Status Process::DeallocateMemory(addr_t ptr) { #else error = DoDeallocateMemory(ptr); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "Process::DeallocateMemory(addr=0x%16.16" PRIx64 ") => err = %s (m_stop_id = %u, m_memory_id = %u)", @@ -2348,7 +2343,7 @@ Status Process::DeallocateMemory(addr_t ptr) { ModuleSP Process::ReadModuleFromMemory(const FileSpec &file_spec, lldb::addr_t header_addr, size_t size_to_read) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = GetLog(LLDBLog::Host); if (log) { LLDB_LOGF(log, "Process::ReadModuleFromMemory reading %s binary from memory", @@ -2601,7 +2596,7 @@ Status Process::LoadCore() { WaitForProcessToStop(llvm::None, &event_sp, true, listener_sp); if (!StateIsStoppedState(state, false)) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "Process::Halt() failed to stop, state is: %s", StateAsCString(state)); error.SetErrorString( @@ -2641,7 +2636,7 @@ SystemRuntime *Process::GetSystemRuntime() { Process::AttachCompletionHandler::AttachCompletionHandler(Process *process, uint32_t exec_count) : NextEventAction(process), m_exec_count(exec_count) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF( log, "Process::AttachCompletionHandler::%s process=%p, exec_count=%" PRIu32, @@ -2650,7 +2645,7 @@ Process::AttachCompletionHandler::AttachCompletionHandler(Process *process, Process::NextEventAction::EventActionResult Process::AttachCompletionHandler::PerformAction(lldb::EventSP &event_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); StateType state = ProcessEventData::GetStateFromEvent(event_sp.get()); LLDB_LOGF(log, @@ -2843,8 +2838,7 @@ Status Process::Attach(ProcessAttachInfo &attach_info) { } void Process::CompleteAttach() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | - LIBLLDB_LOG_TARGET)); + Log *log(GetLog(LLDBLog::Process | LLDBLog::Target)); LLDB_LOGF(log, "Process::%s()", __FUNCTION__); // Let the process subclass figure out at much as it can about the process @@ -2999,8 +2993,7 @@ Status Process::ConnectRemote(llvm::StringRef remote_url) { } Status Process::PrivateResume() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | - LIBLLDB_LOG_STEP)); + Log *log(GetLog(LLDBLog::Process | LLDBLog::Step)); LLDB_LOGF(log, "Process::PrivateResume() m_stop_id = %u, public state: %s " "private state: %s", @@ -3104,7 +3097,7 @@ Status Process::StopForDestroyOrDetach(lldb::EventSP &exit_event_sp) { // still need to interrupt. if (m_public_state.GetValue() == eStateRunning || m_private_state.GetValue() == eStateRunning) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "Process::%s() About to stop.", __FUNCTION__); ListenerSP listener_sp( @@ -3311,8 +3304,7 @@ bool Process::ShouldBroadcastEvent(Event *event_ptr) { const StateType state = Process::ProcessEventData::GetStateFromEvent(event_ptr); bool return_value = true; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EVENTS | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::Events | LLDBLog::Process)); switch (state) { case eStateDetached: @@ -3463,7 +3455,7 @@ bool Process::ShouldBroadcastEvent(Event *event_ptr) { } bool Process::StartPrivateStateThread(bool is_secondary_thread) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); + Log *log = GetLog(LLDBLog::Events); bool already_running = PrivateStateThreadIsValid(); LLDB_LOGF(log, "Process::%s()%s ", __FUNCTION__, @@ -3501,8 +3493,7 @@ bool Process::StartPrivateStateThread(bool is_secondary_thread) { ThreadLauncher::LaunchThread(thread_name, Process::PrivateStateThread, (void *)args_ptr, 8 * 1024 * 1024); if (!private_state_thread) { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), - "failed to launch host thread: {}", + LLDB_LOG(GetLog(LLDBLog::Host), "failed to launch host thread: {}", llvm::toString(private_state_thread.takeError())); return false; } @@ -3525,7 +3516,7 @@ void Process::StopPrivateStateThread() { if (m_private_state_thread.IsJoinable()) ControlPrivateStateThread(eBroadcastInternalStateControlStop); else { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF( log, "Went to stop the private state thread, but it was already invalid."); @@ -3533,7 +3524,7 @@ void Process::StopPrivateStateThread() { } void Process::ControlPrivateStateThread(uint32_t signal) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); assert(signal == eBroadcastInternalStateControlStop || signal == eBroadcastInternalStateControlPause || @@ -3591,7 +3582,7 @@ void Process::SendAsyncInterrupt() { } void Process::HandlePrivateEvent(EventSP &event_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); m_resume_requested = false; const StateType new_state = @@ -3726,7 +3717,7 @@ thread_result_t Process::PrivateStateThread(void *arg) { thread_result_t Process::RunPrivateStateThread(bool is_secondary_thread) { bool control_only = true; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "Process::%s (arg = %p, pid = %" PRIu64 ") thread starting...", __FUNCTION__, static_cast(this), GetID()); @@ -3926,8 +3917,7 @@ bool Process::ProcessEventData::ShouldStop(Event *event_ptr, for (idx = 0; idx < not_suspended_thread_list.GetSize(); ++idx) { curr_thread_list = process_sp->GetThreadList(); if (curr_thread_list.GetSize() != num_threads) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::Step | LLDBLog::Process)); LLDB_LOGF( log, "Number of threads changed from %u to %u while processing event.", @@ -3938,8 +3928,7 @@ bool Process::ProcessEventData::ShouldStop(Event *event_ptr, lldb::ThreadSP thread_sp = not_suspended_thread_list.GetThreadAtIndex(idx); if (thread_sp->GetIndexID() != thread_index_array[idx]) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::Step | LLDBLog::Process)); LLDB_LOGF(log, "The thread at position %u changed from %u to %u while " "processing event.", @@ -4232,7 +4221,7 @@ size_t Process::GetAsyncProfileData(char *buf, size_t buf_size, Status &error) { std::string &one_profile_data = m_profile_data.front(); size_t bytes_available = one_profile_data.size(); if (bytes_available > 0) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "Process::GetProfileData (buf = %p, size = %" PRIu64 ")", static_cast(buf), static_cast(buf_size)); if (bytes_available > buf_size) { @@ -4253,7 +4242,7 @@ size_t Process::GetSTDOUT(char *buf, size_t buf_size, Status &error) { std::lock_guard guard(m_stdio_communication_mutex); size_t bytes_available = m_stdout_data.size(); if (bytes_available > 0) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "Process::GetSTDOUT (buf = %p, size = %" PRIu64 ")", static_cast(buf), static_cast(buf_size)); if (bytes_available > buf_size) { @@ -4272,7 +4261,7 @@ size_t Process::GetSTDERR(char *buf, size_t buf_size, Status &error) { std::lock_guard gaurd(m_stdio_communication_mutex); size_t bytes_available = m_stderr_data.size(); if (bytes_available > 0) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "Process::GetSTDERR (buf = %p, size = %" PRIu64 ")", static_cast(buf), static_cast(buf_size)); if (bytes_available > buf_size) { @@ -4453,7 +4442,7 @@ bool Process::ProcessIOHandlerIsActive() { bool Process::PushProcessIOHandler() { IOHandlerSP io_handler_sp(m_process_input_reader); if (io_handler_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "Process::%s pushing IO handler", __FUNCTION__); io_handler_sp->SetIsDone(false); @@ -4562,7 +4551,7 @@ HandleStoppedEvent(lldb::tid_t thread_id, const ThreadPlanSP &thread_plan_sp, EventSP &event_to_broadcast_sp, const EvaluateExpressionOptions &options, bool handle_interrupts) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS); + Log *log = GetLog(LLDBLog::Step | LLDBLog::Process); ThreadSP thread_sp = thread_plan_sp->GetTarget() .GetProcessSP() @@ -4730,8 +4719,7 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx, lldb::StateType old_state = eStateInvalid; lldb::ThreadPlanSP stopper_base_plan_sp; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::Step | LLDBLog::Process)); if (m_private_state_thread.EqualsThread(Host::GetCurrentThread())) { // Yikes, we are running on the private state thread! So we can't wait for // public events on this thread, since we are the thread that is generating @@ -5498,7 +5486,7 @@ size_t Process::GetThreadStatus(Stream &strm, stop_format); ++num_thread_infos_dumped; } else { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "Process::GetThreadStatus - thread 0x" PRIu64 " vanished while running Thread::GetStatus."); } @@ -5586,7 +5574,7 @@ lldb::addr_t Process::GetDataAddressMask() { } void Process::DidExec() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "Process::%s()", __FUNCTION__); Target &target = GetTarget(); @@ -5890,7 +5878,7 @@ Process::ConfigureStructuredData(ConstString type_name, void Process::MapSupportedStructuredDataPlugins( const StructuredData::Array &supported_type_names) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // Bail out early if there are no type names to map. if (supported_type_names.GetSize() == 0) { diff --git a/lldb/source/Target/RegisterContextUnwind.cpp b/lldb/source/Target/RegisterContextUnwind.cpp index 315ccea..0729562 100644 --- a/lldb/source/Target/RegisterContextUnwind.cpp +++ b/lldb/source/Target/RegisterContextUnwind.cpp @@ -112,7 +112,7 @@ bool RegisterContextUnwind::IsUnwindPlanValidForCurrentPC( // zeroth frame or currently executing frame. void RegisterContextUnwind::InitializeZerothFrame() { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); ExecutionContext exe_ctx(m_thread.shared_from_this()); RegisterContextSP reg_ctx_sp = m_thread.GetRegisterContext(); @@ -303,7 +303,7 @@ void RegisterContextUnwind::InitializeZerothFrame() { // RegisterContextUnwind "below" it to provide things like its current pc value. void RegisterContextUnwind::InitializeNonZerothFrame() { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); if (IsFrameZero()) { m_frame_type = eNotAValidFrame; UnwindLogMsg("non-zeroth frame tests positive for IsFrameZero -- that " @@ -1247,7 +1247,7 @@ enum UnwindLLDB::RegisterSearchResult RegisterContextUnwind::SavedLocationForRegister( uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation ®loc) { RegisterNumber regnum(m_thread, eRegisterKindLLDB, lldb_regnum); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); // Have we already found this register location? if (!m_registers.empty()) { @@ -2324,7 +2324,7 @@ bool RegisterContextUnwind::ReadPC(addr_t &pc) { } void RegisterContextUnwind::UnwindLogMsg(const char *fmt, ...) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); if (log) { va_list args; va_start(args, fmt); @@ -2346,7 +2346,7 @@ void RegisterContextUnwind::UnwindLogMsg(const char *fmt, ...) { } void RegisterContextUnwind::UnwindLogMsgVerbose(const char *fmt, ...) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); if (log && log->GetVerbose()) { va_list args; va_start(args, fmt); diff --git a/lldb/source/Target/SectionLoadList.cpp b/lldb/source/Target/SectionLoadList.cpp index f1a626b..3b032ce 100644 --- a/lldb/source/Target/SectionLoadList.cpp +++ b/lldb/source/Target/SectionLoadList.cpp @@ -63,7 +63,7 @@ SectionLoadList::GetSectionLoadAddress(const lldb::SectionSP §ion) const { bool SectionLoadList::SetSectionLoadAddress(const lldb::SectionSP §ion, addr_t load_addr, bool warn_multiple) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); ModuleSP module_sp(section->GetModule()); if (module_sp) { @@ -136,7 +136,7 @@ size_t SectionLoadList::SetSectionUnloaded(const lldb::SectionSP §ion_sp) { size_t unload_count = 0; if (section_sp) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); if (log && log->GetVerbose()) { ModuleSP module_sp = section_sp->GetModule(); @@ -171,7 +171,7 @@ size_t SectionLoadList::SetSectionUnloaded(const lldb::SectionSP §ion_sp) { bool SectionLoadList::SetSectionUnloaded(const lldb::SectionSP §ion_sp, addr_t load_addr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log = GetLog(LLDBLog::DynamicLoader); if (log && log->GetVerbose()) { ModuleSP module_sp = section_sp->GetModule(); diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp index 58de26b..9b74d83 100644 --- a/lldb/source/Target/StackFrame.cpp +++ b/lldb/source/Target/StackFrame.cpp @@ -1336,9 +1336,8 @@ lldb::ValueObjectSP StackFrame::GuessValueForAddress(lldb::addr_t addr) { auto c_type_system_or_err = target_sp->GetScratchTypeSystemForLanguage(eLanguageTypeC); if (auto err = c_type_system_or_err.takeError()) { - LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD), - std::move(err), "Unable to guess value for given address"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Thread), std::move(err), + "Unable to guess value for given address"); return ValueObjectSP(); } else { CompilerType void_ptr_type = diff --git a/lldb/source/Target/StackFrameList.cpp b/lldb/source/Target/StackFrameList.cpp index 0615001..9d5b83c 100644 --- a/lldb/source/Target/StackFrameList.cpp +++ b/lldb/source/Target/StackFrameList.cpp @@ -65,7 +65,7 @@ uint32_t StackFrameList::GetCurrentInlinedDepth() { if (cur_pc != m_current_inlined_pc) { m_current_inlined_pc = LLDB_INVALID_ADDRESS; m_current_inlined_depth = UINT32_MAX; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log && log->GetVerbose()) LLDB_LOGF( log, @@ -89,7 +89,7 @@ void StackFrameList::ResetCurrentInlinedDepth() { if (!m_frames[0]->IsInlined()) { m_current_inlined_depth = UINT32_MAX; m_current_inlined_pc = LLDB_INVALID_ADDRESS; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log && log->GetVerbose()) LLDB_LOGF( log, @@ -187,7 +187,7 @@ void StackFrameList::ResetCurrentInlinedDepth() { } m_current_inlined_pc = curr_pc; m_current_inlined_depth = num_inlined_functions + 1; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log && log->GetVerbose()) LLDB_LOGF(log, "ResetCurrentInlinedDepth: setting inlined " @@ -376,7 +376,7 @@ void StackFrameList::SynthesizeTailCallFrames(StackFrame &next_frame) { if (!next_reg_ctx_sp) return; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); StackFrame &prev_frame = *m_frames.back().get(); diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp index 1de281b..d60b849 100644 --- a/lldb/source/Target/StopInfo.cpp +++ b/lldb/source/Target/StopInfo.cpp @@ -145,7 +145,7 @@ public: bp_site_sp->BumpHitCounts(); m_should_stop = bp_site_sp->ShouldStop(&context); } else { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "Process::%s could not find breakpoint site id: %" PRId64 @@ -264,8 +264,7 @@ protected: ThreadSP thread_sp(m_thread_wp.lock()); if (thread_sp) { - Log *log = lldb_private::GetLogIfAnyCategoriesSet( - LIBLLDB_LOG_BREAKPOINTS | LIBLLDB_LOG_STEP); + Log *log = GetLog(LLDBLog::Breakpoints | LLDBLog::Step); if (!thread_sp->IsValid()) { // This shouldn't ever happen, but just in case, don't do more harm. @@ -564,8 +563,7 @@ protected: } else { m_should_stop = true; m_should_stop_is_valid = true; - Log *log_process( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log_process(GetLog(LLDBLog::Process)); LLDB_LOGF(log_process, "Process::%s could not find breakpoint site id: %" PRId64 @@ -696,7 +694,7 @@ protected: StoppointCallbackContext context(event_ptr, exe_ctx, true); m_should_stop = wp_sp->ShouldStop(&context); } else { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "Process::%s could not find watchpoint location id: %" PRId64 @@ -719,7 +717,7 @@ protected: } void PerformAction(Event *event_ptr) override { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS); + Log *log = GetLog(LLDBLog::Watchpoints); // We're going to calculate if we should stop or not in some way during the // course of this code. Also by default we're going to stop, so set that // here. @@ -917,8 +915,7 @@ protected: } } else { - Log *log_process( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log_process(GetLog(LLDBLog::Process)); LLDB_LOGF(log_process, "Process::%s could not find watchpoint id: %" PRId64 "...", diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 6d33db6..491a5c7 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -108,10 +108,10 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, CheckInWithManager(); - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT), - "{0} Target::Target()", static_cast(this)); + LLDB_LOG(GetLog(LLDBLog::Object), "{0} Target::Target()", + static_cast(this)); if (target_arch.IsValid()) { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET), + LLDB_LOG(GetLog(LLDBLog::Target), "Target::Target created with architecture {0} ({1})", target_arch.GetArchitectureName(), target_arch.GetTriple().getTriple().c_str()); @@ -121,7 +121,7 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, } Target::~Target() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOG(log, "{0} Target::~Target()", static_cast(this)); DeleteCurrentProcess(); } @@ -647,7 +647,7 @@ void Target::AddBreakpoint(lldb::BreakpointSP bp_sp, bool internal) { else m_breakpoint_list.Add(bp_sp, true); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); if (log) { StreamString s; bp_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose); @@ -743,8 +743,7 @@ void Target::ApplyNameToBreakpoints(BreakpointName &bp_name) { m_breakpoint_list.FindBreakpointsByName(bp_name.GetName().AsCString()); if (!expected_vector) { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS), - "invalid breakpoint name: {}", + LLDB_LOG(GetLog(LLDBLog::Breakpoints), "invalid breakpoint name: {}", llvm::toString(expected_vector.takeError())); return; } @@ -789,7 +788,7 @@ static bool CheckIfWatchpointsSupported(Target *target, Status &error) { WatchpointSP Target::CreateWatchpoint(lldb::addr_t addr, size_t size, const CompilerType *type, uint32_t kind, Status &error) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOGF(log, "Target::%s (addr = 0x%8.8" PRIx64 " size = %" PRIu64 " type = %u)\n", @@ -873,7 +872,7 @@ WatchpointSP Target::CreateWatchpoint(lldb::addr_t addr, size_t size, } void Target::RemoveAllowedBreakpoints() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "Target::%s \n", __FUNCTION__); m_breakpoint_list.RemoveAllowed(true); @@ -882,7 +881,7 @@ void Target::RemoveAllowedBreakpoints() { } void Target::RemoveAllBreakpoints(bool internal_also) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no"); @@ -894,7 +893,7 @@ void Target::RemoveAllBreakpoints(bool internal_also) { } void Target::DisableAllBreakpoints(bool internal_also) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no"); @@ -904,14 +903,14 @@ void Target::DisableAllBreakpoints(bool internal_also) { } void Target::DisableAllowedBreakpoints() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "Target::%s", __FUNCTION__); m_breakpoint_list.SetEnabledAllowed(false); } void Target::EnableAllBreakpoints(bool internal_also) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no"); @@ -921,14 +920,14 @@ void Target::EnableAllBreakpoints(bool internal_also) { } void Target::EnableAllowedBreakpoints() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "Target::%s", __FUNCTION__); m_breakpoint_list.SetEnabledAllowed(true); } bool Target::RemoveBreakpointByID(break_id_t break_id) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, break_id, LLDB_BREAK_ID_IS_INTERNAL(break_id) ? "yes" : "no"); @@ -948,7 +947,7 @@ bool Target::RemoveBreakpointByID(break_id_t break_id) { } bool Target::DisableBreakpointByID(break_id_t break_id) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, break_id, LLDB_BREAK_ID_IS_INTERNAL(break_id) ? "yes" : "no"); @@ -966,7 +965,7 @@ bool Target::DisableBreakpointByID(break_id_t break_id) { } bool Target::EnableBreakpointByID(break_id_t break_id) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOGF(log, "Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, break_id, LLDB_BREAK_ID_IS_INTERNAL(break_id) ? "yes" : "no"); @@ -1144,7 +1143,7 @@ Status Target::CreateBreakpointsFromFile(const FileSpec &file, // Assumption: Caller holds the list mutex lock for m_watchpoint_list for end // to end operations. bool Target::RemoveAllWatchpoints(bool end_to_end) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOGF(log, "Target::%s\n", __FUNCTION__); if (!end_to_end) { @@ -1173,7 +1172,7 @@ bool Target::RemoveAllWatchpoints(bool end_to_end) { // Assumption: Caller holds the list mutex lock for m_watchpoint_list for end // to end operations. bool Target::DisableAllWatchpoints(bool end_to_end) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOGF(log, "Target::%s\n", __FUNCTION__); if (!end_to_end) { @@ -1200,7 +1199,7 @@ bool Target::DisableAllWatchpoints(bool end_to_end) { // Assumption: Caller holds the list mutex lock for m_watchpoint_list for end // to end operations. bool Target::EnableAllWatchpoints(bool end_to_end) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOGF(log, "Target::%s\n", __FUNCTION__); if (!end_to_end) { @@ -1226,7 +1225,7 @@ bool Target::EnableAllWatchpoints(bool end_to_end) { // Assumption: Caller holds the list mutex lock for m_watchpoint_list. bool Target::ClearAllWatchpointHitCounts() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOGF(log, "Target::%s\n", __FUNCTION__); for (WatchpointSP wp_sp : m_watchpoint_list.Watchpoints()) { @@ -1240,7 +1239,7 @@ bool Target::ClearAllWatchpointHitCounts() { // Assumption: Caller holds the list mutex lock for m_watchpoint_list. bool Target::ClearAllWatchpointHistoricValues() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOGF(log, "Target::%s\n", __FUNCTION__); for (WatchpointSP wp_sp : m_watchpoint_list.Watchpoints()) { @@ -1255,7 +1254,7 @@ bool Target::ClearAllWatchpointHistoricValues() { // Assumption: Caller holds the list mutex lock for m_watchpoint_list during // these operations. bool Target::IgnoreAllWatchpoints(uint32_t ignore_count) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOGF(log, "Target::%s\n", __FUNCTION__); if (!ProcessIsValid()) @@ -1272,7 +1271,7 @@ bool Target::IgnoreAllWatchpoints(uint32_t ignore_count) { // Assumption: Caller holds the list mutex lock for m_watchpoint_list. bool Target::DisableWatchpointByID(lldb::watch_id_t watch_id) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOGF(log, "Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id); if (!ProcessIsValid()) @@ -1291,7 +1290,7 @@ bool Target::DisableWatchpointByID(lldb::watch_id_t watch_id) { // Assumption: Caller holds the list mutex lock for m_watchpoint_list. bool Target::EnableWatchpointByID(lldb::watch_id_t watch_id) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOGF(log, "Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id); if (!ProcessIsValid()) @@ -1310,7 +1309,7 @@ bool Target::EnableWatchpointByID(lldb::watch_id_t watch_id) { // Assumption: Caller holds the list mutex lock for m_watchpoint_list. bool Target::RemoveWatchpointByID(lldb::watch_id_t watch_id) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOGF(log, "Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id); WatchpointSP watch_to_remove_sp = m_watchpoint_list.FindByID(watch_id); @@ -1327,7 +1326,7 @@ bool Target::RemoveWatchpointByID(lldb::watch_id_t watch_id) { // Assumption: Caller holds the list mutex lock for m_watchpoint_list. bool Target::IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log = GetLog(LLDBLog::Watchpoints); LLDB_LOGF(log, "Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id); if (!ProcessIsValid()) @@ -1392,7 +1391,7 @@ void Target::DidExec() { void Target::SetExecutableModule(ModuleSP &executable_sp, LoadDependentFiles load_dependent_files) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET)); + Log *log = GetLog(LLDBLog::Target); ClearModules(false); if (executable_sp) { @@ -1457,7 +1456,7 @@ void Target::SetExecutableModule(ModuleSP &executable_sp, } bool Target::SetArchitecture(const ArchSpec &arch_spec, bool set_platform) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET)); + Log *log = GetLog(LLDBLog::Target); bool missing_local_arch = !m_arch.GetSpec().IsValid(); bool replace_local_arch = true; bool compatible_local_arch = false; @@ -1545,7 +1544,7 @@ bool Target::SetArchitecture(const ArchSpec &arch_spec, bool set_platform) { } bool Target::MergeArchitecture(const ArchSpec &arch_spec) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET)); + Log *log = GetLog(LLDBLog::Target); if (arch_spec.IsValid()) { if (m_arch.GetSpec().IsCompatibleMatch(arch_spec)) { // The current target arch is compatible with "arch_spec", see if we can @@ -2187,8 +2186,7 @@ ModuleSP Target::GetOrCreateModule(const ModuleSpec &module_spec, bool notify, // In the meantime, just log that this has happened; just // above we called ReplaceModule on the first one, and Remove // on the rest. - if (Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET | - LIBLLDB_LOG_MODULES)) { + if (Log *log = GetLog(LLDBLog::Target | LLDBLog::Modules)) { StreamString message; auto dump = [&message](Module &dump_module) -> void { UUID dump_uuid = dump_module.GetUUID(); @@ -2305,8 +2303,7 @@ std::vector Target::GetScratchTypeSystems(bool create_on_demand) { auto type_system_or_err = GetScratchTypeSystemForLanguage(language, create_on_demand); if (!type_system_or_err) - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET), - type_system_or_err.takeError(), + LLDB_LOG_ERROR(GetLog(LLDBLog::Target), type_system_or_err.takeError(), "Language '{}' has expression support but no scratch type " "system available", Language::GetNameForLanguageType(language)); @@ -2322,8 +2319,7 @@ Target::GetPersistentExpressionStateForLanguage(lldb::LanguageType language) { auto type_system_or_err = GetScratchTypeSystemForLanguage(language, true); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET), - std::move(err), + LLDB_LOG_ERROR(GetLog(LLDBLog::Target), std::move(err), "Unable to get persistent expression state for language {}", Language::GetNameForLanguageType(language)); return nullptr; @@ -2421,7 +2417,7 @@ ArchSpec Target::GetDefaultArchitecture() { } void Target::SetDefaultArchitecture(const ArchSpec &arch) { - LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET), + LLDB_LOG(GetLog(LLDBLog::Target), "setting target's default architecture to {0} ({1})", arch.GetArchitectureName(), arch.GetTriple().getTriple()); Target::GetGlobalProperties().SetDefaultArchitecture(arch); @@ -2480,8 +2476,8 @@ ExpressionResults Target::EvaluateExpression( auto type_system_or_err = GetScratchTypeSystemForLanguage(eLanguageTypeC); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET), - std::move(err), "Unable to get scratch type system"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Target), std::move(err), + "Unable to get scratch type system"); } else { persistent_var_sp = type_system_or_err->GetPersistentExpressionState()->GetVariable(expr); @@ -2811,7 +2807,7 @@ bool Target::RunStopHooks() { // We only compute should_stop against the hook results if a hook got to run // which is why we have to do this conjoint test. if ((hooks_ran && !should_stop) || auto_continue) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); Status error = m_process_sp->PrivateResume(); if (error.Success()) { LLDB_LOG(log, "Resuming from RunStopHooks"); @@ -2967,7 +2963,7 @@ void Target::ClearAllLoadedSections() { m_section_load_history.Clear(); } Status Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { m_stats.SetLaunchOrAttachTime(); Status error; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET)); + Log *log = GetLog(LLDBLog::Target); LLDB_LOGF(log, "Target::%s() called for %s", __FUNCTION__, launch_info.GetExecutableFile().GetPath().c_str()); @@ -3252,7 +3248,7 @@ Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { } void Target::FinalizeFileActions(ProcessLaunchInfo &info) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); // Finalize the file actions, and if none were given, default to opening up a // pseudo terminal diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index bde6dad..c21b242 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -229,7 +229,7 @@ Thread::Thread(Process &process, lldb::tid_t tid, bool use_invalid_index_id) m_unwinder_up(), m_destroy_called(false), m_override_should_notify(eLazyBoolCalculate), m_extended_info_fetched(false), m_extended_info() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOGF(log, "%p Thread::Thread(tid = 0x%4.4" PRIx64 ")", static_cast(this), GetID()); @@ -237,7 +237,7 @@ Thread::Thread(Process &process, lldb::tid_t tid, bool use_invalid_index_id) } Thread::~Thread() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOGF(log, "%p Thread::~Thread(tid = 0x%4.4" PRIx64 ")", static_cast(this), GetID()); /// If you hit this assert, it means your derived class forgot to call @@ -446,7 +446,7 @@ void Thread::SetStopInfo(const lldb::StopInfoSP &stop_info_sp) { m_stop_info_stop_id = process_sp->GetStopID(); else m_stop_info_stop_id = UINT32_MAX; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); LLDB_LOGF(log, "%p: tid = 0x%" PRIx64 ": stop info = %s (stop_id = %u)", static_cast(this), GetID(), stop_info_sp ? stop_info_sp->GetDescription() : "", @@ -577,7 +577,7 @@ std::string Thread::GetStopDescriptionRaw() { } void Thread::SelectMostRelevantFrame() { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD); + Log *log = GetLog(LLDBLog::Thread); auto frames_list_sp = GetStackFrameList(); @@ -731,7 +731,7 @@ bool Thread::ShouldStop(Event *event_ptr) { bool should_stop = true; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (GetResumeState() == eStateSuspended) { LLDB_LOGF(log, @@ -956,7 +956,7 @@ Vote Thread::ShouldReportStop(Event *event_ptr) { StateType thread_state = GetResumeState(); StateType temp_thread_state = GetTemporaryResumeState(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (thread_state == eStateSuspended || thread_state == eStateInvalid) { LLDB_LOGF(log, @@ -1020,7 +1020,7 @@ Vote Thread::ShouldReportRun(Event *event_ptr) { return eVoteNoOpinion; } - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (GetPlans().AnyCompletedPlans()) { // Pass skip_private = false to GetCompletedPlan, since we want to ask // the last plan, regardless of whether it is private or not. @@ -1067,7 +1067,7 @@ ThreadPlanStack &Thread::GetPlans() const { void Thread::PushPlan(ThreadPlanSP thread_plan_sp) { assert(thread_plan_sp && "Don't push an empty thread plan."); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log) { StreamString s; thread_plan_sp->GetDescription(&s, lldb::eDescriptionLevelFull); @@ -1080,7 +1080,7 @@ void Thread::PushPlan(ThreadPlanSP thread_plan_sp) { } void Thread::PopPlan() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); ThreadPlanSP popped_plan_sp = GetPlans().PopPlan(); if (log) { LLDB_LOGF(log, "Popping plan: \"%s\", tid = 0x%4.4" PRIx64 ".", @@ -1089,7 +1089,7 @@ void Thread::PopPlan() { } void Thread::DiscardPlan() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); ThreadPlanSP discarded_plan_sp = GetPlans().PopPlan(); LLDB_LOGF(log, "Discarding plan: \"%s\", tid = 0x%4.4" PRIx64 ".", @@ -1192,7 +1192,7 @@ void Thread::DiscardThreadPlansUpToPlan(lldb::ThreadPlanSP &up_to_plan_sp) { } void Thread::DiscardThreadPlansUpToPlan(ThreadPlan *up_to_plan_ptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOGF(log, "Discarding thread plans for thread tid = 0x%4.4" PRIx64 ", up to %p", @@ -1201,7 +1201,7 @@ void Thread::DiscardThreadPlansUpToPlan(ThreadPlan *up_to_plan_ptr) { } void Thread::DiscardThreadPlans(bool force) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log) { LLDB_LOGF(log, "Discarding thread plans for thread (tid = 0x%4.4" PRIx64 diff --git a/lldb/source/Target/ThreadList.cpp b/lldb/source/Target/ThreadList.cpp index df2cc8e..28cd7f6 100644 --- a/lldb/source/Target/ThreadList.cpp +++ b/lldb/source/Target/ThreadList.cpp @@ -225,7 +225,7 @@ ThreadSP ThreadList::FindThreadByIndexID(uint32_t index_id, bool can_update) { bool ThreadList::ShouldStop(Event *event_ptr) { // Running events should never stop, obviously... - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); // The ShouldStop method of the threads can do a whole lot of work, figuring // out whether the thread plan conditions are met. So we don't want to keep @@ -360,7 +360,7 @@ Vote ThreadList::ShouldReportStop(Event *event_ptr) { m_process->UpdateThreadListIfNeeded(); collection::iterator pos, end = m_threads.end(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOGF(log, "ThreadList::%s %" PRIu64 " threads", __FUNCTION__, (uint64_t)m_threads.size()); @@ -416,7 +416,7 @@ Vote ThreadList::ShouldReportRun(Event *event_ptr) { // Run through the threads and ask whether we should report this event. The // rule is NO vote wins over everything, a YES vote wins over no opinion. - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); for (pos = m_threads.begin(); pos != end; ++pos) { if ((*pos)->GetResumeState() != eStateSuspended) { @@ -460,7 +460,7 @@ void ThreadList::RefreshStateAfterStop() { m_process->UpdateThreadListIfNeeded(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log && log->GetVerbose()) LLDB_LOGF(log, "Turning off notification of new threads while single stepping " @@ -514,13 +514,13 @@ bool ThreadList::WillResume() { } if (wants_solo_run) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log && log->GetVerbose()) LLDB_LOGF(log, "Turning on notification of new threads while single " "stepping a thread."); m_process->StartNoticingNewThreads(); } else { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log && log->GetVerbose()) LLDB_LOGF(log, "Turning off notification of new threads while single " "stepping a thread."); diff --git a/lldb/source/Target/ThreadPlan.cpp b/lldb/source/Target/ThreadPlan.cpp index 3b42831..1c0d4d6 100644 --- a/lldb/source/Target/ThreadPlan.cpp +++ b/lldb/source/Target/ThreadPlan.cpp @@ -76,7 +76,7 @@ bool ThreadPlan::MischiefManaged() { } Vote ThreadPlan::ShouldReportStop(Event *event_ptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (m_report_stop_vote == eVoteNoOpinion) { ThreadPlan *prev_plan = GetPreviousPlan(); @@ -116,7 +116,7 @@ bool ThreadPlan::WillResume(StateType resume_state, bool current_plan) { m_cached_plan_explains_stop = eLazyBoolCalculate; if (current_plan) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log) { RegisterContext *reg_ctx = GetThread().GetRegisterContext().get(); @@ -195,7 +195,7 @@ bool ThreadPlanNull::ValidatePlan(Stream *error) { ", ptid = 0x%" PRIx64 ")", LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); #else - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); if (log) log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 ", ptid = 0x%" PRIx64 ")", @@ -211,7 +211,7 @@ bool ThreadPlanNull::ShouldStop(Event *event_ptr) { ", ptid = 0x%" PRIx64 ")", LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); #else - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); if (log) log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 ", ptid = 0x%" PRIx64 ")", @@ -227,7 +227,7 @@ bool ThreadPlanNull::WillStop() { ", ptid = 0x%" PRIx64 ")", LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); #else - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); if (log) log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 ", ptid = 0x%" PRIx64 ")", @@ -243,7 +243,7 @@ bool ThreadPlanNull::DoPlanExplainsStop(Event *event_ptr) { ", ptid = 0x%" PRIx64 ")", LLVM_PRETTY_FUNCTION, GetThread().GetID(), GetThread().GetProtocolID()); #else - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); if (log) log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 ", ptid = 0x%" PRIx64 ")", @@ -261,7 +261,7 @@ bool ThreadPlanNull::MischiefManaged() { ", ptid = 0x%" PRIx64 ")", LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); #else - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); if (log) log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 ", ptid = 0x%" PRIx64 ")", @@ -278,7 +278,7 @@ lldb::StateType ThreadPlanNull::GetPlanRunState() { ", ptid = 0x%" PRIx64 ")", LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); #else - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); if (log) log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 ", ptid = 0x%" PRIx64 ")", diff --git a/lldb/source/Target/ThreadPlanBase.cpp b/lldb/source/Target/ThreadPlanBase.cpp index 46ae9c3..f018668 100644 --- a/lldb/source/Target/ThreadPlanBase.cpp +++ b/lldb/source/Target/ThreadPlanBase.cpp @@ -73,7 +73,7 @@ bool ThreadPlanBase::ShouldStop(Event *event_ptr) { m_report_stop_vote = eVoteYes; m_report_run_vote = eVoteYes; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); StopInfoSP stop_info_sp = GetPrivateStopInfo(); if (stop_info_sp) { diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index 0336a9d..4836104 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -46,7 +46,7 @@ bool ThreadPlanCallFunction::ConstructorSetup( if (!abi) return false; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); SetBreakpoints(); @@ -143,7 +143,7 @@ ThreadPlanCallFunction::~ThreadPlanCallFunction() { } void ThreadPlanCallFunction::ReportRegisterState(const char *message) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log && log->GetVerbose()) { StreamString strm; RegisterContext *reg_ctx = GetThread().GetRegisterContext().get(); @@ -166,7 +166,7 @@ void ThreadPlanCallFunction::ReportRegisterState(const char *message) { } void ThreadPlanCallFunction::DoTakedown(bool success) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (!m_valid) { // Don't call DoTakedown if we were never valid to begin with. @@ -242,8 +242,7 @@ Vote ThreadPlanCallFunction::ShouldReportStop(Event *event_ptr) { } bool ThreadPlanCallFunction::DoPlanExplainsStop(Event *event_ptr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP | - LIBLLDB_LOG_PROCESS)); + Log *log(GetLog(LLDBLog::Step | LLDBLog::Process)); m_real_stop_info_sp = GetPrivateStopInfo(); // If our subplan knows why we stopped, even if it's done (which would @@ -382,7 +381,7 @@ void ThreadPlanCallFunction::DidPush() { bool ThreadPlanCallFunction::WillStop() { return true; } bool ThreadPlanCallFunction::MischiefManaged() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (IsPlanComplete()) { LLDB_LOGF(log, "ThreadPlanCallFunction(%p): Completed call function plan.", @@ -433,7 +432,7 @@ bool ThreadPlanCallFunction::BreakpointsExplainStop() { (m_objc_language_runtime && m_objc_language_runtime->ExceptionBreakpointsExplainStop( stop_info_sp))) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOGF(log, "ThreadPlanCallFunction::BreakpointsExplainStop - Hit an " "exception breakpoint, setting plan complete."); diff --git a/lldb/source/Target/ThreadPlanCallUserExpression.cpp b/lldb/source/Target/ThreadPlanCallUserExpression.cpp index d833a4d..3c3b58e 100644 --- a/lldb/source/Target/ThreadPlanCallUserExpression.cpp +++ b/lldb/source/Target/ThreadPlanCallUserExpression.cpp @@ -66,7 +66,7 @@ void ThreadPlanCallUserExpression::DidPop() { } bool ThreadPlanCallUserExpression::MischiefManaged() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (IsPlanComplete()) { LLDB_LOGF(log, "ThreadPlanCallFunction(%p): Completed call function plan.", diff --git a/lldb/source/Target/ThreadPlanPython.cpp b/lldb/source/Target/ThreadPlanPython.cpp index a8a36ae..afb5ba4 100644 --- a/lldb/source/Target/ThreadPlanPython.cpp +++ b/lldb/source/Target/ThreadPlanPython.cpp @@ -70,7 +70,7 @@ void ThreadPlanPython::DidPush() { } bool ThreadPlanPython::ShouldStop(Event *event_ptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION, m_class_name.c_str()); @@ -89,7 +89,7 @@ bool ThreadPlanPython::ShouldStop(Event *event_ptr) { } bool ThreadPlanPython::IsPlanStale() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION, m_class_name.c_str()); @@ -108,7 +108,7 @@ bool ThreadPlanPython::IsPlanStale() { } bool ThreadPlanPython::DoPlanExplainsStop(Event *event_ptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION, m_class_name.c_str()); @@ -127,7 +127,7 @@ bool ThreadPlanPython::DoPlanExplainsStop(Event *event_ptr) { } bool ThreadPlanPython::MischiefManaged() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION, m_class_name.c_str()); bool mischief_managed = true; @@ -142,7 +142,7 @@ bool ThreadPlanPython::MischiefManaged() { } lldb::StateType ThreadPlanPython::GetPlanRunState() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION, m_class_name.c_str()); lldb::StateType run_state = eStateRunning; @@ -164,7 +164,7 @@ void ThreadPlanPython::GetDescription(Stream *s, lldb::DescriptionLevel level) { } bool ThreadPlanPython::WillStop() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log = GetLog(LLDBLog::Thread); LLDB_LOGF(log, "%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION, m_class_name.c_str()); return true; diff --git a/lldb/source/Target/ThreadPlanRunToAddress.cpp b/lldb/source/Target/ThreadPlanRunToAddress.cpp index cb4a58b..6139ad9 100644 --- a/lldb/source/Target/ThreadPlanRunToAddress.cpp +++ b/lldb/source/Target/ThreadPlanRunToAddress.cpp @@ -169,7 +169,7 @@ StateType ThreadPlanRunToAddress::GetPlanRunState() { return eStateRunning; } bool ThreadPlanRunToAddress::WillStop() { return true; } bool ThreadPlanRunToAddress::MischiefManaged() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (AtOurAddress()) { // Remove the breakpoint diff --git a/lldb/source/Target/ThreadPlanShouldStopHere.cpp b/lldb/source/Target/ThreadPlanShouldStopHere.cpp index 7774e02..5c0fcbf 100644 --- a/lldb/source/Target/ThreadPlanShouldStopHere.cpp +++ b/lldb/source/Target/ThreadPlanShouldStopHere.cpp @@ -41,7 +41,7 @@ bool ThreadPlanShouldStopHere::InvokeShouldStopHereCallback( if (m_callbacks.should_stop_here_callback) { should_stop_here = m_callbacks.should_stop_here_callback( m_owner, m_flags, operation, status, m_baton); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log) { lldb::addr_t current_addr = m_owner->GetThread().GetRegisterContext()->GetPC(0); @@ -62,7 +62,7 @@ bool ThreadPlanShouldStopHere::DefaultShouldStopHereCallback( if (!frame) return true; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if ((operation == eFrameCompareOlder && flags.Test(eStepOutAvoidNoDebug)) || (operation == eFrameCompareYounger && flags.Test(eStepInAvoidNoDebug)) || @@ -98,7 +98,7 @@ ThreadPlanSP ThreadPlanShouldStopHere::DefaultStepFromHereCallback( ThreadPlanSP return_plan_sp; // If we are stepping through code at line number 0, then we need to step // over this range. Otherwise we will step out. - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get(); if (!frame) diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp index 69b4b91..902e5db6 100644 --- a/lldb/source/Target/ThreadPlanStepInRange.cpp +++ b/lldb/source/Target/ThreadPlanStepInRange.cpp @@ -125,7 +125,7 @@ void ThreadPlanStepInRange::GetDescription(Stream *s, } bool ThreadPlanStepInRange::ShouldStop(Event *event_ptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log) { StreamString s; @@ -269,7 +269,7 @@ bool ThreadPlanStepInRange::ShouldStop(Event *event_ptr) { if (bytes_to_skip != 0) { func_start_address.Slide(bytes_to_skip); - log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP); + log = GetLog(LLDBLog::Step); LLDB_LOGF(log, "Pushing past prologue "); m_sub_plan_sp = thread.QueueThreadPlanForRunToAddress( @@ -344,7 +344,7 @@ bool ThreadPlanStepInRange::FrameMatchesAvoidCriteria() { avoid_regexp_to_use->Execute(frame_function_name, &matches); if (return_value && matches.size() > 1) { std::string match = matches[1].str(); - LLDB_LOGF(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP), + LLDB_LOGF(GetLog(LLDBLog::Step), "Stepping out of function \"%s\" because it matches " "the avoid regexp \"%s\" - match substring: \"%s\".", frame_function_name, @@ -363,7 +363,7 @@ bool ThreadPlanStepInRange::DefaultShouldStopHereCallback( Status &status, void *baton) { bool should_stop_here = true; StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); // First see if the ThreadPlanShouldStopHere default implementation thinks we // should get out of here: @@ -445,7 +445,7 @@ bool ThreadPlanStepInRange::DoPlanExplainsStop(Event *event_ptr) { return_value = true; } } else if (IsUsuallyUnexplainedStopReason(reason)) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log) log->PutCString("ThreadPlanStepInRange got asked if it explains the " "stop for some reason other than step."); @@ -468,7 +468,7 @@ bool ThreadPlanStepInRange::DoWillResume(lldb::StateType resume_state, // See if we are about to step over a virtual inlined call. bool step_without_resume = thread.DecrementCurrentInlinedDepth(); if (step_without_resume) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOGF(log, "ThreadPlanStepInRange::DoWillResume: returning false, " "inline_depth: %d", diff --git a/lldb/source/Target/ThreadPlanStepInstruction.cpp b/lldb/source/Target/ThreadPlanStepInstruction.cpp index e34e41e..25e7921 100644 --- a/lldb/source/Target/ThreadPlanStepInstruction.cpp +++ b/lldb/source/Target/ThreadPlanStepInstruction.cpp @@ -96,7 +96,7 @@ bool ThreadPlanStepInstruction::DoPlanExplainsStop(Event *event_ptr) { } bool ThreadPlanStepInstruction::IsPlanStale() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); Thread &thread = GetThread(); StackID cur_frame_id = thread.GetStackFrameAtIndex(0)->GetStackID(); if (cur_frame_id == m_stack_id) { @@ -128,7 +128,7 @@ bool ThreadPlanStepInstruction::IsPlanStale() { bool ThreadPlanStepInstruction::ShouldStop(Event *event_ptr) { Thread &thread = GetThread(); if (m_step_over) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); StackFrameSP cur_frame_sp = thread.GetStackFrameAtIndex(0); if (!cur_frame_sp) { LLDB_LOGF( @@ -244,7 +244,7 @@ bool ThreadPlanStepInstruction::WillStop() { return true; } bool ThreadPlanStepInstruction::MischiefManaged() { if (IsPlanComplete()) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOGF(log, "Completed single instruction step plan."); ThreadPlan::MischiefManaged(); return true; diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp b/lldb/source/Target/ThreadPlanStepOut.cpp index 86ccac2..f13f207 100644 --- a/lldb/source/Target/ThreadPlanStepOut.cpp +++ b/lldb/source/Target/ThreadPlanStepOut.cpp @@ -43,7 +43,7 @@ ThreadPlanStepOut::ThreadPlanStepOut( m_return_addr(LLDB_INVALID_ADDRESS), m_stop_others(stop_others), m_immediate_step_from_function(nullptr), m_calculate_return_value(gather_return_value) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); SetFlagsToDefault(); SetupAvoidNoDebug(step_out_avoids_code_without_debug_info); @@ -423,7 +423,7 @@ bool ThreadPlanStepOut::MischiefManaged() { // reason and we're now stopping for some other reason altogether, then // we're done with this step out operation. - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log) LLDB_LOGF(log, "Completed step out plan."); if (m_return_bp_id != LLDB_INVALID_BREAK_ID) { @@ -447,7 +447,7 @@ bool ThreadPlanStepOut::QueueInlinedStepPlan(bool queue_now) { if (!immediate_return_from_sp) return false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log) { StreamString s; immediate_return_from_sp->Dump(&s, true, false); diff --git a/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp b/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp index f007b0f..ea5d54f 100644 --- a/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp +++ b/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp @@ -51,7 +51,7 @@ bool ThreadPlanStepOverBreakpoint::DoPlanExplainsStop(Event *event_ptr) { if (stop_info_sp) { StopReason reason = stop_info_sp->GetStopReason(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOG(log, "Step over breakpoint stopped for reason: {0}.", Thread::StopReasonAsString(reason)); @@ -134,7 +134,7 @@ bool ThreadPlanStepOverBreakpoint::MischiefManaged() { // didn't get a chance to run. return false; } else { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOGF(log, "Completed step over breakpoint plan."); // Otherwise, re-enable the breakpoint we were stepping over, and we're // done. diff --git a/lldb/source/Target/ThreadPlanStepOverRange.cpp b/lldb/source/Target/ThreadPlanStepOverRange.cpp index 1bf3d53..fc1bc61 100644 --- a/lldb/source/Target/ThreadPlanStepOverRange.cpp +++ b/lldb/source/Target/ThreadPlanStepOverRange.cpp @@ -124,7 +124,7 @@ bool ThreadPlanStepOverRange::IsEquivalentContext( } bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); Thread &thread = GetThread(); if (log) { @@ -341,7 +341,7 @@ bool ThreadPlanStepOverRange::DoPlanExplainsStop(Event *event_ptr) { // breakpoint. Note, unlike the step in range plan, we don't mark ourselves // complete if we hit an unexplained breakpoint/crash. - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); StopInfoSP stop_info_sp = GetPrivateStopInfo(); bool return_value; @@ -375,7 +375,7 @@ bool ThreadPlanStepOverRange::DoWillResume(lldb::StateType resume_state, // step over that. bool in_inlined_stack = thread.DecrementCurrentInlinedDepth(); if (in_inlined_stack) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOGF(log, "ThreadPlanStepInRange::DoWillResume: adjusting range to " "the frame at inlined depth %d.", diff --git a/lldb/source/Target/ThreadPlanStepRange.cpp b/lldb/source/Target/ThreadPlanStepRange.cpp index 896e647..5ae1449 100644 --- a/lldb/source/Target/ThreadPlanStepRange.cpp +++ b/lldb/source/Target/ThreadPlanStepRange.cpp @@ -65,7 +65,7 @@ bool ThreadPlanStepRange::ValidatePlan(Stream *error) { } Vote ThreadPlanStepRange::ShouldReportStop(Event *event_ptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); const Vote vote = IsPlanComplete() ? eVoteYes : eVoteNo; LLDB_LOGF(log, "ThreadPlanStepRange::ShouldReportStop() returning vote %i\n", @@ -98,7 +98,7 @@ void ThreadPlanStepRange::DumpRanges(Stream *s) { } bool ThreadPlanStepRange::InRange() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); bool ret_value = false; Thread &thread = GetThread(); lldb::addr_t pc_load_addr = thread.GetRegisterContext()->GetPC(); @@ -293,7 +293,7 @@ InstructionList *ThreadPlanStepRange::GetInstructionsForAddress( void ThreadPlanStepRange::ClearNextBranchBreakpoint() { if (m_next_branch_bp_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOGF(log, "Removing next branch breakpoint: %d.", m_next_branch_bp_sp->GetID()); GetTarget().RemoveBreakpointByID(m_next_branch_bp_sp->GetID()); @@ -307,7 +307,7 @@ bool ThreadPlanStepRange::SetNextBranchBreakpoint() { if (m_next_branch_bp_sp) return true; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); // Stepping through ranges using breakpoints doesn't work yet, but with this // off we fall back to instruction single stepping. if (!m_use_fast_step) @@ -386,7 +386,7 @@ bool ThreadPlanStepRange::SetNextBranchBreakpoint() { bool ThreadPlanStepRange::NextRangeBreakpointExplainsStop( lldb::StopInfoSP stop_info_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (!m_next_branch_bp_sp) return false; @@ -453,7 +453,7 @@ bool ThreadPlanStepRange::MischiefManaged() { } if (done) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOGF(log, "Completed step through range plan."); ClearNextBranchBreakpoint(); ThreadPlan::MischiefManaged(); @@ -464,7 +464,7 @@ bool ThreadPlanStepRange::MischiefManaged() { } bool ThreadPlanStepRange::IsPlanStale() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); FrameComparison frame_order = CompareCurrentFrameToStartFrame(); if (frame_order == eFrameCompareOlder) { diff --git a/lldb/source/Target/ThreadPlanStepThrough.cpp b/lldb/source/Target/ThreadPlanStepThrough.cpp index 6fc0312..df832dd 100644 --- a/lldb/source/Target/ThreadPlanStepThrough.cpp +++ b/lldb/source/Target/ThreadPlanStepThrough.cpp @@ -60,7 +60,7 @@ ThreadPlanStepThrough::ThreadPlanStepThrough(Thread &thread, m_backstop_bkpt_id = return_bp->GetID(); return_bp->SetBreakpointKind("step-through-backstop"); } - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log) { LLDB_LOGF(log, "Setting backstop breakpoint %d at address: 0x%" PRIx64, m_backstop_bkpt_id, m_backstop_addr); @@ -94,7 +94,7 @@ void ThreadPlanStepThrough::LookForPlanToStepThroughFromCurrentPC() { } } - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log) { lldb::addr_t current_address = GetThread().GetRegisterContext()->GetPC(0); if (m_sub_plan_sp) { @@ -227,7 +227,7 @@ void ThreadPlanStepThrough::ClearBackstopBreakpoint() { } bool ThreadPlanStepThrough::MischiefManaged() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (!IsPlanComplete()) { return false; @@ -252,7 +252,7 @@ bool ThreadPlanStepThrough::HitOurBackstopBreakpoint() { StackID cur_frame_zero_id = thread.GetStackFrameAtIndex(0)->GetStackID(); if (cur_frame_zero_id == m_return_stack_id) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log) log->PutCString("ThreadPlanStepThrough hit backstop breakpoint."); return true; diff --git a/lldb/source/Target/ThreadPlanStepUntil.cpp b/lldb/source/Target/ThreadPlanStepUntil.cpp index 650fa62..c547368 100644 --- a/lldb/source/Target/ThreadPlanStepUntil.cpp +++ b/lldb/source/Target/ThreadPlanStepUntil.cpp @@ -315,7 +315,7 @@ bool ThreadPlanStepUntil::MischiefManaged() { // here. bool done = false; if (IsPlanComplete()) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); LLDB_LOGF(log, "Completed step until plan."); Clear(); diff --git a/lldb/source/Target/ThreadPlanTracer.cpp b/lldb/source/Target/ThreadPlanTracer.cpp index 754ce65..eabe606 100644 --- a/lldb/source/Target/ThreadPlanTracer.cpp +++ b/lldb/source/Target/ThreadPlanTracer.cpp @@ -106,10 +106,8 @@ TypeFromUser ThreadPlanAssemblyTracer::GetIntPointerType() { auto type_system_or_err = target_sp->GetScratchTypeSystemForLanguage(eLanguageTypeC); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TYPES), - std::move(err), - "Unable to get integer pointer type from TypeSystem"); + LLDB_LOG_ERROR(GetLog(LLDBLog::Commands), std::move(err), + "Unable to get integer pointer type from TypeSystem"); } else { m_intptr_type = TypeFromUser( type_system_or_err->GetBuiltinTypeForEncodingAndBitSize( diff --git a/lldb/source/Target/UnwindLLDB.cpp b/lldb/source/Target/UnwindLLDB.cpp index 77dd19b..28fa2e1 100644 --- a/lldb/source/Target/UnwindLLDB.cpp +++ b/lldb/source/Target/UnwindLLDB.cpp @@ -101,7 +101,7 @@ bool UnwindLLDB::AddFirstFrame() { return true; unwind_done: - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); if (log) { LLDB_LOGF(log, "th%d Unwind of this thread is complete.", m_thread.GetIndexID()); @@ -119,7 +119,7 @@ UnwindLLDB::CursorSP UnwindLLDB::GetOneMoreFrame(ABI *abi) { if (m_unwind_complete) return nullptr; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); CursorSP prev_frame = m_frames.back(); uint32_t cur_idx = m_frames.size(); @@ -315,7 +315,7 @@ void UnwindLLDB::UpdateUnwindPlanForFirstFrameIfInvalid(ABI *abi) { } bool UnwindLLDB::AddOneMoreFrame(ABI *abi) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log = GetLog(LLDBLog::Unwind); // Frame zero is a little different if (m_frames.empty()) diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp index 74a4370..ca5b5f1 100644 --- a/lldb/source/Utility/ArchSpec.cpp +++ b/lldb/source/Utility/ArchSpec.cpp @@ -902,7 +902,7 @@ bool ArchSpec::SetArchitecture(ArchitectureType arch_type, uint32_t cpu, m_triple.setArch(core_def->machine); } } else { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET | LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_PLATFORM)); + Log *log(GetLog(LLDBLog::Target | LLDBLog::Process | LLDBLog::Platform)); LLDB_LOGF(log, "Unable to find a core definition for cpu 0x%" PRIx32 " sub %" PRId32, diff --git a/lldb/source/Utility/Broadcaster.cpp b/lldb/source/Utility/Broadcaster.cpp index 6e06724..1d1e9fe 100644 --- a/lldb/source/Utility/Broadcaster.cpp +++ b/lldb/source/Utility/Broadcaster.cpp @@ -28,7 +28,7 @@ using namespace lldb_private; Broadcaster::Broadcaster(BroadcasterManagerSP manager_sp, const char *name) : m_broadcaster_sp(std::make_shared(*this)), m_manager_sp(std::move(manager_sp)), m_broadcaster_name(name) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOG(log, "{0} Broadcaster::Broadcaster(\"{1}\")", static_cast(this), GetBroadcasterName()); } @@ -38,7 +38,7 @@ Broadcaster::BroadcasterImpl::BroadcasterImpl(Broadcaster &broadcaster) m_hijacking_listeners(), m_hijacking_masks() {} Broadcaster::~Broadcaster() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); LLDB_LOG(log, "{0} Broadcaster::~Broadcaster(\"{1}\")", static_cast(this), GetBroadcasterName()); @@ -210,7 +210,7 @@ void Broadcaster::BroadcasterImpl::PrivateBroadcastEvent(EventSP &event_sp, hijacking_listener_sp.reset(); } - if (Log *log = lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EVENTS)) { + if (Log *log = GetLog(LLDBLog::Events)) { StreamString event_description; event_sp->Dump(&event_description); LLDB_LOGF(log, @@ -261,7 +261,7 @@ bool Broadcaster::BroadcasterImpl::HijackBroadcaster( const lldb::ListenerSP &listener_sp, uint32_t event_mask) { std::lock_guard guard(m_listeners_mutex); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EVENTS)); + Log *log = GetLog(LLDBLog::Events); LLDB_LOG( log, "{0} Broadcaster(\"{1}\")::HijackBroadcaster (listener(\"{2}\")={3})", @@ -292,7 +292,7 @@ void Broadcaster::BroadcasterImpl::RestoreBroadcaster() { if (!m_hijacking_listeners.empty()) { ListenerSP listener_sp = m_hijacking_listeners.back(); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EVENTS)); + Log *log = GetLog(LLDBLog::Events); LLDB_LOG(log, "{0} Broadcaster(\"{1}\")::RestoreBroadcaster (about to pop " "listener(\"{2}\")={3})", diff --git a/lldb/source/Utility/Instrumentation.cpp b/lldb/source/Utility/Instrumentation.cpp index 8617898..56fd571 100644 --- a/lldb/source/Utility/Instrumentation.cpp +++ b/lldb/source/Utility/Instrumentation.cpp @@ -30,7 +30,7 @@ Instrumenter::Instrumenter(llvm::StringRef pretty_func, m_local_boundary = true; g_api_signposts->startInterval(this, m_pretty_func); } - LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API), "[{0}] {1} ({2})", + LLDB_LOG(GetLog(LLDBLog::API), "[{0}] {1} ({2})", m_local_boundary ? "external" : "internal", m_pretty_func, pretty_args); } diff --git a/lldb/source/Utility/Listener.cpp b/lldb/source/Utility/Listener.cpp index d2a4f32..9122562 100644 --- a/lldb/source/Utility/Listener.cpp +++ b/lldb/source/Utility/Listener.cpp @@ -40,14 +40,14 @@ public: Listener::Listener(const char *name) : m_name(name), m_broadcasters(), m_broadcasters_mutex(), m_events(), m_events_mutex() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); if (log != nullptr) LLDB_LOGF(log, "%p Listener::Listener('%s')", static_cast(this), m_name.c_str()); } Listener::~Listener() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); Clear(); @@ -56,7 +56,7 @@ Listener::~Listener() { } void Listener::Clear() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log = GetLog(LLDBLog::Object); std::lock_guard broadcasters_guard( m_broadcasters_mutex); broadcaster_collection::iterator pos, end = m_broadcasters.end(); @@ -97,7 +97,7 @@ uint32_t Listener::StartListeningForEvents(Broadcaster *broadcaster, uint32_t acquired_mask = broadcaster->AddListener(this->shared_from_this(), event_mask); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); + Log *log = GetLog(LLDBLog::Events); if (log != nullptr) LLDB_LOGF(log, "%p Listener::StartListeningForEvents (broadcaster = %p, " @@ -128,7 +128,7 @@ uint32_t Listener::StartListeningForEvents(Broadcaster *broadcaster, uint32_t acquired_mask = broadcaster->AddListener(this->shared_from_this(), event_mask); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); + Log *log = GetLog(LLDBLog::Events); if (log != nullptr) { void **pointer = reinterpret_cast(&callback); LLDB_LOGF(log, @@ -200,7 +200,7 @@ void Listener::BroadcasterManagerWillDestruct(BroadcasterManagerSP manager_sp) { } void Listener::AddEvent(EventSP &event_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); + Log *log = GetLog(LLDBLog::Events); if (log != nullptr) LLDB_LOGF(log, "%p Listener('%s')::AddEvent (event_sp = {%p})", static_cast(this), m_name.c_str(), @@ -270,7 +270,7 @@ bool Listener::FindNextEventInternal( // Mutex::Locker // and pass the locker as the first argument. m_events_mutex is no longer // recursive. - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); + Log *log = GetLog(LLDBLog::Events); if (m_events.empty()) return false; @@ -348,7 +348,7 @@ bool Listener::GetEventInternal( const ConstString *broadcaster_names, // nullptr for any event uint32_t num_broadcaster_names, uint32_t event_type_mask, EventSP &event_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); + Log *log = GetLog(LLDBLog::Events); LLDB_LOG(log, "this = {0}, timeout = {1} for {2}", this, timeout, m_name); std::unique_lock lock(m_events_mutex); @@ -366,12 +366,12 @@ bool Listener::GetEventInternal( result = m_events_condition.wait_for(lock, *timeout); if (result == std::cv_status::timeout) { - log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS); + log = GetLog(LLDBLog::Events); LLDB_LOGF(log, "%p Listener::GetEventInternal() timed out for %s", static_cast(this), m_name.c_str()); return false; } else if (result != std::cv_status::no_timeout) { - log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS); + log = GetLog(LLDBLog::Events); LLDB_LOGF(log, "%p Listener::GetEventInternal() unknown error for %s", static_cast(this), m_name.c_str()); return false; diff --git a/lldb/source/Utility/Logging.cpp b/lldb/source/Utility/Logging.cpp index 67d5d3a..3a972e0 100644 --- a/lldb/source/Utility/Logging.cpp +++ b/lldb/source/Utility/Logging.cpp @@ -79,11 +79,3 @@ template <> Log::Channel &lldb_private::LogChannelFor() { void lldb_private::InitializeLldbChannel() { Log::Register("lldb", g_log_channel); } - -Log *lldb_private::GetLogIfAllCategoriesSet(LLDBLog mask) { - return GetLog(mask); -} - -Log *lldb_private::GetLogIfAnyCategoriesSet(LLDBLog mask) { - return GetLog(mask); -} diff --git a/lldb/tools/lldb-server/lldb-gdbserver.cpp b/lldb/tools/lldb-server/lldb-gdbserver.cpp index 7648a0b..84df425 100644 --- a/lldb/tools/lldb-server/lldb-gdbserver.cpp +++ b/lldb/tools/lldb-server/lldb-gdbserver.cpp @@ -95,7 +95,7 @@ static int g_sighup_received_count = 0; static void sighup_handler(MainLoopBase &mainloop) { ++g_sighup_received_count; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log = GetLog(LLDBLog::Process); LLDB_LOGF(log, "lldb-server:%s swallowing SIGHUP (receive count=%d)", __FUNCTION__, g_sighup_received_count); -- 2.7.4