diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h --- a/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -19,7 +19,7 @@ #include "lldb/Utility/Broadcaster.h" #include "lldb/Utility/CompletionRequest.h" #include "lldb/Utility/Event.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/StringList.h" #include "lldb/lldb-forward.h" diff --git a/lldb/include/lldb/Interpreter/ScriptedInterface.h b/lldb/include/lldb/Interpreter/ScriptedInterface.h --- a/lldb/include/lldb/Interpreter/ScriptedInterface.h +++ b/lldb/include/lldb/Interpreter/ScriptedInterface.h @@ -11,8 +11,7 @@ #include "lldb/Core/StructuredDataImpl.h" #include "lldb/Target/ExecutionContext.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/lldb-private.h" #include "llvm/Support/Compiler.h" @@ -33,7 +32,7 @@ Ret ErrorWithMessage(llvm::StringRef caller_name, llvm::StringRef error_msg, Status &error, uint32_t log_caterogy = LIBLLDB_LOG_PROCESS) { - LLDB_LOGF(GetLogIfAllCategoriesSet(log_caterogy), "%s ERROR = %s", + LLDB_LOGF(LLDBLog::GetLogIfAllCategoriesSet(log_caterogy), "%s ERROR = %s", caller_name.data(), error_msg.data()); error.SetErrorString(llvm::Twine(caller_name + llvm::Twine(" ERROR = ") + llvm::Twine(error_msg)) diff --git a/lldb/include/lldb/Utility/LLDBLog.h b/lldb/include/lldb/Utility/LLDBLog.h new file mode 100644 --- /dev/null +++ b/lldb/include/lldb/Utility/LLDBLog.h @@ -0,0 +1,71 @@ +//===-- Logging.h -----------------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_UTILITY_LOGGING_H +#define LLDB_UTILITY_LOGGING_H + +#include "lldb/Utility/Log.h" + +// Log Bits specific to logging in lldb +#define LIBLLDB_LOG_PROCESS LLDB_LOG_BIT(1) +#define LIBLLDB_LOG_THREAD LLDB_LOG_BIT(2) +#define LIBLLDB_LOG_DYNAMIC_LOADER LLDB_LOG_BIT(3) +#define LIBLLDB_LOG_EVENTS LLDB_LOG_BIT(4) +#define LIBLLDB_LOG_BREAKPOINTS LLDB_LOG_BIT(5) +#define LIBLLDB_LOG_WATCHPOINTS LLDB_LOG_BIT(6) +#define LIBLLDB_LOG_STEP LLDB_LOG_BIT(7) +#define LIBLLDB_LOG_EXPRESSIONS LLDB_LOG_BIT(8) +#define LIBLLDB_LOG_TEMPORARY LLDB_LOG_BIT(9) +#define LIBLLDB_LOG_STATE LLDB_LOG_BIT(10) +#define LIBLLDB_LOG_OBJECT LLDB_LOG_BIT(11) +#define LIBLLDB_LOG_COMMUNICATION LLDB_LOG_BIT(12) +#define LIBLLDB_LOG_CONNECTION LLDB_LOG_BIT(13) +#define LIBLLDB_LOG_HOST LLDB_LOG_BIT(14) +#define LIBLLDB_LOG_UNWIND LLDB_LOG_BIT(15) +#define LIBLLDB_LOG_API LLDB_LOG_BIT(16) +#define LIBLLDB_LOG_SCRIPT LLDB_LOG_BIT(17) +#define LIBLLDB_LOG_COMMANDS LLDB_LOG_BIT(18) +#define LIBLLDB_LOG_TYPES LLDB_LOG_BIT(19) +#define LIBLLDB_LOG_SYMBOLS LLDB_LOG_BIT(20) +#define LIBLLDB_LOG_MODULES LLDB_LOG_BIT(21) +#define LIBLLDB_LOG_TARGET LLDB_LOG_BIT(22) +#define LIBLLDB_LOG_MMAP LLDB_LOG_BIT(23) +#define LIBLLDB_LOG_OS LLDB_LOG_BIT(24) +#define LIBLLDB_LOG_PLATFORM LLDB_LOG_BIT(25) +#define LIBLLDB_LOG_SYSTEM_RUNTIME LLDB_LOG_BIT(26) +#define LIBLLDB_LOG_JIT_LOADER LLDB_LOG_BIT(27) +#define LIBLLDB_LOG_LANGUAGE LLDB_LOG_BIT(28) +#define LIBLLDB_LOG_DATAFORMATTERS LLDB_LOG_BIT(29) +#define LIBLLDB_LOG_DEMANGLE LLDB_LOG_BIT(30) +#define LIBLLDB_LOG_AST LLDB_LOG_BIT(31) +#define LIBLLDB_LOG_ALL LLDB_LOG_ALL_BITS +#define LIBLLDB_LOG_DEFAULT \ + (LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD | LIBLLDB_LOG_DYNAMIC_LOADER | \ + LIBLLDB_LOG_BREAKPOINTS | LIBLLDB_LOG_WATCHPOINTS | LIBLLDB_LOG_STEP | \ + LIBLLDB_LOG_STATE | LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_TARGET | \ + LIBLLDB_LOG_COMMANDS) + +namespace lldb_private { +class LLDBLog { + static Log::Channel g_channel; + +public: + static void Initialize(); + + static Log *GetLogIfAllCategoriesSet(LogMask mask) { + return g_channel.GetLogIfAll(mask); + } + + static Log *GetLogIfAnyCategoryIsSet(LogMask mask) { + return g_channel.GetLogIfAny(mask); + } +}; + +} // namespace lldb_private + +#endif // LLDB_UTILITY_LOGGING_H diff --git a/lldb/include/lldb/Utility/Log.h b/lldb/include/lldb/Utility/Log.h --- a/lldb/include/lldb/Utility/Log.h +++ b/lldb/include/lldb/Utility/Log.h @@ -10,7 +10,6 @@ #define LLDB_UTILITY_LOG_H #include "lldb/Utility/Flags.h" -#include "lldb/Utility/Logging.h" #include "lldb/lldb-defines.h" #include "llvm/ADT/ArrayRef.h" @@ -43,16 +42,21 @@ #define LLDB_LOG_OPTION_APPEND (1U << 8) #define LLDB_LOG_OPTION_PREPEND_FILE_FUNCTION (1U << 9) +// Define a log bit using a shift amount using the right type for LogMask +#define LLDB_LOG_BIT(shift) (1ull << shift) +#define LLDB_LOG_ALL_BITS UINT64_MAX // Logging Functions namespace lldb_private { +typedef uint64_t LogMask; + class Log final { public: // Description of a log channel category. struct Category { llvm::StringLiteral name; llvm::StringLiteral description; - uint32_t flag; + LogMask flag; }; // This class describes a log channel. It also encapsulates the behavior @@ -63,10 +67,10 @@ public: const llvm::ArrayRef categories; - const uint32_t default_flags; + const LogMask default_flags; constexpr Channel(llvm::ArrayRef categories, - uint32_t default_flags) + LogMask default_flags) : log_ptr(nullptr), categories(categories), default_flags(default_flags) {} @@ -74,7 +78,7 @@ // after (or concurrently with) this function returning a non-null Log // pointer, it is still safe to attempt to write to the Log object -- the // output will be discarded. - Log *GetLogIfAll(uint32_t mask) { + Log *GetLogIfAll(LogMask mask) { Log *log = log_ptr.load(std::memory_order_relaxed); if (log && log->GetMask().AllSet(mask)) return log; @@ -85,7 +89,7 @@ // after (or concurrently with) this function returning a non-null Log // pointer, it is still safe to attempt to write to the Log object -- the // output will be discarded. - Log *GetLogIfAny(uint32_t mask) { + Log *GetLogIfAny(LogMask mask) { Log *log = log_ptr.load(std::memory_order_relaxed); if (log && log->GetMask().AnySet(mask)) return log; @@ -93,9 +97,6 @@ } }; - - static void Initialize(); - // Static accessors for logging channels static void Register(llvm::StringRef name, Channel &channel); static void Unregister(llvm::StringRef name); @@ -180,7 +181,7 @@ std::shared_ptr m_stream_sp; std::atomic m_options{0}; - std::atomic m_mask{0}; + std::atomic m_mask{0}; void WriteHeader(llvm::raw_ostream &OS, llvm::StringRef file, llvm::StringRef function); @@ -195,9 +196,9 @@ } void Enable(const std::shared_ptr &stream_sp, - uint32_t options, uint32_t flags); + uint32_t options, LogMask flags); - void Disable(uint32_t flags); + void Disable(LogMask flags); typedef llvm::StringMap ChannelMap; static llvm::ManagedStatic g_channel_map; @@ -208,7 +209,7 @@ static void ListCategories(llvm::raw_ostream &stream, const ChannelMap::value_type &entry); - static uint32_t GetFlags(llvm::raw_ostream &stream, const ChannelMap::value_type &entry, + static LogMask GetFlags(llvm::raw_ostream &stream, const ChannelMap::value_type &entry, llvm::ArrayRef categories); Log(const Log &) = delete; diff --git a/lldb/include/lldb/Utility/Logging.h b/lldb/include/lldb/Utility/Logging.h deleted file mode 100644 --- a/lldb/include/lldb/Utility/Logging.h +++ /dev/null @@ -1,65 +0,0 @@ -//===-- Logging.h -----------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef LLDB_UTILITY_LOGGING_H -#define LLDB_UTILITY_LOGGING_H - -#include - -// Log Bits specific to logging in lldb -#define LIBLLDB_LOG_PROCESS (1u << 1) -#define LIBLLDB_LOG_THREAD (1u << 2) -#define LIBLLDB_LOG_DYNAMIC_LOADER (1u << 3) -#define LIBLLDB_LOG_EVENTS (1u << 4) -#define LIBLLDB_LOG_BREAKPOINTS (1u << 5) -#define LIBLLDB_LOG_WATCHPOINTS (1u << 6) -#define LIBLLDB_LOG_STEP (1u << 7) -#define LIBLLDB_LOG_EXPRESSIONS (1u << 8) -#define LIBLLDB_LOG_TEMPORARY (1u << 9) -#define LIBLLDB_LOG_STATE (1u << 10) -#define LIBLLDB_LOG_OBJECT (1u << 11) -#define LIBLLDB_LOG_COMMUNICATION (1u << 12) -#define LIBLLDB_LOG_CONNECTION (1u << 13) -#define LIBLLDB_LOG_HOST (1u << 14) -#define LIBLLDB_LOG_UNWIND (1u << 15) -#define LIBLLDB_LOG_API (1u << 16) -#define LIBLLDB_LOG_SCRIPT (1u << 17) -#define LIBLLDB_LOG_COMMANDS (1U << 18) -#define LIBLLDB_LOG_TYPES (1u << 19) -#define LIBLLDB_LOG_SYMBOLS (1u << 20) -#define LIBLLDB_LOG_MODULES (1u << 21) -#define LIBLLDB_LOG_TARGET (1u << 22) -#define LIBLLDB_LOG_MMAP (1u << 23) -#define LIBLLDB_LOG_OS (1u << 24) -#define LIBLLDB_LOG_PLATFORM (1u << 25) -#define LIBLLDB_LOG_SYSTEM_RUNTIME (1u << 26) -#define LIBLLDB_LOG_JIT_LOADER (1u << 27) -#define LIBLLDB_LOG_LANGUAGE (1u << 28) -#define LIBLLDB_LOG_DATAFORMATTERS (1u << 29) -#define LIBLLDB_LOG_DEMANGLE (1u << 30) -#define LIBLLDB_LOG_AST (1u << 31) -#define LIBLLDB_LOG_ALL (UINT32_MAX) -#define LIBLLDB_LOG_DEFAULT \ - (LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD | LIBLLDB_LOG_DYNAMIC_LOADER | \ - LIBLLDB_LOG_BREAKPOINTS | LIBLLDB_LOG_WATCHPOINTS | LIBLLDB_LOG_STEP | \ - LIBLLDB_LOG_STATE | LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_TARGET | \ - LIBLLDB_LOG_COMMANDS) - -namespace lldb_private { - -class Log; - -Log *GetLogIfAllCategoriesSet(uint32_t mask); - -Log *GetLogIfAnyCategoriesSet(uint32_t mask); - -void InitializeLldbChannel(); - -} // namespace lldb_private - -#endif // LLDB_UTILITY_LOGGING_H diff --git a/lldb/include/lldb/Utility/ReproducerInstrumentation.h b/lldb/include/lldb/Utility/ReproducerInstrumentation.h --- a/lldb/include/lldb/Utility/ReproducerInstrumentation.h +++ b/lldb/include/lldb/Utility/ReproducerInstrumentation.h @@ -9,8 +9,7 @@ #define LLDB_UTILITY_REPRODUCERINSTRUMENTATION_H #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringRef.h" diff --git a/lldb/source/API/SBBreakpointOptionCommon.cpp b/lldb/source/API/SBBreakpointOptionCommon.cpp --- a/lldb/source/API/SBBreakpointOptionCommon.cpp +++ b/lldb/source/API/SBBreakpointOptionCommon.cpp @@ -26,7 +26,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" #include "lldb/lldb-enumerations.h" @@ -38,13 +38,12 @@ using namespace lldb; using namespace lldb_private; -SBBreakpointCallbackBaton::SBBreakpointCallbackBaton(SBBreakpointHitCallback - callback, - void *baton) - : TypedBaton(std::make_unique()) { - getItem()->callback = callback; - getItem()->callback_baton = baton; - } +SBBreakpointCallbackBaton::SBBreakpointCallbackBaton( + SBBreakpointHitCallback callback, void *baton) + : TypedBaton(std::make_unique()) { + getItem()->callback = callback; + getItem()->callback_baton = baton; +} bool SBBreakpointCallbackBaton::PrivateBreakpointHitCallback(void *baton, StoppointCallbackContext *ctx, diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -803,7 +803,7 @@ sb_error.SetErrorString("invalid debugger"); } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); LLDB_LOGF(log, "SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, " "platform_name=%s, add_dependent_modules=%u, error=%s) => " @@ -833,7 +833,7 @@ sb_target.SetSP(target_sp); } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); LLDB_LOGF(log, "SBDebugger(%p)::CreateTargetWithFileAndTargetTriple " "(filename=\"%s\", triple=%s) => SBTarget(%p)", @@ -848,7 +848,7 @@ LLDB_RECORD_METHOD(lldb::SBTarget, SBDebugger, CreateTargetWithFileAndArch, (const char *, const char *), filename, arch_cstr); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); SBTarget sb_target; TargetSP target_sp; @@ -858,15 +858,15 @@ // The version of CreateTarget that takes an ArchSpec won't accept an // empty ArchSpec, so when the arch hasn't been specified, we need to // call the target triple version. - error = m_opaque_sp->GetTargetList().CreateTarget(*m_opaque_sp, filename, + error = m_opaque_sp->GetTargetList().CreateTarget(*m_opaque_sp, filename, arch_cstr, eLoadDependentsYes, nullptr, target_sp); } else { PlatformSP platform_sp = m_opaque_sp->GetPlatformList() .GetSelectedPlatform(); - ArchSpec arch = Platform::GetAugmentedArchSpec(platform_sp.get(), + ArchSpec arch = Platform::GetAugmentedArchSpec(platform_sp.get(), arch_cstr); if (arch.IsValid()) - error = m_opaque_sp->GetTargetList().CreateTarget(*m_opaque_sp, filename, + error = m_opaque_sp->GetTargetList().CreateTarget(*m_opaque_sp, filename, arch, eLoadDependentsYes, platform_sp, target_sp); else error.SetErrorStringWithFormat("invalid arch_cstr: %s", arch_cstr); @@ -903,7 +903,7 @@ if (error.Success()) sb_target.SetSP(target_sp); } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); LLDB_LOGF(log, "SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)", static_cast(m_opaque_sp.get()), filename, @@ -918,7 +918,7 @@ if (m_opaque_sp) { sb_target.SetSP(m_opaque_sp->GetDummyTarget().shared_from_this()); } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); LLDB_LOGF(log, "SBDebugger(%p)::GetDummyTarget() => SBTarget(%p)", static_cast(m_opaque_sp.get()), static_cast(sb_target.GetSP().get())); @@ -940,7 +940,7 @@ } } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); LLDB_LOGF(log, "SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i", static_cast(m_opaque_sp.get()), static_cast(target.m_opaque_sp.get()), result); @@ -1027,7 +1027,7 @@ SBTarget SBDebugger::GetSelectedTarget() { LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTarget, SBDebugger, GetSelectedTarget); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); SBTarget sb_target; TargetSP target_sp; @@ -1052,7 +1052,7 @@ LLDB_RECORD_METHOD(void, SBDebugger, SetSelectedTarget, (lldb::SBTarget &), sb_target); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); TargetSP target_sp(sb_target.GetSP()); if (m_opaque_sp) { @@ -1070,7 +1070,7 @@ SBPlatform SBDebugger::GetSelectedPlatform() { LLDB_RECORD_METHOD_NO_ARGS(lldb::SBPlatform, SBDebugger, GetSelectedPlatform); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); SBPlatform sb_platform; DebuggerSP debugger_sp(m_opaque_sp); @@ -1088,7 +1088,7 @@ LLDB_RECORD_METHOD(void, SBDebugger, SetSelectedPlatform, (lldb::SBPlatform &), sb_platform); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); DebuggerSP debugger_sp(m_opaque_sp); if (debugger_sp) { @@ -1179,7 +1179,7 @@ LLDB_RECORD_METHOD(void, SBDebugger, DispatchInput, (const void *, size_t), data, data_len); - // Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); + // Log *log(LLDBLog::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); // // if (log) // LLDB_LOGF(log, "SBDebugger(%p)::DispatchInput (data=\"%.*s\", @@ -1383,7 +1383,7 @@ const char *SBDebugger::GetPrompt() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBDebugger, GetPrompt); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); LLDB_LOGF(log, "SBDebugger(%p)::GetPrompt () => \"%s\"", static_cast(m_opaque_sp.get()), @@ -1533,7 +1533,7 @@ LLDB_RECORD_METHOD(bool, SBDebugger, SetCurrentPlatformSDKRoot, (const char *), sysroot); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); if (m_opaque_sp) { PlatformSP platform_sp( m_opaque_sp->GetPlatformList().GetSelectedPlatform()); diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -1061,7 +1061,7 @@ (const char *, const lldb::SBExpressionOptions &), expr, options); - Log *expr_log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *expr_log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); SBValue expr_result; diff --git a/lldb/source/API/SBStream.cpp b/lldb/source/API/SBStream.cpp --- a/lldb/source/API/SBStream.cpp +++ b/lldb/source/API/SBStream.cpp @@ -99,8 +99,8 @@ llvm::Expected file = FileSystem::Instance().Open(FileSpec(path), open_options); if (!file) { - LLDB_LOG_ERROR(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API), file.takeError(), - "Cannot open {1}: {0}", path); + LLDB_LOG_ERROR(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API), + file.takeError(), "Cannot open {1}: {0}", path); return; } diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -1215,7 +1215,7 @@ llvm::Expected> expected_vector = target_sp->GetBreakpointList().FindBreakpointsByName(name); if (!expected_vector) { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS), "invalid breakpoint name: {}", llvm::toString(expected_vector.takeError())); return false; @@ -2362,7 +2362,7 @@ (const char *, const lldb::SBExpressionOptions &), expr, options); - Log *expr_log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *expr_log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -26,7 +26,7 @@ #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/Target.h" #include "lldb/Target/ThreadSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" @@ -487,7 +487,7 @@ void Breakpoint::ModulesChanged(ModuleList &module_list, bool load, bool delete_locations) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); LLDB_LOGF(log, "Breakpoint::ModulesChanged: num_modules: %zu load: %i " "delete_locations: %i\n", @@ -526,12 +526,12 @@ locations_with_no_section.Add(break_loc_sp); continue; } - + if (!break_loc_sp->IsEnabled()) continue; - + SectionSP section_sp(section_addr.GetSection()); - + // If we don't have a Section, that means this location is a raw // address that we haven't resolved to a section yet. So we'll have to // look in all the new modules to resolve this location. Otherwise, if @@ -548,9 +548,9 @@ } } } - + size_t num_to_delete = locations_with_no_section.GetSize(); - + for (size_t i = 0; i < num_to_delete; i++) m_locations.RemoveLocation(locations_with_no_section.GetByIndex(i)); @@ -646,7 +646,7 @@ void Breakpoint::ModuleReplaced(ModuleSP old_module_sp, ModuleSP new_module_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ -1102,7 +1102,7 @@ bp.try_emplace("kindDescription", m_kind_description); // Put the full structured data for reproducing this breakpoint in a key/value // pair named "details". This allows the breakpoint's details to be visible - // in the stats in case we need to reproduce a breakpoint that has long + // in the stats in case we need to reproduce a breakpoint that has long // resolve times StructuredData::ObjectSP bp_data_sp = SerializeToStructuredData(); if (bp_data_sp) { diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp --- a/lldb/source/Breakpoint/BreakpointLocation.cpp +++ b/lldb/source/Breakpoint/BreakpointLocation.cpp @@ -22,7 +22,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -233,7 +233,7 @@ bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx, Status &error) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); std::lock_guard guard(m_condition_mutex); @@ -393,7 +393,7 @@ bool BreakpointLocation::ShouldStop(StoppointCallbackContext *context) { bool should_stop = true; - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); // Do this first, if a location is disabled, it shouldn't increment its hit // count. @@ -450,7 +450,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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/BreakpointName.cpp b/lldb/source/Breakpoint/BreakpointName.cpp --- a/lldb/source/Breakpoint/BreakpointName.cpp +++ b/lldb/source/Breakpoint/BreakpointName.cpp @@ -9,11 +9,11 @@ #include "llvm/Support/Casting.h" #include "lldb/Breakpoint/Breakpoint.h" -#include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Breakpoint/BreakpointLocationCollection.h" +#include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Breakpoint/BreakpointResolver.h" #include "lldb/Breakpoint/BreakpointResolverFileLine.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" @@ -21,12 +21,8 @@ using namespace lldb_private; const Flags::ValueType BreakpointName::Permissions::permissions_mask - [BreakpointName::Permissions::PermissionKinds::allPerms + 1] = { - (1u << 0), - (1u << 1), - (1u << 2), - (0x5u) -}; + [BreakpointName::Permissions::PermissionKinds::allPerms + 1] = { + (1u << 0), (1u << 1), (1u << 2), (0x5u)}; BreakpointName::BreakpointName(ConstString name, const Breakpoint &bkpt, const char *help) : @@ -43,10 +39,10 @@ s->Indent(); if (IsSet(listPerm)) s->Printf("list: %s", GetAllowList() ? "allowed" : "disallowed"); - + if (IsSet(disablePerm)) s->Printf("disable: %s", GetAllowDisable() ? "allowed" : "disallowed"); - + if (IsSet(deletePerm)) s->Printf("delete: %s", GetAllowDelete() ? "allowed" : "disallowed"); s->IndentLess(); diff --git a/lldb/source/Breakpoint/BreakpointResolver.cpp b/lldb/source/Breakpoint/BreakpointResolver.cpp --- a/lldb/source/Breakpoint/BreakpointResolver.cpp +++ b/lldb/source/Breakpoint/BreakpointResolver.cpp @@ -24,7 +24,7 @@ #include "lldb/Symbol/Function.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" @@ -292,7 +292,7 @@ const SymbolContext &sc, bool skip_prologue, llvm::StringRef log_ident) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp @@ -14,7 +14,7 @@ #include "lldb/Core/Section.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -143,8 +143,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -12,7 +12,7 @@ #include "lldb/Core/Module.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/Function.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -127,7 +127,7 @@ if (is_relative) relative_path = m_location_spec.GetFileSpec().GetDirectory().GetStringRef(); - Log * log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); for(uint32_t i = 0; i < sc_list.GetSize(); ++i) { SymbolContext sc; sc_list.GetContextAtIndex(i, sc); diff --git a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp --- a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp @@ -12,7 +12,7 @@ #include "lldb/Core/SourceManager.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb; diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp b/lldb/source/Breakpoint/BreakpointResolverName.cpp --- a/lldb/source/Breakpoint/BreakpointResolverName.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp @@ -17,7 +17,7 @@ #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/Target.h" #include "lldb/Target/Language.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -33,7 +33,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Warning("function name regexp: \"%s\" did not compile.", @@ -252,7 +252,7 @@ Searcher::CallbackReturn BreakpointResolverName::SearchCallback(SearchFilter &filter, SymbolContext &context, Address *addr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); if (m_class_name) { if (log) diff --git a/lldb/source/Breakpoint/BreakpointResolverScripted.cpp b/lldb/source/Breakpoint/BreakpointResolverScripted.cpp --- a/lldb/source/Breakpoint/BreakpointResolverScripted.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverScripted.cpp @@ -18,7 +18,7 @@ #include "lldb/Interpreter/ScriptInterpreter.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -64,7 +64,7 @@ Status &error) { llvm::StringRef class_name; bool success; - + success = options_dict.GetValueForKeyAsString( GetKey(OptionNames::PythonClassName), class_name); if (!success) { @@ -80,7 +80,7 @@ if (options_dict.GetValueForKeyAsDictionary(GetKey(OptionNames::ScriptArgs), args_dict)) args_data_impl.SetObjectSP(args_dict->shared_from_this()); - return new BreakpointResolverScripted(bkpt, class_name, depth, + return new BreakpointResolverScripted(bkpt, class_name, depth, args_data_impl); } diff --git a/lldb/source/Breakpoint/Watchpoint.cpp b/lldb/source/Breakpoint/Watchpoint.cpp --- a/lldb/source/Breakpoint/Watchpoint.cpp +++ b/lldb/source/Breakpoint/Watchpoint.cpp @@ -17,7 +17,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Target/ThreadSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -41,7 +41,7 @@ target.GetScratchTypeSystemForLanguage(eLanguageTypeC); if (auto err = type_system_or_err.takeError()) { LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_WATCHPOINTS), + LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_WATCHPOINTS), std::move(err), "Failed to set type."); } else { m_type = type_system_or_err->GetBuiltinTypeForEncodingAndBitSize( diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/source/Commands/CommandObjectLog.cpp @@ -14,7 +14,7 @@ #include "lldb/Interpreter/Options.h" #include "lldb/Utility/Args.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/Timer.h" diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -1038,7 +1038,7 @@ const char *to = command.GetArgumentAtIndex(i + 1); if (from[0] && to[0]) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Core/AddressResolverFileLine.cpp +++ b/lldb/source/Core/AddressResolverFileLine.cpp @@ -14,8 +14,7 @@ #include "lldb/Symbol/LineEntry.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" #include "lldb/lldb-enumerations.h" @@ -40,7 +39,7 @@ SymbolContextList sc_list; CompileUnit *cu = context.comp_unit; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Core/Communication.cpp +++ b/lldb/source/Core/Communication.cpp @@ -14,8 +14,8 @@ #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Event.h" #include "lldb/Utility/Listener.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "llvm/ADT/None.h" @@ -47,7 +47,7 @@ { - LLDB_LOG(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | + LLDB_LOG(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_COMMUNICATION), "{0} Communication::Communication (name = {1})", this, name); @@ -62,7 +62,7 @@ } Communication::~Communication() { - LLDB_LOG(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | + LLDB_LOG(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_COMMUNICATION), "{0} Communication::~Communication (name = {1})", this, GetBroadcasterName().AsCString()); @@ -78,7 +78,7 @@ ConnectionStatus Communication::Connect(const char *url, Status *error_ptr) { Clear(); - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), "{0} Communication::Connect (url = {1})", this, url); lldb::ConnectionSP connection_sp(m_connection_sp); @@ -90,7 +90,7 @@ } ConnectionStatus Communication::Disconnect(Status *error_ptr) { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), "{0} Communication::Disconnect ()", this); assert((!m_read_thread_enabled || m_read_thread_did_exit) && @@ -125,7 +125,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION); LLDB_LOG( log, "this = {0}, dst = {1}, dst_len = {2}, timeout = {3}, connection = {4}", @@ -175,7 +175,7 @@ lldb::ConnectionSP connection_sp(m_connection_sp); std::lock_guard guard(m_write_mutex); - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), "{0} Communication::Write (src = {1}, src_len = {2}" ") connection = {3}", this, src, (uint64_t)src_len, connection_sp.get()); @@ -206,7 +206,7 @@ if (m_read_thread.IsJoinable()) return true; - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), "{0} Communication::StartReadThread ()", this); const std::string thread_name = @@ -222,7 +222,7 @@ if (error_ptr) *error_ptr = Status(maybe_thread.takeError()); else { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), "failed to launch host thread: {}", llvm::toString(maybe_thread.takeError())); } @@ -238,7 +238,7 @@ if (!m_read_thread.IsJoinable()) return true; - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), "{0} Communication::StopReadThread ()", this); m_read_thread_enabled = false; @@ -280,7 +280,7 @@ void Communication::AppendBytesToCache(const uint8_t *bytes, size_t len, bool broadcast, ConnectionStatus status) { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), "{0} Communication::AppendBytesToCache (src = {1}, src_len = {2}, " "broadcast = {3})", this, bytes, (uint64_t)len, broadcast); @@ -317,7 +317,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION)); LLDB_LOGF(log, "%p Communication::ReadThread () thread starting...", p); @@ -369,7 +369,7 @@ break; } } - log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION); + log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Core/DataFileCache.cpp +++ b/lldb/source/Core/DataFileCache.cpp @@ -12,8 +12,8 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Utility/DataEncoder.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/Support/CachePruning.h" #include "llvm/Support/MemoryBuffer.h" @@ -57,7 +57,7 @@ if (cache_or_err) m_cache_callback = std::move(*cache_or_err); else { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_MODULES)); LLDB_LOG_ERROR(log, cache_or_err.takeError(), "failed to create lldb index cache directory: {0}"); } @@ -89,7 +89,7 @@ if (!add_stream) return std::move(m_mem_buff_up); } else { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 @@ cfs->OS->write((const char *)data.data(), data.size()); return true; } else { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -44,7 +44,7 @@ #include "lldb/Utility/AnsiTerminal.h" #include "lldb/Utility/Event.h" #include "lldb/Utility/Listener.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Reproducer.h" #include "lldb/Utility/ReproducerProvider.h" #include "lldb/Utility/State.h" @@ -1692,7 +1692,7 @@ if (event_handler_thread) { m_event_handler_thread = *event_handler_thread; } else { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), "failed to launch host thread: {}", llvm::toString(event_handler_thread.takeError())); } @@ -1733,7 +1733,7 @@ if (io_handler_thread) { m_io_handler_thread = *io_handler_thread; } else { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), "failed to launch host thread: {}", llvm::toString(io_handler_thread.takeError())); } diff --git a/lldb/source/Core/DumpDataExtractor.cpp b/lldb/source/Core/DumpDataExtractor.cpp --- a/lldb/source/Core/DumpDataExtractor.cpp +++ b/lldb/source/Core/DumpDataExtractor.cpp @@ -21,7 +21,7 @@ #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" #include "llvm/ADT/APFloat.h" diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -44,8 +44,8 @@ #include "lldb/Utility/CompletionRequest.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" @@ -509,7 +509,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 ValueObjectSP ExpandIndexedExpression(ValueObject *valobj, size_t index, bool deref_pointer) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ if (valobj == nullptr) return false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Core/Mangled.cpp +++ b/lldb/source/Core/Mangled.cpp @@ -13,8 +13,8 @@ #include "lldb/Target/Language.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataEncoder.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/Stream.h" #include "lldb/lldb-enumerations.h" @@ -130,7 +130,7 @@ llvm::MSDF_NoAccessSpecifier | llvm::MSDF_NoCallingConvention | llvm::MSDF_NoMemberType | llvm::MSDF_NoVariableType)); - if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) { + if (Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) { if (demangled_cstr && demangled_cstr[0]) LLDB_LOGF(log, "demangled msvc: %s -> \"%s\"", M, demangled_cstr); else @@ -157,7 +157,7 @@ "Expected demangled_size to return length including trailing null"); } - if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) { + if (Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) { if (demangled_cstr) LLDB_LOGF(log, "demangled itanium: %s -> \"%s\"", M, demangled_cstr); else @@ -170,7 +170,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) { if (demangled_cstr && demangled_cstr[0]) LLDB_LOG(log, "demangled rustv0: {0} -> \"{1}\"", M, demangled_cstr); else @@ -183,7 +183,7 @@ static char *GetDLangDemangledStr(const char *M) { char *demangled_cstr = llvm::dlangDemangle(M); - if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) { + if (Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -39,8 +39,8 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" @@ -138,7 +138,7 @@ GetModuleCollection().push_back(this); } - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_MODULES)); if (log != nullptr) LLDB_LOGF(log, "%p Module::Module((%s) '%s%s%s%s')", @@ -251,7 +251,7 @@ if (object_name) m_object_name = *object_name; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_MODULES)); if (log != nullptr) LLDB_LOGF(log, "%p Module::Module((%s) '%s%s%s%s')", @@ -281,7 +281,7 @@ assert(pos != end); modules.erase(pos); } - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_MODULES)); if (log != nullptr) LLDB_LOGF(log, "%p Module::~Module((%s) '%s%s%s%s')", @@ -1629,7 +1629,7 @@ bool Module::MergeArchitecture(const ArchSpec &arch_spec) { if (!arch_spec.IsValid()) return false; - LLDB_LOGF(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_MODULES), + LLDB_LOGF(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_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 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -22,8 +22,8 @@ #include "lldb/Symbol/VariableList.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/UUID.h" #include "lldb/lldb-defines.h" @@ -807,7 +807,7 @@ if (old_modules) old_modules->push_back(module_sp); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 --- a/lldb/source/Core/RichManglingContext.cpp +++ b/lldb/source/Core/RichManglingContext.cpp @@ -8,8 +8,7 @@ #include "lldb/Core/RichManglingContext.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" @@ -47,7 +46,7 @@ ResetProvider(ItaniumPartialDemangler); } - if (Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) { + if (Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE)) { if (!err) { ParseFullName(); LLDB_LOG(log, "demangled itanium: {0} -> \"{1}\"", mangled, m_ipd_buf); @@ -103,7 +102,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Core/StreamFile.cpp +++ b/lldb/source/Core/StreamFile.cpp @@ -8,7 +8,7 @@ #include "lldb/Core/StreamFile.h" #include "lldb/Host/FileSystem.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include @@ -37,8 +37,8 @@ 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(), - "Cannot open {1}: {0}", path); + LLDB_LOG_ERROR(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -42,8 +42,8 @@ #include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Flags.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" @@ -200,7 +200,7 @@ } bool ValueObject::UpdateFormatsIfNeeded() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Core/ValueObjectDynamicValue.cpp +++ b/lldb/source/Core/ValueObjectDynamicValue.cpp @@ -16,8 +16,8 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/Status.h" #include "lldb/lldb-types.h" @@ -201,7 +201,7 @@ Value old_value(m_value); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES)); bool has_changed_type = false; diff --git a/lldb/source/Core/ValueObjectRegister.cpp b/lldb/source/Core/ValueObjectRegister.cpp --- a/lldb/source/Core/ValueObjectRegister.cpp +++ b/lldb/source/Core/ValueObjectRegister.cpp @@ -18,7 +18,7 @@ #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" @@ -203,7 +203,7 @@ exe_module->GetTypeSystemForLanguage(eLanguageTypeC); if (auto err = type_system_or_err.takeError()) { LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TYPES), + LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_TYPES), std::move(err), "Unable to get CompilerType from TypeSystem"); } else { m_compiler_type = diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp --- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp +++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp @@ -12,8 +12,8 @@ #include "lldb/Core/ValueObject.h" #include "lldb/DataFormatters/TypeSynthetic.h" #include "lldb/Target/ExecutionContext.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "llvm/ADT/STLExtras.h" @@ -81,7 +81,7 @@ } size_t ValueObjectSynthetic::CalculateNumChildren(uint32_t max) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS); UpdateValueIfNeeded(); if (m_synthetic_children_count < UINT32_MAX) @@ -148,7 +148,7 @@ } bool ValueObjectSynthetic::UpdateValue() { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS); SetValueIsValid(false); m_error.Clear(); @@ -234,7 +234,7 @@ lldb::ValueObjectSP ValueObjectSynthetic::GetChildAtIndex(size_t idx, bool can_create) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS); LLDB_LOGF(log, "[ValueObjectSynthetic::GetChildAtIndex] name=%s, retrieving " diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -16,7 +16,7 @@ #include "lldb/DataFormatters/LanguageCategory.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Language.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace lldb; using namespace lldb_private; @@ -614,7 +614,7 @@ if (ImplSP retval_sp = GetCached(match_data)) return retval_sp; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); LLDB_LOGF(log, "[%s] Search failed. Giving language a chance.", __FUNCTION__); for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) { @@ -637,7 +637,7 @@ template ImplSP FormatManager::GetCached(FormattersMatchData &match_data) { ImplSP retval_sp; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/DataFormatters/TypeCategoryMap.cpp +++ b/lldb/source/DataFormatters/TypeCategoryMap.cpp @@ -9,8 +9,7 @@ #include "lldb/DataFormatters/TypeCategoryMap.h" #include "lldb/DataFormatters/FormatClasses.h" -#include "lldb/Utility/Log.h" - +#include "lldb/Utility/LLDBLog.h" using namespace lldb; using namespace lldb_private; @@ -174,7 +173,7 @@ ActiveCategoriesIterator begin, end = m_active_categories.end(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); if (log) { for (auto match : match_data.GetMatchesVector()) { diff --git a/lldb/source/DataFormatters/VectorType.cpp b/lldb/source/DataFormatters/VectorType.cpp --- a/lldb/source/DataFormatters/VectorType.cpp +++ b/lldb/source/DataFormatters/VectorType.cpp @@ -15,7 +15,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -16,7 +16,7 @@ #include "lldb/Core/Value.h" #include "lldb/Core/dwarf.h" #include "lldb/Utility/DataEncoder.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/StreamString.h" @@ -977,7 +977,7 @@ uint64_t op_piece_offset = 0; Value pieces; // Used for DW_OP_piece - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ llvm::Optional DWARFExpression::GetLocationExpression(addr_t load_function_start, addr_t addr) const { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); std::unique_ptr loctable_up = m_dwarf_cu->GetLocationTable(m_data); diff --git a/lldb/source/Expression/DiagnosticManager.cpp b/lldb/source/Expression/DiagnosticManager.cpp --- a/lldb/source/Expression/DiagnosticManager.cpp +++ b/lldb/source/Expression/DiagnosticManager.cpp @@ -10,7 +10,7 @@ #include "llvm/Support/ErrorHandling.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb_private; diff --git a/lldb/source/Expression/ExpressionVariable.cpp b/lldb/source/Expression/ExpressionVariable.cpp --- a/lldb/source/Expression/ExpressionVariable.cpp +++ b/lldb/source/Expression/ExpressionVariable.cpp @@ -9,7 +9,7 @@ #include "lldb/Expression/ExpressionVariable.h" #include "lldb/Expression/IRExecutionUnit.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace lldb_private; @@ -41,7 +41,7 @@ void PersistentExpressionState::RegisterExecutionUnit( lldb::IRExecutionUnitSP &execution_unit_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); m_execution_units.insert(execution_unit_sp); diff --git a/lldb/source/Expression/FunctionCaller.cpp b/lldb/source/Expression/FunctionCaller.cpp --- a/lldb/source/Expression/FunctionCaller.cpp +++ b/lldb/source/Expression/FunctionCaller.cpp @@ -24,7 +24,7 @@ #include "lldb/Target/ThreadPlan.h" #include "lldb/Target/ThreadPlanCallFunction.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" using namespace lldb_private; @@ -100,7 +100,7 @@ jit_file.GetFilename() = const_func_name; jit_module_sp->SetFileSpecAndObjectName(jit_file, ConstString()); m_jit_module_wp = jit_module_sp; - process->GetTarget().GetImages().Append(jit_module_sp, + process->GetTarget().GetImages().Append(jit_module_sp, true /* notify */); } } @@ -218,7 +218,7 @@ if (!WriteFunctionArguments(exe_ctx, args_addr_ref, diagnostic_manager)) return false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); LLDB_LOGF(log, "Call Address: 0x%" PRIx64 " Struct Address: 0x%" PRIx64 ".\n", m_jit_start_addr, args_addr_ref); @@ -229,7 +229,7 @@ ExecutionContext &exe_ctx, lldb::addr_t args_addr, const EvaluateExpressionOptions &options, DiagnosticManager &diagnostic_manager) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP)); LLDB_LOGF(log, @@ -269,7 +269,7 @@ // then use GetReturnValueObject // to fetch the value. That way we can fetch any values we need. - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP)); LLDB_LOGF(log, @@ -343,7 +343,7 @@ return lldb::eExpressionSetupError; } - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP)); LLDB_LOGF(log, diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp --- a/lldb/source/Expression/IRExecutionUnit.cpp +++ b/lldb/source/Expression/IRExecutionUnit.cpp @@ -32,7 +32,7 @@ #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/../../source/Plugins/ObjectFile/JIT/ObjectFileJIT.h" @@ -71,7 +71,7 @@ } if (Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { DataBufferHeap my_buffer(size, 0); Status err; ReadMemory(my_buffer.GetBytes(), allocation_process_addr, size, err); @@ -99,7 +99,7 @@ Status IRExecutionUnit::DisassembleFunction(Stream &stream, lldb::ProcessSP &process_wp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); ExecutionContext exe_ctx(process_wp); @@ -254,7 +254,7 @@ m_did_jit = true; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); std::string error_string; @@ -592,7 +592,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); uint8_t *return_value = m_default_mm_up->allocateCodeSection( Size, Alignment, SectionID, SectionName); @@ -622,7 +622,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); uint8_t *return_value = m_default_mm_up->allocateDataSection( Size, Alignment, SectionID, SectionName, IsReadOnly); @@ -882,7 +882,7 @@ void IRExecutionUnit::GetStaticInitializers( std::vector &static_initializers) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); llvm::GlobalVariable *global_ctors = m_module->getNamedGlobal("llvm.global_ctors"); @@ -929,13 +929,13 @@ } } -llvm::JITSymbol +llvm::JITSymbol IRExecutionUnit::MemoryManager::findSymbol(const std::string &Name) { bool missing_weak = false; uint64_t addr = GetSymbolAddressAndPresence(Name, missing_weak); // This is a weak symbol: - if (missing_weak) - return llvm::JITSymbol(addr, + if (missing_weak) + return llvm::JITSymbol(addr, llvm::JITSymbolFlags::Exported | llvm::JITSymbolFlags::Weak); else return llvm::JITSymbol(addr, llvm::JITSymbolFlags::Exported); @@ -947,10 +947,10 @@ return GetSymbolAddressAndPresence(Name, missing_weak); } -uint64_t +uint64_t IRExecutionUnit::MemoryManager::GetSymbolAddressAndPresence( const std::string &Name, bool &missing_weak) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); ConstString name_cs(Name.c_str()); @@ -977,7 +977,7 @@ lldb::addr_t IRExecutionUnit::GetRemoteAddressForLocal(lldb::addr_t local_address) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Expression/IRInterpreter.cpp +++ b/lldb/source/Expression/IRInterpreter.cpp @@ -16,7 +16,7 @@ #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -325,8 +325,7 @@ m_values[value] = data_address; - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (log) { LLDB_LOGF(log, "Made an allocation for argument %s", @@ -484,8 +483,7 @@ 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(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); bool saw_function_with_body = false; for (Function &f : module) { @@ -637,8 +635,7 @@ 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(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (log) { std::string s; diff --git a/lldb/source/Expression/IRMemoryMap.cpp b/lldb/source/Expression/IRMemoryMap.cpp --- a/lldb/source/Expression/IRMemoryMap.cpp +++ b/lldb/source/Expression/IRMemoryMap.cpp @@ -13,7 +13,7 @@ #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/Status.h" @@ -289,7 +289,7 @@ uint32_t permissions, AllocationPolicy policy, bool zero_memory, Status &error) { lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); error.Clear(); lldb::ProcessSP process_sp; @@ -477,7 +477,7 @@ } if (lldb_private::Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { LLDB_LOGF(log, "IRMemoryMap::Free (0x%" PRIx64 ") freed [0x%" PRIx64 "..0x%" PRIx64 ")", @@ -575,7 +575,7 @@ } if (lldb_private::Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { LLDB_LOGF(log, "IRMemoryMap::WriteMemory (0x%" PRIx64 ", 0x%" PRIxPTR ", 0x%" PRId64 ") went to [0x%" PRIx64 "..0x%" PRIx64 ")", @@ -705,7 +705,7 @@ } if (lldb_private::Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Expression/LLVMUserExpression.cpp +++ b/lldb/source/Expression/LLVMUserExpression.cpp @@ -30,7 +30,7 @@ #include "lldb/Target/ThreadPlan.h" #include "lldb/Target/ThreadPlanCallUserExpression.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb_private; @@ -67,7 +67,7 @@ // 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 | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP)); if (m_jit_start_addr == LLDB_INVALID_ADDRESS && !m_can_interpret) { @@ -231,7 +231,7 @@ eDiagnosticSeverityError, "Couldn't complete execution; the thread " "on which the expression was being run: 0x%" PRIx64 - " exited during its execution.", + " exited during its execution.", expr_thread_id); return execution_result; } else if (execution_result != lldb::eExpressionCompleted) { @@ -254,7 +254,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); LLDB_LOGF(log, "-- [UserExpression::FinalizeJITExecution] Dematerializing " "after execution --"); @@ -367,4 +367,3 @@ } return true; } - diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp --- a/lldb/source/Expression/Materializer.cpp +++ b/lldb/source/Expression/Materializer.cpp @@ -19,7 +19,7 @@ #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include @@ -58,7 +58,7 @@ } void MakeAllocation(IRMemoryMap &map, Status &err) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); // Allocate a spare memory area to store the persistent variable's // contents. @@ -138,7 +138,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; @@ -190,7 +190,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; @@ -425,7 +425,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; if (log) { @@ -594,7 +594,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; if (log) { @@ -1057,7 +1057,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; @@ -1106,7 +1106,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; @@ -1176,7 +1176,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; @@ -1239,7 +1239,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const lldb::addr_t load_addr = process_address + m_offset; @@ -1378,7 +1378,7 @@ } if (Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { LLDB_LOGF( log, "Materializer::Materialize (frame_sp = %p, process_address = 0x%" PRIx64 @@ -1416,7 +1416,7 @@ error.SetErrorString("Couldn't dematerialize: target is gone"); } else { if (Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) { + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Expression/UserExpression.cpp +++ b/lldb/source/Expression/UserExpression.cpp @@ -37,7 +37,7 @@ #include "lldb/Target/ThreadPlan.h" #include "lldb/Target/ThreadPlanCallUserExpression.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb_private; @@ -141,7 +141,7 @@ 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 | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP)); if (ctx_obj) { diff --git a/lldb/source/Expression/UtilityFunction.cpp b/lldb/source/Expression/UtilityFunction.cpp --- a/lldb/source/Expression/UtilityFunction.cpp +++ b/lldb/source/Expression/UtilityFunction.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" using namespace lldb_private; diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp --- a/lldb/source/Host/common/File.cpp +++ b/lldb/source/Host/common/File.cpp @@ -33,7 +33,7 @@ #include "lldb/Host/Host.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -58,7 +58,7 @@ #include "lldb/Host/posix/ConnectionFileDescriptorPosix.h" #include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Predicate.h" #include "lldb/Utility/ReproducerProvider.h" #include "lldb/Utility/Status.h" @@ -163,7 +163,7 @@ } static thread_result_t MonitorChildProcessThreadFunction(void *arg) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); const char *function = __FUNCTION__; LLDB_LOGF(log, "%s (arg = %p) thread starting...", function, arg); @@ -192,7 +192,7 @@ #endif // __linux__ while (true) { - log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); + log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); LLDB_LOGF(log, "%s ::waitpid (pid = %" PRIi32 ", &status, options = %i)...", function, pid, options); @@ -243,7 +243,7 @@ ScopedPThreadCancelDisabler pthread_cancel_disabler; #endif - log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); + log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); LLDB_LOGF(log, "%s ::waitpid (pid = %" PRIi32 ", &status, options = %i) => pid = %" PRIi32 @@ -277,7 +277,7 @@ } } - log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); + log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); LLDB_LOGF(log, "%s (arg = %p) thread exiting...", __FUNCTION__, arg); return nullptr; @@ -301,7 +301,7 @@ va_end(args); } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Host/common/HostInfoBase.cpp +++ b/lldb/source/Host/common/HostInfoBase.cpp @@ -13,7 +13,7 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Host/HostInfoBase.h" #include "lldb/Utility/ArchSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "llvm/ADT/StringExtras.h" @@ -119,7 +119,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); LLDB_LOG(log, "shlib dir -> `{0}`", g_fields->m_lldb_so_dir); }); return g_fields->m_lldb_so_dir; @@ -129,7 +129,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); LLDB_LOG(log, "header dir -> `{0}`", g_fields->m_lldb_headers_dir); }); return g_fields->m_lldb_headers_dir; @@ -149,7 +149,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); LLDB_LOG(log, "system plugin dir -> `{0}`", g_fields->m_lldb_system_plugin_dir); }); @@ -160,7 +160,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); LLDB_LOG(log, "process temp dir -> `{0}`", g_fields->m_lldb_process_tmp_dir); }); @@ -182,7 +182,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ bool HostInfoBase::ComputePathRelativeToLibrary(FileSpec &file_spec, llvm::StringRef dir) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Host/common/HostNativeThreadBase.cpp +++ b/lldb/source/Host/common/HostNativeThreadBase.cpp @@ -9,7 +9,7 @@ #include "lldb/Host/HostNativeThreadBase.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/ThreadLauncher.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/Threading.h" @@ -58,7 +58,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); LLDB_LOGF(log, "thread created"); delete info; diff --git a/lldb/source/Host/common/MonitoringProcessLauncher.cpp b/lldb/source/Host/common/MonitoringProcessLauncher.cpp --- a/lldb/source/Host/common/MonitoringProcessLauncher.cpp +++ b/lldb/source/Host/common/MonitoringProcessLauncher.cpp @@ -10,7 +10,7 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Host/HostProcess.h" #include "lldb/Host/ProcessLaunchInfo.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/Support/FileSystem.h" @@ -50,7 +50,7 @@ m_delegate_launcher->LaunchProcess(resolved_info, error); if (process.GetProcessId() != LLDB_INVALID_PROCESS_ID) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Host/common/NativeProcessProtocol.cpp +++ b/lldb/source/Host/common/NativeProcessProtocol.cpp @@ -12,7 +12,7 @@ #include "lldb/Host/common/NativeRegisterContext.h" #include "lldb/Host/common/NativeThreadProtocol.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "lldb/lldb-enumerations.h" @@ -74,7 +74,7 @@ bool NativeProcessProtocol::SetExitStatus(WaitStatus status, bool bNotifyStateChange) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOG(log, "status = {0}, notify = {1}", status, bNotifyStateChange); // Exit status already set @@ -128,7 +128,7 @@ llvm::Optional> NativeProcessProtocol::GetHardwareDebugSupportInfo() const { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); // get any thread NativeThreadProtocol *thread( @@ -152,7 +152,7 @@ // thread that is attached to via the (FIXME implement) OnThreadAttached () // method. - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); // Update the thread list UpdateThreads(); @@ -236,7 +236,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); // Update the thread list UpdateThreads(); @@ -308,7 +308,7 @@ void NativeProcessProtocol::SynchronouslyNotifyProcessStateChanged( lldb::StateType state) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); m_delegate.ProcessStateChanged(this, state); @@ -317,7 +317,7 @@ } void NativeProcessProtocol::NotifyDidExec() { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOG(log, "process {0} exec()ed", GetID()); m_delegate.DidExec(this); @@ -325,7 +325,7 @@ Status NativeProcessProtocol::SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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::RemoveSoftwareBreakpoint(lldb::addr_t addr) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 @@ llvm::Expected NativeProcessProtocol::EnableSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_BREAKPOINTS)); auto expected_trap = GetSoftwareBreakpointTrapOpcode(size_hint); if (!expected_trap) @@ -554,7 +554,7 @@ void NativeProcessProtocol::FixupBreakpointPCAsNeeded( NativeThreadProtocol &thread) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_BREAKPOINTS); Status error; diff --git a/lldb/source/Host/common/NativeRegisterContext.cpp b/lldb/source/Host/common/NativeRegisterContext.cpp --- a/lldb/source/Host/common/NativeRegisterContext.cpp +++ b/lldb/source/Host/common/NativeRegisterContext.cpp @@ -8,7 +8,7 @@ #include "lldb/Host/common/NativeRegisterContext.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Host/PosixApi.h" @@ -122,7 +122,7 @@ } lldb::addr_t NativeRegisterContext::GetPC(lldb::addr_t fail_value) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); uint32_t reg = ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC); @@ -197,7 +197,7 @@ uint64_t NativeRegisterContext::ReadRegisterAsUnsigned(const RegisterInfo *reg_info, lldb::addr_t fail_value) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); if (reg_info) { RegisterValue value; diff --git a/lldb/source/Host/common/NativeWatchpointList.cpp b/lldb/source/Host/common/NativeWatchpointList.cpp --- a/lldb/source/Host/common/NativeWatchpointList.cpp +++ b/lldb/source/Host/common/NativeWatchpointList.cpp @@ -8,7 +8,7 @@ #include "lldb/Host/common/NativeWatchpointList.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Host/common/ProcessLaunchInfo.cpp b/lldb/source/Host/common/ProcessLaunchInfo.cpp --- a/lldb/source/Host/common/ProcessLaunchInfo.cpp +++ b/lldb/source/Host/common/ProcessLaunchInfo.cpp @@ -13,7 +13,7 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/ProcessLaunchInfo.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "llvm/Support/ConvertUTF.h" @@ -183,7 +183,7 @@ } bool ProcessLaunchInfo::NoOpMonitorCallback(lldb::pid_t pid, bool exited, int signal, int status) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); LLDB_LOG(log, "pid = {0}, exited = {1}, signal = {2}, status = {3}", pid, exited, signal, status); return true; @@ -195,7 +195,7 @@ Host::StartMonitoringChildProcess(m_monitor_callback, GetProcessID(), m_monitor_signals); if (!maybe_thread) - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), "failed to launch host thread: {}", llvm::toString(maybe_thread.takeError())); return true; @@ -211,7 +211,7 @@ } llvm::Error ProcessLaunchInfo::SetUpPtyRedirection() { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Host/common/Socket.cpp +++ b/lldb/source/Host/common/Socket.cpp @@ -13,7 +13,7 @@ #include "lldb/Host/SocketAddress.h" #include "lldb/Host/common/TCPSocket.h" #include "lldb/Host/common/UDPSocket.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Errno.h" @@ -145,7 +145,7 @@ llvm::Expected> Socket::TcpConnect(llvm::StringRef host_and_port, bool child_processes_inherit) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION)); LLDB_LOG(log, "host_and_port = {0}", host_and_port); Status error; @@ -164,7 +164,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION)); LLDB_LOG(log, "host_and_port = {0}", host_and_port); std::unique_ptr listen_socket( @@ -224,7 +224,7 @@ } else num_bytes = bytes_received; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_COMMUNICATION)); if (log) { LLDB_LOGF(log, "%p Socket::Read() (socket = %" PRIu64 @@ -252,7 +252,7 @@ } else num_bytes = bytes_sent; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_COMMUNICATION)); if (log) { LLDB_LOGF(log, "%p Socket::Write() (socket = %" PRIu64 @@ -276,7 +276,7 @@ if (!IsValid() || !m_should_close_fd) return error; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 --- a/lldb/source/Host/common/TCPSocket.cpp +++ b/lldb/source/Host/common/TCPSocket.cpp @@ -14,7 +14,7 @@ #include "lldb/Host/Config.h" #include "lldb/Host/MainLoop.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/Config/llvm-config.h" #include "llvm/Support/Errno.h" @@ -148,7 +148,7 @@ Status TCPSocket::Connect(llvm::StringRef name) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_COMMUNICATION)); LLDB_LOGF(log, "TCPSocket::%s (host/port = %s)", __FUNCTION__, name.data()); Status error; @@ -184,7 +184,7 @@ } Status TCPSocket::Listen(llvm::StringRef name, int backlog) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION)); LLDB_LOGF(log, "TCPSocket::%s (%s)", __FUNCTION__, name.data()); Status error; diff --git a/lldb/source/Host/common/ThreadLauncher.cpp b/lldb/source/Host/common/ThreadLauncher.cpp --- a/lldb/source/Host/common/ThreadLauncher.cpp +++ b/lldb/source/Host/common/ThreadLauncher.cpp @@ -10,7 +10,7 @@ #include "lldb/Host/ThreadLauncher.h" #include "lldb/Host/HostNativeThread.h" #include "lldb/Host/HostThread.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #if defined(_WIN32) #include "lldb/Host/windows/windows.h" diff --git a/lldb/source/Host/common/UDPSocket.cpp b/lldb/source/Host/common/UDPSocket.cpp --- a/lldb/source/Host/common/UDPSocket.cpp +++ b/lldb/source/Host/common/UDPSocket.cpp @@ -9,7 +9,7 @@ #include "lldb/Host/common/UDPSocket.h" #include "lldb/Host/Config.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #if LLDB_ENABLE_POSIX #include @@ -54,7 +54,7 @@ UDPSocket::Connect(llvm::StringRef name, bool child_processes_inherit) { std::unique_ptr socket; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION)); LLDB_LOG(log, "host/port = {0}", name); Status error; diff --git a/lldb/source/Host/freebsd/Host.cpp b/lldb/source/Host/freebsd/Host.cpp --- a/lldb/source/Host/freebsd/Host.cpp +++ b/lldb/source/Host/freebsd/Host.cpp @@ -25,7 +25,7 @@ #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/NameMatches.h" #include "lldb/Utility/ProcessInfo.h" #include "lldb/Utility/Status.h" diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp --- a/lldb/source/Host/linux/Host.cpp +++ b/lldb/source/Host/linux/Host.cpp @@ -20,7 +20,7 @@ #include "llvm/Object/ELF.h" #include "llvm/Support/ScopedPrinter.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/ProcessInfo.h" #include "lldb/Utility/Status.h" @@ -56,7 +56,7 @@ static bool GetStatusInfo(::pid_t Pid, ProcessInstanceInfo &ProcessInfo, ProcessState &State, ::pid_t &TracerPid, ::pid_t &Tgid) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); auto BufferOrError = getProcFile(Pid, "status"); if (!BufferOrError) @@ -126,7 +126,7 @@ } static ArchSpec GetELFProcessCPUType(llvm::StringRef exe_path) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); auto buffer_sp = FileSystem::Instance().CreateDataBuffer(exe_path, 0x20, 0); if (!buffer_sp) @@ -165,7 +165,7 @@ } static void GetExePathAndArch(::pid_t pid, ProcessInstanceInfo &process_info) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Host/linux/HostInfoLinux.cpp +++ b/lldb/source/Host/linux/HostInfoLinux.cpp @@ -9,7 +9,7 @@ #include "lldb/Host/linux/HostInfoLinux.h" #include "lldb/Host/Config.h" #include "lldb/Host/FileSystem.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/Support/Threading.h" @@ -80,8 +80,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Host/linux/Support.cpp +++ b/lldb/source/Host/linux/Support.cpp @@ -7,12 +7,12 @@ //===----------------------------------------------------------------------===// #include "lldb/Host/linux/Support.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/Support/MemoryBuffer.h" llvm::ErrorOr> lldb_private::getProcFile(::pid_t pid, ::pid_t tid, const llvm::Twine &file) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); std::string File = ("/proc/" + llvm::Twine(pid) + "/task/" + llvm::Twine(tid) + "/" + file) .str(); @@ -24,7 +24,7 @@ llvm::ErrorOr> lldb_private::getProcFile(::pid_t pid, const llvm::Twine &file) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); std::string File = ("/proc/" + llvm::Twine(pid) + "/" + file).str(); auto Ret = llvm::MemoryBuffer::getFileAsStream(File); if (!Ret) @@ -34,7 +34,7 @@ llvm::ErrorOr> lldb_private::getProcFile(const llvm::Twine &file) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Host/macosx/objcxx/Host.mm +++ b/lldb/source/Host/macosx/objcxx/Host.mm @@ -61,7 +61,7 @@ #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/NameMatches.h" #include "lldb/Utility/ProcessInfo.h" #include "lldb/Utility/StreamString.h" @@ -322,7 +322,7 @@ uint32_t reserved2; // must be zero } BabelAESelInfo; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_HOST)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_HOST)); char file_path[PATH_MAX]; file_spec.GetPath(file_path, PATH_MAX); CFCString file_cfstr(file_path, kCFStringEncodingUTF8); @@ -721,7 +721,7 @@ static AuthorizationRef authorizationRef = NULL; static Status getXPCAuthorization(ProcessLaunchInfo &launch_info) { Status error; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST | + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST | LIBLLDB_LOG_PROCESS)); if ((launch_info.GetUserID() == 0) && !authorizationRef) { @@ -843,7 +843,7 @@ if (error.Fail()) return error; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST | + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST | LIBLLDB_LOG_PROCESS)); uid_t requested_uid = launch_info.GetUserID(); @@ -1053,7 +1053,7 @@ const ProcessLaunchInfo &launch_info, lldb::pid_t &pid) { Status error; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST | + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST | LIBLLDB_LOG_PROCESS)); posix_spawnattr_t attr; @@ -1436,7 +1436,7 @@ if (monitor_signals) mask |= DISPATCH_PROC_SIGNAL; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_HOST | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_HOST | LIBLLDB_LOG_PROCESS)); dispatch_source_t source = ::dispatch_source_create( diff --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm --- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm +++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm @@ -11,7 +11,7 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Host/macosx/HostInfoMacOSX.h" #include "lldb/Utility/Args.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Timer.h" #include "Utility/UuidCompatibility.h" @@ -144,7 +144,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); LLDB_LOGF(log, "HostInfoMacOSX::%s(): failed to find support directory", __FUNCTION__); return false; @@ -257,8 +257,8 @@ arch_32.SetArchitecture(eArchTypeMachO, cputype & ~(CPU_ARCH_MASK), cpusubtype32); - if (cputype == CPU_TYPE_ARM || - cputype == CPU_TYPE_ARM64 || + if (cputype == CPU_TYPE_ARM || + cputype == CPU_TYPE_ARM64 || cputype == CPU_TYPE_ARM64_32) { // When running on a watch or tv, report the host os correctly #if defined(TARGET_OS_TV) && TARGET_OS_TV == 1 @@ -443,7 +443,7 @@ if (!path.empty()) break; } - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Host/netbsd/HostNetBSD.cpp +++ b/lldb/source/Host/netbsd/HostNetBSD.cpp @@ -25,7 +25,7 @@ #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/NameMatches.h" #include "lldb/Utility/ProcessInfo.h" #include "lldb/Utility/Status.h" @@ -101,7 +101,7 @@ } static bool GetNetBSDProcessCPUType(ProcessInstanceInfo &process_info) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); if (process_info.ProcessIDIsValid()) { auto buffer_sp = FileSystem::Instance().CreateDataBuffer( diff --git a/lldb/source/Host/openbsd/Host.cpp b/lldb/source/Host/openbsd/Host.cpp --- a/lldb/source/Host/openbsd/Host.cpp +++ b/lldb/source/Host/openbsd/Host.cpp @@ -22,7 +22,7 @@ #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/NameMatches.h" #include "lldb/Utility/ProcessInfo.h" #include "lldb/Utility/Status.h" diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -43,7 +43,7 @@ #include "lldb/Host/Socket.h" #include "lldb/Host/common/TCPSocket.h" #include "lldb/Host/common/UDPSocket.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/Timer.h" @@ -54,7 +54,7 @@ : Connection(), m_pipe(), m_mutex(), m_shutting_down(false), m_child_processes_inherit(child_processes_inherit) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT)); LLDB_LOGF(log, "%p ConnectionFileDescriptor::ConnectionFileDescriptor ()", static_cast(this)); @@ -66,7 +66,7 @@ m_io_sp = std::make_shared(fd, File::eOpenOptionReadWrite, owns_fd); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT)); LLDB_LOGF(log, "%p ConnectionFileDescriptor::ConnectionFileDescriptor (fd = " @@ -82,7 +82,7 @@ } ConnectionFileDescriptor::~ConnectionFileDescriptor() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT)); LLDB_LOGF(log, "%p ConnectionFileDescriptor::~ConnectionFileDescriptor ()", static_cast(this)); @@ -93,7 +93,7 @@ void ConnectionFileDescriptor::OpenCommandPipe() { CloseCommandPipe(); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION)); // Make the command file descriptor here: Status result = m_pipe.CreateNew(m_child_processes_inherit); if (!result.Success()) { @@ -111,7 +111,7 @@ } void ConnectionFileDescriptor::CloseCommandPipe() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION)); LLDB_LOGF(log, "%p ConnectionFileDescriptor::CloseCommandPipe()", static_cast(this)); @@ -132,7 +132,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION)); LLDB_LOGF(log, "%p ConnectionFileDescriptor::Connect (url = '%s')", static_cast(this), path.str().c_str()); @@ -189,7 +189,7 @@ } ConnectionStatus ConnectionFileDescriptor::Disconnect(Status *error_ptr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION)); LLDB_LOGF(log, "%p ConnectionFileDescriptor::Disconnect ()", static_cast(this)); @@ -250,7 +250,7 @@ const Timeout &timeout, ConnectionStatus &status, Status *error_ptr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION)); std::unique_lock locker(m_mutex, std::defer_lock); if (!locker.try_lock()) { @@ -358,7 +358,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION)); LLDB_LOGF(log, "%p ConnectionFileDescriptor::Write (src = %p, src_len = %" PRIu64 ")", @@ -446,7 +446,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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,7 +656,7 @@ if (error_ptr) *error_ptr = socket.takeError(); else - LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION), socket.takeError(), "tcp connect failed: {0}"); return eConnectionStatusError; } diff --git a/lldb/source/Host/posix/HostInfoPosix.cpp b/lldb/source/Host/posix/HostInfoPosix.cpp --- a/lldb/source/Host/posix/HostInfoPosix.cpp +++ b/lldb/source/Host/posix/HostInfoPosix.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "lldb/Host/posix/HostInfoPosix.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/UserIDResolver.h" #include "llvm/ADT/SmallString.h" diff --git a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp --- a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp +++ b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp @@ -12,7 +12,7 @@ #include "lldb/Host/Pipe.h" #include "lldb/Host/ProcessLaunchInfo.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/Support/Errno.h" #include "llvm/Support/FileSystem.h" diff --git a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp --- a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp +++ b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "lldb/Host/windows/ConnectionGenericFileWindows.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/Timeout.h" @@ -90,7 +90,7 @@ lldb::ConnectionStatus ConnectionGenericFile::Connect(llvm::StringRef path, Status *error_ptr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION)); LLDB_LOGF(log, "%p ConnectionGenericFile::Connect (url = '%s')", static_cast(this), path.str().c_str()); @@ -132,7 +132,7 @@ } lldb::ConnectionStatus ConnectionGenericFile::Disconnect(Status *error_ptr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION)); LLDB_LOGF(log, "%p ConnectionGenericFile::Disconnect ()", static_cast(this)); @@ -244,7 +244,7 @@ ResetEvent(m_event_handles[kBytesAvailableEvent]); IncrementFilePointer(return_info.GetBytes()); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION)); LLDB_LOGF(log, "%p ConnectionGenericFile::Read() handle = %p, dst = %p, " "dst_len = %zu) => %zu, error = %s", @@ -293,7 +293,7 @@ *error_ptr = return_info.GetError(); IncrementFilePointer(return_info.GetBytes()); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_CONNECTION)); LLDB_LOGF(log, "%p ConnectionGenericFile::Write() handle = %p, src = %p, " "src_len = %zu) => %zu, error = %s", diff --git a/lldb/source/Host/windows/Host.cpp b/lldb/source/Host/windows/Host.cpp --- a/lldb/source/Host/windows/Host.cpp +++ b/lldb/source/Host/windows/Host.cpp @@ -16,7 +16,7 @@ #include "lldb/Host/ProcessLaunchInfo.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/ProcessInfo.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" diff --git a/lldb/source/Initialization/SystemInitializerCommon.cpp b/lldb/source/Initialization/SystemInitializerCommon.cpp --- a/lldb/source/Initialization/SystemInitializerCommon.cpp +++ b/lldb/source/Initialization/SystemInitializerCommon.cpp @@ -12,7 +12,7 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/Socket.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/ReproducerProvider.h" #include "lldb/Utility/Timer.h" #include "lldb/Version/Version.h" @@ -125,7 +125,7 @@ if (auto e = InitializeFileSystem()) return e; - Log::Initialize(); + LLDBLog::Initialize(); HostInfo::Initialize(m_shlib_dir_helper); llvm::Error error = Socket::Initialize(); diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -45,7 +45,7 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Reproducer.h" #include "lldb/Utility/State.h" #include "lldb/Utility/Stream.h" @@ -1825,7 +1825,7 @@ std::string command_string(command_line); std::string original_command_string(command_line); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMANDS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMANDS)); llvm::PrettyStackTraceFormat stack_trace("HandleCommand(command = \"%s\")", command_line); @@ -3122,7 +3122,7 @@ } auto error_out = [&](llvm::StringRef error_message, std::string description) { - LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMANDS), "{0} ({1}:{2})", + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMANDS), "{0} ({1}:{2})", error_message, output_file, description); result.AppendErrorWithFormatv( "Failed to save session's transcripts to {0}!", *output_file); diff --git a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp --- a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp +++ b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp @@ -23,7 +23,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/Status.h" @@ -62,7 +62,7 @@ if (!reg_ctx) return false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp +++ b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp @@ -23,7 +23,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/Status.h" @@ -65,7 +65,7 @@ if (!reg_ctx) return false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (log) { StreamString s; diff --git a/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp b/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp --- a/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp +++ b/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp @@ -25,7 +25,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" diff --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp --- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp +++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp @@ -25,7 +25,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" @@ -529,7 +529,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp +++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp @@ -25,7 +25,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" @@ -526,7 +526,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp +++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp @@ -25,7 +25,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" @@ -228,7 +228,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp +++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp @@ -28,7 +28,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" @@ -80,7 +80,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (log) { StreamString s; @@ -479,7 +479,7 @@ RegisterContext *m_reg_ctx; ByteOrder m_byte_order; Log *m_log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); }; Register GetGPR(uint32_t index) const { @@ -555,7 +555,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); RegisterContext *m_reg_ctx; ProcessSP m_process_sp; ByteOrder m_byte_order; @@ -934,7 +934,7 @@ auto exp_extractor = ReturnValueExtractor::Create(thread, type); if (!exp_extractor) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp +++ b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp @@ -25,7 +25,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" @@ -195,7 +195,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (log) { StreamString s; diff --git a/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp b/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp --- a/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp +++ b/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp @@ -24,7 +24,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" diff --git a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp --- a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp +++ b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp @@ -26,7 +26,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" @@ -107,7 +107,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp +++ b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp @@ -26,7 +26,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" @@ -123,7 +123,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (log) { StreamString s; diff --git a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp --- a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp +++ b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp @@ -16,7 +16,7 @@ #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" #include "lldb/Utility/ArchSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace lldb_private; using namespace lldb; @@ -71,7 +71,7 @@ lldb::addr_t ArchitectureMips::GetBreakableLoadAddress(lldb::addr_t addr, Target &target) const { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); Address resolved_addr; diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -36,7 +36,7 @@ #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/Stream.h" @@ -796,7 +796,7 @@ } if (Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)) { + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -25,7 +25,7 @@ #include "lldb/Target/ThreadPlanRunToAddress.h" #include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "DynamicLoaderDarwinKernel.h" @@ -434,7 +434,7 @@ DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress(lldb::addr_t addr, Process *process, bool *read_error) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); if (addr == LLDB_INVALID_ADDRESS) { if (read_error) *read_error = true; @@ -645,7 +645,7 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::ReadMemoryModule( Process *process) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); if (m_memory_module_sp.get() != nullptr) return true; if (m_load_address == LLDB_INVALID_ADDRESS) @@ -756,7 +756,7 @@ // 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); 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::BreakpointHit(StoppointCallbackContext *context, user_id_t break_id, user_id_t break_loc_id) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); LLDB_LOGF(log, "DynamicLoaderDarwinKernel::BreakpointHit (...)\n"); ReadAllKextSummaries(); @@ -1158,7 +1158,7 @@ bool DynamicLoaderDarwinKernel::ParseKextSummaries( const Address &kext_summary_addr, uint32_t count) { KextImageInfo::collection kext_summaries; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); LLDB_LOGF(log, "Kexts-changed breakpoint hit, there are %d kexts currently.\n", count); @@ -1514,7 +1514,7 @@ DynamicLoaderDarwinKernel::GetStepThroughTrampolinePlan(Thread &thread, bool stop_others) { ThreadPlanSP thread_plan_sp; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp @@ -16,7 +16,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanRunToAddress.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "DynamicLoaderHexagonDYLD.h" @@ -254,7 +254,7 @@ // Place a breakpoint on <_rtld_debug_state> bool DynamicLoaderHexagonDYLD::SetRendezvousBreakpoint() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); // 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::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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); LLDB_LOGF(log, "Rendezvous breakpoint hit!"); @@ -337,7 +337,7 @@ /// Helper method for RendezvousBreakpointHit. Updates LLDB's current set /// of loaded modules. void DynamicLoaderHexagonDYLD::RefreshModules() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); if (!m_rendezvous.Resolve()) return; @@ -457,7 +457,7 @@ ModuleList module_list; if (!m_rendezvous.Resolve()) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); LLDB_LOGF( log, "DynamicLoaderHexagonDYLD::%s unable to resolve rendezvous address", @@ -478,7 +478,7 @@ if (module_sp.get()) { module_list.Append(module_sp); } else { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); LLDB_LOGF(log, "DynamicLoaderHexagonDYLD::%s failed loading module %s at " "0x%" PRIx64, @@ -589,7 +589,7 @@ addr_t tls_block = ReadPointer(dtv_slot + metadata.tls_offset); Module *mod = module.get(); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); LLDB_LOGF(log, "DynamicLoaderHexagonDYLD::Performed TLS lookup: " "module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64 diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp @@ -11,7 +11,7 @@ #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "lldb/Symbol/ObjectFile.h" diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -28,7 +28,7 @@ #include "lldb/Target/ThreadPlanRunToAddress.h" #include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" @@ -166,7 +166,7 @@ if (m_process->GetStopID() == m_dyld_image_infos_stop_id) return; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); Target &target = m_process->GetTarget(); LLDB_LOGF(log, "Removing %" PRId64 " modules.", (uint64_t)solib_addresses.size()); @@ -209,7 +209,7 @@ } void DynamicLoaderDarwin::UnloadAllImages() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); ModuleList unloaded_modules_list; Target &target = m_process->GetTarget(); @@ -275,7 +275,7 @@ changed = m_process->GetTarget().SetSectionLoadAddress( section_sp, new_section_load_addr, warn_multiple); - } + } } } @@ -533,15 +533,15 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); ConstString g_dyld_sim_filename("dyld_sim"); ArchSpec target_arch = target.GetArchitecture(); const size_t image_infos_size = image_infos.size(); for (size_t i = 0; i < image_infos_size; i++) { if (image_infos[i].header.filetype == llvm::MachO::MH_DYLINKER) { - // In a "simulator" process we will have two dyld modules -- - // a "dyld" that we want to keep track of, and a "dyld_sim" which + // In a "simulator" process we will have two dyld modules -- + // a "dyld" that we want to keep track of, and a "dyld_sim" which // we don't need to keep track of here. dyld_sim will have a non-macosx // OS. if (target_arch.GetTriple().getEnvironment() == llvm::Triple::Simulator && @@ -550,7 +550,7 @@ } dyld_idx = i; - } + } if (image_infos[i].header.filetype == llvm::MachO::MH_EXECUTE) { exe_idx = i; } @@ -615,7 +615,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); Target &target = m_process->GetTarget(); ModuleList &target_images = target.GetImages(); @@ -649,7 +649,7 @@ module_spec.SetObjectOffset(objfile->GetFileOffset() + commpage_section->GetFileOffset()); module_spec.SetObjectSize(objfile->GetByteSize()); - commpage_image_module_sp = target.GetOrCreateModule(module_spec, + commpage_image_module_sp = target.GetOrCreateModule(module_spec, true /* notify */); if (!commpage_image_module_sp || commpage_image_module_sp->GetObjectFile() == nullptr) { @@ -850,7 +850,7 @@ const SymbolContext ¤t_context = current_frame->GetSymbolContext(eSymbolContextSymbol); Symbol *current_symbol = current_context.symbol; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); TargetSP target_sp(thread.CalculateTarget()); if (current_symbol != nullptr) { @@ -1134,7 +1134,7 @@ } bool DynamicLoaderDarwin::UseDYLDSPI(Process *process) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); 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 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -17,7 +17,7 @@ #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "DynamicLoaderDarwin.h" @@ -155,7 +155,7 @@ // (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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); // 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 @@ void DynamicLoaderMacOS::AddBinaries( const std::vector &load_addresses) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); 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 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -27,7 +27,7 @@ #include "lldb/Target/ThreadPlanRunToAddress.h" #include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" //#define ENABLE_DEBUG_PRINTF // COMMENT THIS LINE OUT PRIOR TO CHECKIN @@ -533,7 +533,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); LLDB_LOGF(log, "Adding %d modules.\n", image_infos_count); std::lock_guard guard(m_mutex); @@ -574,7 +574,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); std::lock_guard guard(m_mutex); std::lock_guard baseclass_guard(GetMutex()); @@ -698,7 +698,7 @@ // 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); 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 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp @@ -14,7 +14,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/ArchSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "llvm/Support/Path.h" @@ -34,7 +34,7 @@ } addr_t DYLDRendezvous::ResolveRendezvousAddress() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); addr_t info_location; addr_t info_addr; Status error; @@ -113,7 +113,7 @@ void DYLDRendezvous::UpdateExecutablePath() { if (m_process) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); Module *exe_mod = m_process->GetTarget().GetExecutableModulePointer(); if (exe_mod) { m_exe_file_spec = exe_mod->GetPlatformFileSpec(); @@ -129,7 +129,7 @@ } bool DYLDRendezvous::Resolve() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); 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 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -21,7 +21,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanRunToAddress.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/ProcessInfo.h" #include @@ -76,7 +76,7 @@ } void DynamicLoaderPOSIXDYLD::DidAttach() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); 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::DidLaunch() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s()", __FUNCTION__); ModuleSP executable; @@ -214,7 +214,7 @@ } void DynamicLoaderPOSIXDYLD::ProbeEntry() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); const addr_t entry = GetEntryPoint(); if (entry == LLDB_INVALID_ADDRESS) { @@ -257,7 +257,7 @@ if (!baton) return false; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); DynamicLoaderPOSIXDYLD *const dyld_instance = static_cast(baton); LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64, @@ -299,7 +299,7 @@ } bool DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); if (m_dyld_bid != LLDB_INVALID_BREAK_ID) { LLDB_LOG(log, "Rendezvous breakpoint breakpoint id {0} for pid {1}" @@ -387,7 +387,7 @@ if (!baton) return false; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); DynamicLoaderPOSIXDYLD *const dyld_instance = static_cast(baton); LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::%s called for pid %" PRIu64, @@ -539,7 +539,7 @@ MemoryRegionInfo info; Status status = m_process->GetMemoryRegionInfo(m_vdso_base, info); if (status.Fail()) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); LLDB_LOG(log, "Failed to get vdso region info: {0}", status); return; } @@ -560,7 +560,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); LLDB_LOG(log, "Failed to get interpreter region info: {0}", status); return nullptr; } @@ -568,7 +568,7 @@ FileSpec file(info.GetName().GetCString()); ModuleSpec module_spec(file, target.GetArchitecture()); - if (ModuleSP module_sp = target.GetOrCreateModule(module_spec, + if (ModuleSP module_sp = target.GetOrCreateModule(module_spec, true /* notify */)) { UpdateLoadedSections(module_sp, LLDB_INVALID_ADDRESS, m_interpreter_base, false); @@ -582,7 +582,7 @@ DYLDRendezvous::iterator I; DYLDRendezvous::iterator E; ModuleList module_list; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); LoadVDSO(); @@ -613,7 +613,7 @@ I->file_spec.GetFilename()); module_list.Append(module_sp); } else { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); LLDB_LOGF( log, "DynamicLoaderPOSIXDYLD::%s failed loading module %s at 0x%" PRIx64, @@ -722,7 +722,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); LLDB_LOGF(log, "DynamicLoaderPOSIXDYLD::Performed TLS lookup: " "module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64 @@ -738,7 +738,7 @@ void DynamicLoaderPOSIXDYLD::ResolveExecutableModule( lldb::ModuleSP &module_sp) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); 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 --- a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp @@ -16,7 +16,7 @@ #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Target.h" #include "lldb/Target/ThreadPlanStepInstruction.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/ADT/Triple.h" @@ -65,8 +65,8 @@ // Resolve the module unless we already have one. if (!module_sp) { Status error; - module_sp = m_process->GetTarget().GetOrCreateModule(module_spec, - true /* notify */, &error); + module_sp = m_process->GetTarget().GetOrCreateModule( + module_spec, true /* notify */, &error); if (error.Fail()) return; } @@ -117,37 +117,37 @@ } void DynamicLoaderWindowsDYLD::DidAttach() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); - LLDB_LOGF(log, "DynamicLoaderWindowsDYLD::%s()", __FUNCTION__); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); 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 --- a/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp @@ -14,7 +14,7 @@ #include "lldb/Core/Section.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace lldb; using namespace lldb_private; @@ -51,7 +51,7 @@ } void DynamicLoaderWasmDYLD::DidAttach() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); 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 --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -14,7 +14,7 @@ #include "Plugins/TypeSystem/Clang/TypeSystemClang.h" #include "lldb/Target/Target.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" @@ -53,7 +53,7 @@ } void ASTResultSynthesizer::TransformTopLevelDecl(Decl *D) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (NamedDecl *named_decl = dyn_cast(D)) { if (log && log->GetVerbose()) { @@ -112,7 +112,7 @@ } bool ASTResultSynthesizer::SynthesizeFunctionResult(FunctionDecl *FunDecl) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (!m_sema) return false; @@ -154,7 +154,7 @@ bool ASTResultSynthesizer::SynthesizeObjCMethodResult( ObjCMethodDecl *MethodDecl) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (!m_sema) return false; @@ -198,7 +198,7 @@ bool ASTResultSynthesizer::SynthesizeBodyResult(CompoundStmt *Body, DeclContext *DC) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); ASTContext &Ctx(*m_ast_context); @@ -407,7 +407,7 @@ if (name.size() == 0 || name[0] != '$') return; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); ConstString name_cs(name.str().c_str()); @@ -427,7 +427,7 @@ if (name.size() == 0) return; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); ConstString name_cs(name.str().c_str()); @@ -455,7 +455,7 @@ &scratch_ctx->getASTContext(), decl); if (!D_scratch) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (log) { std::string s; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp @@ -8,7 +8,7 @@ #include "ASTStructExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp @@ -8,7 +8,7 @@ #include "lldb/Core/Module.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclObjC.h" @@ -50,7 +50,7 @@ llvm::Expected ret_or_error = delegate_sp->Import(src_qual_type); if (!ret_or_error) { Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); LLDB_LOG_ERROR(log, ret_or_error.takeError(), "Couldn't import type: {0}"); return CompilerType(); @@ -77,7 +77,7 @@ llvm::Expected result = delegate_sp->Import(decl); if (!result) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 +170,7 @@ void Override(clang::Decl *decl) { if (clang::Decl *escaped_child = GetEscapedChild(decl)) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); LLDB_LOG(log, " [ClangASTImporter] DeclContextOverride couldn't " @@ -303,7 +303,7 @@ CompilerType ClangASTImporter::DeportType(TypeSystemClang &dst, const CompilerType &src_type) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); TypeSystemClang *src_ctxt = llvm::cast(src_type.GetTypeSystem()); @@ -326,7 +326,7 @@ clang::Decl *ClangASTImporter::DeportDecl(clang::ASTContext *dst_ctx, clang::Decl *decl) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); clang::ASTContext *src_ctx = &decl->getASTContext(); LLDB_LOG(log, @@ -615,7 +615,7 @@ if (!RequireCompleteType(type)) return false; - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); if (const TagType *tag_type = type->getAs()) { TagDecl *tag_decl = tag_type->getDecl(); @@ -779,7 +779,7 @@ } void ClangASTImporter::ForgetDestination(clang::ASTContext *dst_ast) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); LLDB_LOG(log, " [ClangASTImporter] Forgetting destination (ASTContext*){0}", @@ -792,7 +792,7 @@ clang::ASTContext *src_ast) { ASTContextMetadataSP md = MaybeGetContextMetadata(dst_ast); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); LLDB_LOG(log, " [ClangASTImporter] Forgetting source->dest " @@ -865,7 +865,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); LLDB_LOG(log, "[ClangASTImporter] Searching for a complete definition of {0} in " "other modules", @@ -903,7 +903,7 @@ MapImported(from, to); ASTImporter::Imported(from, to); - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); if (llvm::Error err = ImportDefinition(from)) { LLDB_LOG_ERROR(log, std::move(err), @@ -916,7 +916,7 @@ to_tag->setCompleteDefinition(from_tag->isCompleteDefinition()); if (Log *log_ast = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST)) { + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST)) { std::string name_string; if (NamedDecl *from_named_decl = dyn_cast(from)) { llvm::raw_string_ostream name_stream(name_string); @@ -1023,7 +1023,7 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from, clang::Decl *to) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -18,7 +18,7 @@ #include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/TaggedASTType.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "clang/AST/ASTContext.h" #include "clang/AST/RecordLayout.h" #include "clang/Basic/SourceManager.h" @@ -183,7 +183,7 @@ } TagDecl *ClangASTSource::FindCompleteType(const TagDecl *decl) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (const NamespaceDecl *namespace_context = dyn_cast(decl->getDeclContext())) { @@ -278,7 +278,7 @@ } void ClangASTSource::CompleteType(TagDecl *tag_decl) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (log) { LLDB_LOG(log, @@ -307,7 +307,7 @@ } void ClangASTSource::CompleteType(clang::ObjCInterfaceDecl *interface_decl) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); LLDB_LOG(log, " [CompleteObjCInterfaceDecl] on (ASTContext*){0} '{1}' " @@ -387,7 +387,7 @@ llvm::function_ref predicate, llvm::SmallVectorImpl &decls) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const Decl *context_decl = dyn_cast(decl_context); @@ -520,7 +520,7 @@ const ConstString name(context.m_decl_name.getAsString().c_str()); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (log) { if (!context.m_decl_context) @@ -597,7 +597,7 @@ CompilerDeclContext &namespace_decl) { assert(m_ast_context); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); SymbolContextList sc_list; @@ -668,7 +668,7 @@ if (IgnoreName(name, true)) return; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (module_sp && namespace_decl) { CompilerDeclContext found_namespace_decl; @@ -833,7 +833,7 @@ if (!copied_method_decl) continue; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); LLDB_LOG(log, " CAS::FOMD found ({0}) {1}", log_info, ClangUtil::DumpDecl(copied_method_decl)); @@ -846,7 +846,7 @@ void ClangASTSource::FindDeclInModules(NameSearchContext &context, ConstString name) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); std::shared_ptr modules_decl_vendor = GetClangModulesDeclVendor(); @@ -886,7 +886,7 @@ void ClangASTSource::FindDeclInObjCRuntime(NameSearchContext &context, ConstString name) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); lldb::ProcessSP process(m_target->GetProcessSP()); @@ -928,7 +928,7 @@ } void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const DeclarationName &decl_name(context.m_decl_name); const DeclContext *decl_ctx(context.m_decl_context); @@ -1208,7 +1208,7 @@ static bool FindObjCPropertyAndIvarDeclsWithOrigin( NameSearchContext &context, ClangASTSource &source, DeclFromUser &origin_iface_decl) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (origin_iface_decl.IsInvalid()) return false; @@ -1255,7 +1255,7 @@ } void ClangASTSource::FindObjCPropertyAndIvarDecls(NameSearchContext &context) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); DeclFromParser parser_iface_decl( cast(context.m_decl_context)); @@ -1391,7 +1391,7 @@ const NamespaceDecl *namespace_context = dyn_cast(context.m_decl_context); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); ClangASTImporter::NamespaceMapSP namespace_map = m_ast_importer_sp->GetNamespaceMap(namespace_context); @@ -1498,7 +1498,7 @@ BaseOffsetMap &base_offsets, BaseOffsetMap &virtual_base_offsets) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); LLDB_LOG(log, "LayoutRecordType on (ASTContext*){0} '{1}' for (RecordDecl*)" @@ -1620,7 +1620,7 @@ ClangASTImporter::NamespaceMapSP &namespace_map, ConstString name, ClangASTImporter::NamespaceMapSP &parent_map) const { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -40,7 +40,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" #include "lldb/lldb-private.h" @@ -252,7 +252,7 @@ return true; } - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx; Target *target = exe_ctx.GetTargetPtr(); if (target == nullptr) @@ -328,7 +328,7 @@ bool is_persistent_variable = false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); m_struct_vars->m_struct_laid_out = false; @@ -646,7 +646,7 @@ const ConstString name(context.m_decl_name.getAsString().c_str()); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (log) { if (!context.m_decl_context) @@ -728,7 +728,7 @@ void ClangExpressionDeclMap::SearchPersistenDecls(NameSearchContext &context, const ConstString name) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); NamedDecl *persistent_decl = GetPersistentDecl(name); @@ -756,7 +756,7 @@ } void ClangExpressionDeclMap::LookUpLldbClass(NameSearchContext &context) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); SymbolContext sym_ctx; @@ -857,7 +857,7 @@ } void ClangExpressionDeclMap::LookUpLldbObjCClass(NameSearchContext &context) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); @@ -1014,7 +1014,7 @@ void ClangExpressionDeclMap::LookupInModulesDeclVendor( NameSearchContext &context, ConstString name) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (!m_target) return; @@ -1331,7 +1331,7 @@ const CompilerDeclContext &namespace_decl) { assert(m_ast_context); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); const ConstString name(context.m_decl_name.getAsString().c_str()); if (IgnoreName(name, false)) @@ -1460,7 +1460,7 @@ lldb_private::Value &var_location, TypeFromUser *user_type, TypeFromParser *parser_type) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); Type *var_type = var->GetType(); @@ -1546,7 +1546,7 @@ ValueObjectSP valobj) { assert(m_parser_vars.get()); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); TypeFromUser ut; TypeFromParser pt; @@ -1600,7 +1600,7 @@ void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context, ExpressionVariableSP &pvar_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); TypeFromUser user_type( llvm::cast(pvar_sp.get())->GetTypeFromUser()); @@ -1633,7 +1633,7 @@ const Symbol &symbol) { assert(m_parser_vars.get()); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); @@ -1683,7 +1683,7 @@ void ClangExpressionDeclMap::AddOneRegister(NameSearchContext &context, const RegisterInfo *reg_info) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); CompilerType clang_type = m_clang_ast_context->GetBuiltinTypeForEncodingAndBitSize( @@ -1725,7 +1725,7 @@ Symbol *symbol) { assert(m_parser_vars.get()); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); NamedDecl *function_decl = nullptr; Address fun_address; @@ -1895,7 +1895,7 @@ const TypeFromUser &ut) { CompilerType copied_clang_type = GuardedCopyType(ut); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (!copied_clang_type) { LLDB_LOG(log, @@ -1961,7 +1961,7 @@ CompilerType copied_clang_type = GuardedCopyType(ut); if (!copied_clang_type) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -84,7 +84,7 @@ #include "lldb/Target/ThreadPlanCallFunction.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/ReproducerProvider.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" @@ -189,7 +189,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (log) { llvm::SmallVector diag_str; Info.FormatDiagnostic(diag_str); @@ -282,7 +282,7 @@ static void SetupModuleHeaderPaths(CompilerInstance *compiler, std::vector include_directories, lldb::TargetSP target_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); HeaderSearchOptions &search_opts = compiler->getHeaderSearchOpts(); @@ -364,7 +364,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); lldb_private::Status err; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp @@ -37,7 +37,7 @@ #include "lldb/Target/ThreadPlan.h" #include "lldb/Target/ThreadPlanCallFunction.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" using namespace lldb_private; @@ -180,7 +180,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp @@ -20,7 +20,7 @@ #include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include @@ -29,7 +29,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); LLDB_LOGF(log, "VerifyClangPath(): " "failed to stat clang resource directory at \"%s\"", @@ -47,7 +47,7 @@ static bool DefaultComputeClangResourceDirectory(FileSpec &lldb_shlib_spec, FileSpec &file_spec, bool verify) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); std::string raw_path = lldb_shlib_spec.GetPath(); llvm::StringRef parent_dir = llvm::sys::path::parent_path(raw_path); @@ -157,7 +157,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp @@ -32,7 +32,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/ReproducerProvider.h" #include "lldb/Utility/StreamString.h" @@ -130,7 +130,7 @@ } // anonymous namespace StoringDiagnosticConsumer::StoringDiagnosticConsumer() { - m_log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + m_log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); clang::DiagnosticOptions *m_options = new clang::DiagnosticOptions(); m_os = std::make_shared(m_output); @@ -656,7 +656,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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/ClangPersistentVariables.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp @@ -14,7 +14,7 @@ #include "lldb/Core/Value.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "clang/AST/Decl.h" diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp @@ -49,7 +49,7 @@ #include "lldb/Target/ThreadPlan.h" #include "lldb/Target/ThreadPlanCallUserExpression.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "clang/AST/DeclCXX.h" @@ -89,7 +89,7 @@ ClangUserExpression::~ClangUserExpression() = default; void ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Status &err) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); LLDB_LOGF(log, "ClangUserExpression::ScanContext()"); @@ -456,14 +456,14 @@ /// 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); // Don't do anything if this is not a C++ module configuration. if (!SupportsCxxModuleImport(language)) @@ -621,7 +621,7 @@ } void ClangUserExpression::SetupCppModuleImports(ExecutionContext &exe_ctx) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); CppModuleConfiguration module_config = GetModuleConfig(m_language, exe_ctx); m_imported_cpp_modules = module_config.GetImportedModules(); @@ -647,7 +647,7 @@ lldb_private::ExecutionPolicy execution_policy, bool keep_result_in_memory, bool generate_debug_info) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (!PrepareForParsing(diagnostic_manager, exe_ctx, /*for_completion*/ false)) return false; @@ -806,7 +806,7 @@ bool ClangUserExpression::Complete(ExecutionContext &exe_ctx, CompletionRequest &request, unsigned complete_pos) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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/ClangUtilityFunction.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp @@ -23,7 +23,7 @@ #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Target.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" using namespace lldb_private; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp @@ -9,7 +9,7 @@ #include "Plugins/ExpressionParser/Clang/CxxModuleHandler.h" #include "Plugins/TypeSystem/Clang/TypeSystemClang.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "clang/Sema/Lookup.h" #include "llvm/Support/Error.h" @@ -180,7 +180,7 @@ } llvm::Optional CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp @@ -22,7 +22,7 @@ #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" @@ -316,7 +316,7 @@ protected: bool InstrumentInstruction(llvm::Instruction *inst) override { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); LLDB_LOGF(log, "Instrumenting load/store instruction: %s\n", PrintValue(inst).c_str()); @@ -467,7 +467,7 @@ } bool InspectInstruction(llvm::Instruction &i) override { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); CallInst *call_inst = dyn_cast(&i); @@ -538,7 +538,7 @@ IRDynamicChecks::~IRDynamicChecks() = default; bool IRDynamicChecks::runOnModule(llvm::Module &M) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -34,7 +34,7 @@ #include "lldb/Utility/ConstString.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/StreamString.h" @@ -158,8 +158,7 @@ } bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (!m_resolve_vars) return true; @@ -399,8 +398,7 @@ bool IRForTarget::RewriteObjCConstString(llvm::GlobalVariable *ns_str, llvm::GlobalVariable *cstr) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); Type *ns_str_ty = ns_str->getType(); @@ -416,7 +414,7 @@ bool missing_weak = false; CFStringCreateWithBytes_addr = - m_execution_unit.FindSymbol(g_CFStringCreateWithBytes_str, + m_execution_unit.FindSymbol(g_CFStringCreateWithBytes_str, missing_weak); if (CFStringCreateWithBytes_addr == LLDB_INVALID_ADDRESS || missing_weak) { LLDB_LOG(log, "Couldn't find CFStringCreateWithBytes in the target"); @@ -537,8 +535,7 @@ } bool IRForTarget::RewriteObjCConstStrings() { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); ValueSymbolTable &value_symbol_table = m_module->getValueSymbolTable(); @@ -750,8 +747,7 @@ // 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(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); LoadInst *load = dyn_cast(selector_load); @@ -877,8 +873,7 @@ } bool IRForTarget::RewriteObjCSelectors(BasicBlock &basic_block) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); InstrList selector_loads; @@ -912,8 +907,7 @@ // 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(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); LoadInst *load = dyn_cast(class_load); @@ -1029,8 +1023,7 @@ } bool IRForTarget::RewriteObjCClassReferences(BasicBlock &basic_block) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); InstrList class_loads; @@ -1057,8 +1050,7 @@ // 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(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); AllocaInst *alloc = dyn_cast(persistent_alloc); @@ -1129,8 +1121,7 @@ if (!m_resolve_vars) return true; - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); InstrList pvar_allocs; @@ -1171,8 +1162,7 @@ // 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(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); LLDB_LOG(log, "MaybeHandleVariable ({0})", PrintValue(llvm_value_ptr)); @@ -1266,8 +1256,7 @@ // 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(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); lldb_private::ConstString name(symbol->getName().str().c_str()); @@ -1298,8 +1287,7 @@ } bool IRForTarget::MaybeHandleCallArguments(CallInst *Old) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); LLDB_LOG(log, "MaybeHandleCallArguments({0})", PrintValue(Old)); @@ -1317,8 +1305,7 @@ } bool IRForTarget::HandleObjCClass(Value *classlist_reference) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); GlobalVariable *global_variable = dyn_cast(classlist_reference); @@ -1419,8 +1406,7 @@ } bool IRForTarget::ResolveExternals(Function &llvm_function) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); for (GlobalVariable &global_var : m_module->globals()) { llvm::StringRef global_name = global_var.getName(); @@ -1638,8 +1624,7 @@ if (!m_resolve_vars) return true; - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); m_decl_map->DoStructLayout(); @@ -1827,8 +1812,7 @@ } bool IRForTarget::runOnModule(Module &llvm_module) { - lldb_private::Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + lldb_private::Log *log(lldb_private::LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ExpressionParser/Clang/NameSearchContext.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/NameSearchContext.cpp @@ -106,7 +106,7 @@ func_decl->setParams(ArrayRef(parm_var_decls)); } else { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); LLDB_LOG(log, "Function type wasn't a FunctionProtoType"); } diff --git a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h --- a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h +++ b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h @@ -11,7 +11,7 @@ #include "lldb/Core/EmulateInstruction.h" #include "lldb/Interpreter/OptionValue.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" namespace lldb_private { diff --git a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp --- a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp +++ b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp @@ -210,7 +210,7 @@ if (rt != gpr_r0_ppc64le || spr != SPR_LR) return false; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); LLDB_LOG(log, "EmulateMFSPR: {0:X+8}: mfspr r0, lr", m_addr); bool success; @@ -237,7 +237,7 @@ if (ra != gpr_r1_ppc64le || rt != gpr_r1_ppc64le || ids != 0) return false; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ return false; int32_t ids = llvm::SignExtend32<16>(ds << 2); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ (ra != gpr_r30_ppc64le && ra != gpr_r31_ppc64le) || rb != gpr_r1_ppc64le) return false; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); LLDB_LOG(log, "EmulateOR: {0:X+8}: mr r{1}, r{2}", m_addr, ra, rb); // set context @@ -366,7 +366,7 @@ return false; int32_t si_val = llvm::SignExtend32<16>(si); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp +++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp @@ -23,7 +23,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "llvm/Support/MathExtras.h" @@ -186,7 +186,7 @@ if (DidSetJITBreakpoint()) return; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_JIT_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_JIT_LOADER)); LLDB_LOGF(log, "JITLoaderGDB::%s looking for JIT register hook", __FUNCTION__); @@ -218,7 +218,7 @@ StoppointCallbackContext *context, user_id_t break_id, user_id_t break_loc_id) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_JIT_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_JIT_LOADER)); LLDB_LOGF(log, "JITLoaderGDB::%s hit JIT breakpoint", __FUNCTION__); JITLoaderGDB *instance = static_cast(baton); return instance->ReadJITDescriptor(false); @@ -282,7 +282,7 @@ if (m_jit_descriptor_addr == LLDB_INVALID_ADDRESS) return false; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_JIT_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_JIT_LOADER)); 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 --- a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp @@ -17,7 +17,7 @@ #include "lldb/Symbol/TypeSystem.h" #include "lldb/Target/Target.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace lldb; using namespace lldb_private; @@ -44,7 +44,7 @@ lldb::eLanguageTypeC_plus_plus); if (auto err = type_system_or_err.takeError()) { LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS), + LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -29,7 +29,7 @@ #include "lldb/DataFormatters/VectorType.h" #include "lldb/Symbol/SymbolFile.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegularExpression.h" #include "BlockPointer.h" @@ -337,7 +337,7 @@ } ConstString substituteImpl(llvm::StringRef Mangled) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp +++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp @@ -426,7 +426,7 @@ if (!process_sp) return false; - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS); ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp); if (!runtime) diff --git a/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp b/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp --- a/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp +++ b/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp @@ -9,7 +9,7 @@ #include "CoreMedia.h" #include "lldb/Utility/Flags.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Symbol/TypeSystem.h" #include "lldb/Target/Target.h" diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -31,7 +31,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/Status.h" @@ -77,7 +77,7 @@ symbol->GetMangled().GetDemangledName().AsCString(); if (name && strstr(name, vtable_demangled_prefix) == name) { Log *log( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); LLDB_LOGF(log, "0x%16.16" PRIx64 ": static-type = '%s' has vtable symbol '%s'\n", @@ -89,7 +89,7 @@ // prefixing it with the root namespace: std::string lookup_name("::"); lookup_name.append(class_name); - + type_info.SetName(class_name); const bool exact_match = true; TypeList class_types; diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp @@ -10,7 +10,7 @@ #include "lldb/Expression/FunctionCaller.h" #include "lldb/Target/ABI.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace lldb; using namespace lldb_private; @@ -542,7 +542,7 @@ if (m_filled) return; std::lock_guard guard(m_mutex); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES)); 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 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp @@ -14,7 +14,7 @@ #include "lldb/Core/Module.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclObjC.h" @@ -31,7 +31,7 @@ bool FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx, clang::DeclarationName name) override { - Log *log(GetLogIfAllCategoriesSet( + Log *log(LLDBLog::GetLogIfAllCategoriesSet( LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? if (log) { @@ -68,7 +68,7 @@ void CompleteType(clang::TagDecl *tag_decl) override { - Log *log(GetLogIfAllCategoriesSet( + Log *log(LLDBLog::GetLogIfAllCategoriesSet( LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? LLDB_LOGF(log, @@ -84,7 +84,7 @@ void CompleteType(clang::ObjCInterfaceDecl *interface_decl) override { - Log *log(GetLogIfAllCategoriesSet( + Log *log(LLDBLog::GetLogIfAllCategoriesSet( LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? if (log) { @@ -394,7 +394,7 @@ }; bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) { - Log *log(GetLogIfAllCategoriesSet( + Log *log(LLDBLog::GetLogIfAllCategoriesSet( LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? ClangASTMetadata *metadata = m_ast_ctx.GetMetadata(interface_decl); @@ -525,7 +525,7 @@ uint32_t max_matches, std::vector &decls) { - Log *log(GetLogIfAllCategoriesSet( + Log *log(LLDBLog::GetLogIfAllCategoriesSet( LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel? LLDB_LOGF(log, "AppleObjCDeclVendor::FindDecls ('%s', %s, %u, )", diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -31,7 +31,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -504,7 +504,7 @@ /// GetBacktraceThreadFromException. LLVM_NODISCARD static ThreadSP FailExceptionParsing(llvm::StringRef msg) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp @@ -25,7 +25,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -318,7 +318,7 @@ // map, whether it was successful or not. m_isa_to_descriptor_stop_id = process->GetStopID(); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -48,7 +48,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" @@ -1466,7 +1466,7 @@ objc_class_sp = GetClassDescriptorFromISA(isa); if (isa && !objc_class_sp) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); LLDB_LOGF(log, "0x%" PRIx64 ": AppleObjCRuntimeV2::GetClassDescriptor() ISA was " "not in class descriptor cache 0x%" PRIx64, @@ -1538,7 +1538,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); LLDB_LOG(log, "Creating utility function {0}", name); @@ -1643,7 +1643,7 @@ std::unique_ptr AppleObjCRuntimeV2::SharedCacheClassInfoExtractor:: GetClassInfoUtilityFunctionImpl(ExecutionContext &exe_ctx) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); LLDB_LOG(log, "Creating utility function {0}", g_get_shared_cache_class_info_name); @@ -1746,7 +1746,7 @@ uint32_t num_class_infos = 0; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); ExecutionContext exe_ctx; @@ -1822,7 +1822,7 @@ // Only dump the runtime classes from the expression evaluation if the log is // verbose: - Log *type_log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES); + Log *type_log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES); bool dump_log = type_log && type_log->GetVerbose(); arguments.GetValueAtIndex(3)->GetScalar() = dump_log ? 1 : 0; @@ -1902,7 +1902,7 @@ // uint32_t hash; // } __attribute__((__packed__)); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES)); bool should_log = log && log->GetVerbose(); uint32_t num_parsed = 0; @@ -1975,7 +1975,7 @@ if (process == nullptr) return DescriptorMapUpdateResult::Fail(); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); ExecutionContext exe_ctx; @@ -2055,7 +2055,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES); bool dump_log = type_log && type_log->GetVerbose(); arguments.GetValueAtIndex(5)->GetScalar() = dump_log ? 1 : 0; @@ -2213,7 +2213,7 @@ void AppleObjCRuntimeV2::UpdateISAToDescriptorMapIfNeeded() { LLDB_SCOPED_TIMER(); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); // Else we need to check with our process to see when the map was updated. Process *process = GetProcess(); @@ -2300,7 +2300,7 @@ objc_debug_realized_class_generation_count) return false; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); LLDB_LOG(log, "objc_debug_realized_class_generation_count changed from {0} to {1}", m_realized_class_generation_count, @@ -2428,7 +2428,7 @@ Status error; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES)); auto objc_debug_isa_magic_mask = ExtractRuntimeGlobalSymbol( process, ConstString("objc_debug_isa_magic_mask"), objc_module_sp, error); @@ -2858,7 +2858,7 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA( ObjCISA isa, ObjCISA &ret_isa) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES)); 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 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -29,7 +29,7 @@ #include "lldb/Target/ThreadPlanRunToAddress.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/ADT/STLExtras.h" @@ -575,7 +575,7 @@ if (!process_sp) return false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); // We aren't starting at the trampoline symbol. InitializeVTableSymbols(); @@ -655,8 +655,8 @@ // This is the table of ObjC "accelerated dispatch" functions. They are a set // of objc methods that are "seldom overridden" and so the compiler replaces the // objc_msgSend with a call to one of the dispatch functions. That will check -// whether the method has been overridden, and directly call the Foundation -// implementation if not. +// whether the method has been overridden, and directly call the Foundation +// implementation if not. // This table is supposed to be complete. If ones get added in the future, we // will have to add them to the table. const char *AppleObjCTrampolineHandler::g_opt_dispatch_names[] = { @@ -767,7 +767,7 @@ m_msgSend_map.insert(std::pair(sym_addr, i)); } } - + // Similarly, cache the addresses of the "optimized dispatch" function. for (size_t i = 0; i != llvm::array_lengthof(g_opt_dispatch_names); i++) { ConstString name_const_str(g_opt_dispatch_names[i]); @@ -794,7 +794,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); lldb::addr_t args_addr = LLDB_INVALID_ADDRESS; FunctionCaller *impl_function_caller = nullptr; @@ -876,7 +876,7 @@ void AppleObjCTrampolineHandler::ForEachDispatchFunction( - std::function callback) { for (auto elem : m_msgSend_map) { callback(elem.first, g_dispatch_functions[elem.second]); @@ -897,7 +897,7 @@ // consult it. const DispatchFunction *this_dispatch = FindDispatchFunction(curr_pc); - + // Next check to see if we are in a vtable region: if (!this_dispatch && m_vtables_up) { @@ -911,7 +911,7 @@ } if (this_dispatch) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); // We are decoding a method dispatch. First job is to pull the // arguments out: @@ -1166,12 +1166,12 @@ } } } - + // Finally, check if we have hit an "optimized dispatch" function. This will // either directly call the base implementation or dispatch an objc_msgSend // if the method has been overridden. So we just do a "step in/step out", - // setting a breakpoint on objc_msgSend, and if we hit the msgSend, we - // will automatically step in again. That's the job of the + // setting a breakpoint on objc_msgSend, and if we hit the msgSend, we + // will automatically step in again. That's the job of the // AppleThreadPlanStepThroughDirectDispatch. if (!this_dispatch && !ret_plan_sp) { MsgsendMap::iterator pos; diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp @@ -18,7 +18,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanRunToAddress.h" #include "lldb/Target/ThreadPlanStepOut.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" @@ -141,7 +141,7 @@ } Address target_so_addr; target_so_addr.SetOpcodeLoadAddress(target_addr, exc_ctx.GetTargetPtr()); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (target_addr == 0) { LLDB_LOGF(log, "Got target implementation of 0x0, stopping."); SetPlanComplete(); @@ -209,7 +209,7 @@ // This checks whether the selector has been overridden, directly calling the // implementation if it hasn't and calling objc_msgSend if it has. // -// We need to get into the overridden implementation. We'll do that by +// We need to get into the overridden implementation. We'll do that by // setting a breakpoint on objc_msgSend, and doing a "step out". If we stop // at objc_msgSend, we can step through to the target of the send, and see if // that's a place we want to stop. @@ -218,7 +218,7 @@ // so we might see objc_msgSend more than once. Also, these optimized dispatch // functions might dispatch more than one message at a time (e.g. alloc followed // by init.) So we can't give up at the first objc_msgSend. -// That means among other things that we have to handle the "ShouldStopHere" - +// That means among other things that we have to handle the "ShouldStopHere" - // since we can't just return control to the plan that's controlling us on the // first step. @@ -238,7 +238,7 @@ m_dispatch_func_name(std::string(dispatch_func_name)), m_at_msg_send(false) { // Set breakpoints on the dispatch functions: - auto bkpt_callback = [&] (lldb::addr_t addr, + auto bkpt_callback = [&] (lldb::addr_t addr, const AppleObjCTrampolineHandler ::DispatchFunction &dispatch) { m_msgSend_bkpts.push_back(GetTarget().CreateBreakpoint(addr, @@ -284,12 +284,12 @@ first = false; s->Printf("%d", bkpt_sp->GetID()); } - (*s) << "."; + (*s) << "."; break; } } -bool +bool AppleThreadPlanStepThroughDirectDispatch::DoPlanExplainsStop(Event *event_ptr) { if (ThreadPlanStepOut::DoPlanExplainsStop(event_ptr)) return true; @@ -306,13 +306,13 @@ if (stop_reason == eStopReasonBreakpoint) { ProcessSP process_sp = GetThread().GetProcess(); uint64_t break_site_id = stop_info_sp->GetValue(); - BreakpointSiteSP site_sp + BreakpointSiteSP site_sp = process_sp->GetBreakpointSiteList().FindByID(break_site_id); - // Some other plan might have deleted the site's last owner before this - // got to us. In which case, it wasn't our breakpoint... + // Some other plan might have deleted the site's last owner before this + // got to us. In which case, it wasn't our breakpoint... if (!site_sp) return false; - + for (BreakpointSP break_sp : m_msgSend_bkpts) { if (site_sp->IsBreakpointAtThisSite(break_sp->GetID())) { // If we aren't the only one with a breakpoint on this site, then we @@ -326,8 +326,8 @@ } } } - - // We're done here. If one of our sub-plans explained the stop, they + + // We're done here. If one of our sub-plans explained the stop, they // would have already answered true to PlanExplainsStop, and if they were // done, we'll get called to figure out what to do in ShouldStop... return false; @@ -342,19 +342,19 @@ bool AppleThreadPlanStepThroughDirectDispatch::ShouldStop(Event *event_ptr) { // If step out plan finished, that means we didn't find our way into a method - // implementation. Either we went directly to the default implementation, - // of the overridden implementation didn't have debug info. + // implementation. Either we went directly to the default implementation, + // of the overridden implementation didn't have debug info. // So we should mark ourselves as done. const bool step_out_should_stop = ThreadPlanStepOut::ShouldStop(event_ptr); if (step_out_should_stop) { SetPlanComplete(true); return true; } - - // 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 + + // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ -380,11 +380,11 @@ // If we hit an msgSend breakpoint, then we should queue the step through // plan: - + if (m_at_msg_send) { - LanguageRuntime *objc_runtime + LanguageRuntime *objc_runtime = GetThread().GetProcess()->GetLanguageRuntime(eLanguageTypeObjC); - // There's no way we could have gotten here without an ObjC language + // There's no way we could have gotten here without an ObjC language // runtime. assert(objc_runtime); m_objc_step_through_sp = @@ -402,7 +402,7 @@ } return false; } - return true; + return true; } bool AppleThreadPlanStepThroughDirectDispatch::MischiefManaged() { diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp --- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp @@ -21,7 +21,7 @@ #include "lldb/Symbol/Variable.h" #include "lldb/Target/Target.h" #include "lldb/Target/ABI.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Timer.h" #include "llvm/ADT/StringRef.h" @@ -63,7 +63,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp @@ -22,7 +22,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "RenderScriptExpressionOpts.h" #include "RenderScriptRuntime.h" @@ -77,8 +77,8 @@ bool RenderScriptRuntimeModulePass::runOnModule(llvm::Module &module) { bool changed_module = false; - Log *log( - GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_EXPRESSIONS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE | + LIBLLDB_LOG_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 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -32,7 +32,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/Args.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/Status.h" @@ -120,7 +120,7 @@ }; bool GetArgsX86(const GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); Status err; @@ -148,7 +148,7 @@ } bool GetArgsX86_64(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); // number of arguments passed in registers static const uint32_t args_in_reg = 6; @@ -224,7 +224,7 @@ // number of arguments passed in registers static const uint32_t args_in_reg = 4; - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); Status err; @@ -268,7 +268,7 @@ // number of arguments passed in registers static const uint32_t args_in_reg = 8; - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); for (size_t i = 0; i < num_args; ++i) { bool success = false; @@ -301,7 +301,7 @@ // register file offset to first argument static const uint32_t reg_offset = 4; - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); Status err; @@ -346,7 +346,7 @@ // register file offset to first argument static const uint32_t reg_offset = 4; - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); Status err; @@ -388,7 +388,7 @@ } bool GetArgs(ExecutionContext &exe_ctx, ArgItem *arg_list, size_t num_args) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); // verify that we have a target if (!exe_ctx.GetTargetPtr()) { @@ -465,7 +465,7 @@ } bool SkipPrologue(lldb::ModuleSP &module, Address &addr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); SymbolContext sc; uint32_t resolved_flags = module->ResolveSymbolContextForAddress(addr, eSymbolContextFunction, sc); @@ -576,7 +576,7 @@ array_size; // Number of items in array, only needed for structs ConstString type_name; // Name of type, only needed for structs - static ConstString + static ConstString GetFallbackStructName(); // Print this as the type name of a struct Element // If we can't resolve the actual struct name @@ -833,7 +833,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); ModuleSP module = context.module_sp; if (!module || !IsRenderScriptScriptModule(module)) @@ -893,7 +893,7 @@ if (!breakpoint_sp) return eCallbackReturnContinue; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); ModuleSP &module = context.module_sp; if (!module || !IsRenderScriptScriptModule(module)) @@ -1105,7 +1105,7 @@ void RenderScriptRuntime::HookCallback(RuntimeHook *hook, ExecutionContext &exe_ctx) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); LLDB_LOGF(log, "%s - '%s'", __FUNCTION__, hook->defn->name); @@ -1116,7 +1116,7 @@ void RenderScriptRuntime::CaptureDebugHintScriptGroup2( RuntimeHook *hook_info, ExecutionContext &context) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); enum { eGroupName = 0, @@ -1254,7 +1254,7 @@ void RenderScriptRuntime::CaptureScriptInvokeForEachMulti( RuntimeHook *hook, ExecutionContext &exe_ctx) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); enum { eRsContext = 0, @@ -1354,7 +1354,7 @@ void RenderScriptRuntime::CaptureSetGlobalVar(RuntimeHook *hook, ExecutionContext &context) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); enum { eRsContext, @@ -1401,7 +1401,7 @@ void RenderScriptRuntime::CaptureAllocationInit(RuntimeHook *hook, ExecutionContext &exe_ctx) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); enum { eRsContext, eRsAlloc, eRsForceZero }; @@ -1429,7 +1429,7 @@ void RenderScriptRuntime::CaptureAllocationDestroy(RuntimeHook *hook, ExecutionContext &exe_ctx) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); enum { eRsContext, @@ -1466,7 +1466,7 @@ void RenderScriptRuntime::CaptureScriptInit(RuntimeHook *hook, ExecutionContext &exe_ctx) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); Status err; Process *process = exe_ctx.GetProcessPtr(); @@ -1527,7 +1527,7 @@ void RenderScriptRuntime::LoadRuntimeHooks(lldb::ModuleSP module, ModuleKind kind) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); if (!module) { return; @@ -1619,7 +1619,7 @@ if (!rsmodule_sp) return; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); const ModuleSP module = rsmodule_sp->m_module; const FileSpec &file = module->GetPlatformFileSpec(); @@ -1675,7 +1675,7 @@ bool RenderScriptRuntime::EvalRSExpression(const char *expr, StackFrame *frame_ptr, uint64_t *result) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); LLDB_LOGF(log, "%s(%s)", __FUNCTION__, expr); ValueObjectSP expr_result; @@ -1822,7 +1822,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); if (!alloc->address.isValid()) { LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__); @@ -1857,7 +1857,7 @@ // success, false otherwise bool RenderScriptRuntime::JITTypePointer(AllocationDetails *alloc, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); if (!alloc->address.isValid() || !alloc->context.isValid()) { LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__); @@ -1892,7 +1892,7 @@ // the result. Returns true on success, false otherwise bool RenderScriptRuntime::JITTypePacked(AllocationDetails *alloc, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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::JITElementPacked(Element &elem, const lldb::addr_t context, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); if (!elem.element_ptr.isValid()) { LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__); @@ -2010,7 +2010,7 @@ bool RenderScriptRuntime::JITSubelements(Element &elem, const lldb::addr_t context, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); if (!elem.element_ptr.isValid() || !elem.field_count.isValid()) { LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__); @@ -2093,7 +2093,7 @@ // allocation. Returns true on success, false otherwise bool RenderScriptRuntime::JITAllocationSize(AllocationDetails *alloc, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); if (!alloc->address.isValid() || !alloc->dimension.isValid() || !alloc->data_ptr.isValid() || !alloc->element.datum_size.isValid()) { @@ -2159,7 +2159,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); if (!alloc->address.isValid() || !alloc->data_ptr.isValid()) { LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__); @@ -2220,7 +2220,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); if (!elem.type_name.IsEmpty()) // Name already set return; @@ -2304,7 +2304,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ std::shared_ptr RenderScriptRuntime::GetAllocationData(AllocationDetails *alloc, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); // JIT all the allocation details if (alloc->ShouldRefresh()) { @@ -2396,7 +2396,7 @@ bool RenderScriptRuntime::LoadAllocation(Stream &strm, const uint32_t alloc_id, const char *path, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); // Find allocation with the given id AllocationDetails *alloc = FindAllocByID(strm, alloc_id); @@ -2616,7 +2616,7 @@ bool RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id, const char *path, StackFrame *frame_ptr) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); // Find allocation with the given id AllocationDetails *alloc = FindAllocByID(strm, alloc_id); @@ -2735,7 +2735,7 @@ } bool RenderScriptRuntime::LoadModule(const lldb::ModuleSP &module_sp) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); if (module_sp) { for (const auto &rs_module : m_rsmodules) { @@ -2867,7 +2867,7 @@ // 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); // Skip the exportReduceCount line ++lines; for (; n_lines--; ++lines) { @@ -2958,7 +2958,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); const Symbol *info_sym = m_module->FindFirstSymbolWithNameAndType( ConstString(".rs.info"), eSymbolTypeData); if (!info_sym) @@ -3165,7 +3165,7 @@ // file bool RenderScriptRuntime::DumpAllocation(Stream &strm, StackFrame *frame_ptr, const uint32_t id) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); // Check we can find the desired allocation AllocationDetails *alloc = FindAllocByID(strm, id); @@ -3453,8 +3453,7 @@ // 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); InitSearchFilter(target); @@ -3482,8 +3481,7 @@ // breakpoint resolver, and returns the Breakpoint shared pointer. BreakpointSP RenderScriptRuntime::CreateKernelBreakpoint(ConstString name) { - Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); if (!m_filtersp) { LLDB_LOGF(log, "%s - error, no breakpoint search filter set.", @@ -3510,8 +3508,7 @@ BreakpointSP RenderScriptRuntime::CreateReductionBreakpoint(ConstString name, int kernel_types) { - Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); if (!m_filtersp) { LLDB_LOGF(log, "%s - error, no breakpoint search filter set.", @@ -3542,7 +3539,7 @@ bool RenderScriptRuntime::GetFrameVarAsUnsigned(const StackFrameSP frame_sp, const char *var_name, uint64_t &val) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_LANGUAGE)); Status err; VariableSP var_sp; @@ -3580,7 +3577,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_LANGUAGE)); if (!thread_ptr) { LLDB_LOGF(log, "%s - Error, No thread pointer", __FUNCTION__); @@ -3646,8 +3643,7 @@ StoppointCallbackContext *ctx, user_id_t break_id, user_id_t break_loc_id) { - Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); assert(baton && "Error: null baton in conditional kernel breakpoint callback"); @@ -3742,8 +3738,7 @@ BreakpointSP RenderScriptRuntime::CreateScriptGroupBreakpoint(ConstString name, bool stop_on_all) { - Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS)); if (!m_filtersp) { LLDB_LOGF(log, "%s - error, no breakpoint search filter set.", @@ -3839,7 +3834,7 @@ RenderScriptRuntime::AllocationDetails * RenderScriptRuntime::CreateAllocation(addr_t address) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); // Remove any previous allocation which contains the same address auto it = m_allocations.begin(); @@ -3862,7 +3857,7 @@ bool RenderScriptRuntime::ResolveKernelName(lldb::addr_t kernel_addr, ConstString &name) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); Target &target = GetProcess()->GetTarget(); Address resolved; diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/Args.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "RenderScriptRuntime.h" diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp @@ -19,7 +19,7 @@ #include "llvm/Pass.h" #include "lldb/Target/Process.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace lldb_private; @@ -86,7 +86,7 @@ // and inserting a new initial argument of pointer type of the original // return type. Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_EXPRESSIONS)); + LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -26,7 +26,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RangeMap.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" @@ -235,7 +235,7 @@ const char *cstr = data.GetCStr(offset, llvm::alignTo(n_namesz, 4)); if (cstr == nullptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); LLDB_LOGF(log, "Failed to parse note name lacking nul terminator"); return false; @@ -504,7 +504,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES)); const size_t initial_count = specs.GetSize(); @@ -998,7 +998,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES)); Status error; lldb::offset_t offset = 0; @@ -1365,7 +1365,7 @@ if (header.e_shnum == 0) return 0; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES)); section_headers.resize(header.e_shnum); if (section_headers.size() != header.e_shnum) @@ -1680,7 +1680,7 @@ VMMap::Allocator Alloc; VMMap Segments = VMMap(Alloc); VMMap Sections = VMMap(Alloc); - lldb_private::Log *Log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES); + lldb_private::Log *Log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES); size_t SegmentCount = 0; std::string SegmentName; @@ -2617,7 +2617,7 @@ (reloc_type(rel) == R_AARCH64_ABS32 && ((int64_t)value > INT32_MAX && (int64_t)value < INT32_MIN))) { Log *log = - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES); + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES); LLDB_LOGF(log, "Failed to apply debug info relocations"); break; } diff --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp --- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp +++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp @@ -26,7 +26,7 @@ #include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RangeMap.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/Timer.h" diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -35,7 +35,7 @@ #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RangeMap.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" @@ -1684,7 +1684,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); if (log) { log->Printf( "Installing dSYM's %s segment file address over ObjectFile's " @@ -2192,7 +2192,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); if (log && dsc_uuid.IsValid()) { LLDB_LOGF(log, "Shared cache %s has UUID %s", dyld_shared_cache.GetPath().c_str(), @@ -2253,7 +2253,7 @@ lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic); uint32_t i; FileSpecList dylib_files; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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_$_"); @@ -2602,7 +2602,7 @@ // 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( + Log *unwind_or_symbol_log(LLDBLog::GetLogIfAnyCategoryIsSet( LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_UNWIND)); if (unwind_or_symbol_log) @@ -5006,7 +5006,7 @@ llvm::Triple::getEnvironmentTypeName(llvm::Triple::Simulator); return; default: { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "unsupported platform in LC_BUILD_VERSION"); } @@ -5936,7 +5936,7 @@ dl->GetSharedCacheInformation(base_addr, uuid, using_shared_cache, private_shared_cache); } - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_PROCESS)); LLDB_LOGF( log, @@ -6031,7 +6031,7 @@ } } } - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_PROCESS)); if (log && uuid.IsValid()) LLDB_LOGF(log, @@ -7040,7 +7040,7 @@ bool ObjectFileMachO::LoadCoreFileImages(lldb_private::Process &process) { MachOCorefileAllImageInfos image_infos = GetCorefileAllImageInfos(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); 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 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -23,7 +23,7 @@ #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/Timer.h" #include "lldb/Utility/UUID.h" @@ -132,7 +132,7 @@ if (!data_sp || !ObjectFilePECOFF::MagicBytesMatch(data_sp)) return initial_count; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); if (data_sp->GetByteSize() < length) if (DataBufferSP full_sp = MapFileData(file, -1, file_offset)) @@ -212,7 +212,7 @@ if (m_binary) return true; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); auto binary = llvm::object::createBinary(llvm::MemoryBufferRef( toStringRef(m_data.GetData()), m_file.GetFilename().GetStringRef())); @@ -884,7 +884,7 @@ if (!CreateBinary()) return 0; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp +++ b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp @@ -15,7 +15,7 @@ #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" @@ -90,7 +90,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -115,7 +115,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OS)); LLDB_LOGF(log, "OperatingSystemPython::GetDynamicRegisterInfo() fetching " @@ -141,7 +141,7 @@ if (!m_interpreter || !m_python_object_sp) return false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ (void)api_lock.try_lock(); // See above. auto interpreter_lock = m_interpreter->AcquireInterpreterLock(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); if (reg_data_addr != LLDB_INVALID_ADDRESS) { // The registers data is in contiguous memory, just create the register @@ -363,7 +363,7 @@ lldb::ThreadSP OperatingSystemPython::CreateThread(lldb::tid_t tid, addr_t context) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -11,7 +11,7 @@ #include "lldb/Core/Section.h" #include "lldb/Core/ValueObject.h" #include "lldb/Host/HostInfo.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/UriParser.h" @@ -58,7 +58,7 @@ } PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) { const char *arch_name; if (arch && arch->GetArchitectureName()) @@ -190,7 +190,7 @@ auto source_file = source_spec.GetCString(false); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); LLDB_LOGF(log, "Got mode == 0 on '%s': try to get file via 'shell cat'", source_file); @@ -265,7 +265,7 @@ version_string = llvm::StringRef(version_string).trim().str(); if (error.Fail() || version_string.empty()) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM); LLDB_LOGF(log, "Get SDK version failed. (error: %s, output: %s)", error.AsCString(), version_string.c_str()); return 0; @@ -313,7 +313,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp @@ -8,7 +8,7 @@ #include "lldb/Host/ConnectionFileDescriptor.h" #include "lldb/Host/common/TCPSocket.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/UriParser.h" @@ -28,7 +28,7 @@ llvm::StringRef remote_socket_name, const llvm::Optional &socket_namespace, std::string &device_id) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); AdbClient adb; auto error = AdbClient::CreateByDeviceID(device_id, adb); @@ -89,7 +89,7 @@ socket_name)) return false; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); auto error = MakeConnectURL(pid, remote_port, socket_name.c_str(), connect_url); @@ -137,7 +137,7 @@ args.ReplaceArgumentAtIndex(0, connect_url); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); LLDB_LOGF(log, "Rewritten platform connect URL: %s", connect_url.c_str()); error = PlatformRemoteGDBServer::ConnectRemote(args); @@ -153,7 +153,7 @@ } void PlatformAndroidRemoteGDBServer::DeleteForwardPort(lldb::pid_t pid) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -22,7 +22,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -45,7 +45,7 @@ PlatformSP PlatformFreeBSD::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -22,7 +22,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -42,7 +42,7 @@ PlatformSP PlatformLinux::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force, arch ? arch->GetArchitectureName() : "", arch ? arch->GetTriple().getTriple() : ""); @@ -308,4 +308,3 @@ MmapArgList args({addr, length, prot, flags_platform, fd, offset}); return args; } - diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -18,7 +18,7 @@ #include "lldb/Host/PseudoTerminal.h" #include "lldb/Target/Process.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -281,7 +281,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) { const char *arch_name; if (arch && arch->GetArchitectureName()) @@ -673,4 +673,3 @@ PlatformDarwin::Terminate(); } } - diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -31,7 +31,7 @@ #include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/ProcessInfo.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/Timer.h" @@ -223,7 +223,7 @@ const lldb_private::FileSpecList *module_search_paths_ptr, llvm::SmallVectorImpl *old_modules, bool *did_create_ptr) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM)); LLDB_LOGF(log, "[%s] Trying to find module %s/%s - platform path %s/%s symbol " "path %s/%s", @@ -283,7 +283,7 @@ if (err.Fail()) return err; if (FileSystem::Instance().Exists(module_cache_spec)) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM)); LLDB_LOGF(log, "[%s] module %s/%s needs to be replaced from remote copy", (IsHost() ? "host" : "remote"), @@ -329,7 +329,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 @@ if (err.Fail()) return err; if (FileSystem::Instance().Exists(module_cache_spec)) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM)); LLDB_LOGF(log, "[%s] module %s/%s is now cached and fine", (IsHost() ? "host" : "remote"), module_spec.GetFileSpec().GetDirectory().AsCString(), @@ -904,7 +904,7 @@ llvm::Expected PlatformDarwin::FetchExtendedCrashInformation(Process &process) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); StructuredData::ArraySP annotations = ExtractCrashInfoAnnotations(process); @@ -923,7 +923,7 @@ StructuredData::ArraySP PlatformDarwin::ExtractCrashInfoAnnotations(Process &process) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); ConstString section_name("__crash_info"); Target &target = process.GetTarget(); @@ -1101,10 +1101,10 @@ case XcodeSDK::Type::bridgeOS: case XcodeSDK::Type::Linux: case XcodeSDK::Type::unknown: - if (lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST)) { + if (LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST)) { XcodeSDK::Info info; info.type = sdk_type; - LLDB_LOGF(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), + LLDB_LOGF(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), "Clang modules on %s are not supported", XcodeSDK::GetCanonicalName(info).c_str()); } @@ -1268,7 +1268,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -27,7 +27,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -69,7 +69,7 @@ PlatformSP PlatformDarwinKernel::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) { const char *arch_name; if (arch && arch->GetArchitectureName()) @@ -279,7 +279,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) { LLDB_LOGF(log, "\nkexts with dSYMs"); for (auto pos : m_name_to_kext_path_map_with_dsyms) { @@ -483,8 +483,8 @@ FileSpec file_spec(path); ConstString file_spec_extension = file_spec.GetFileNameExtension(); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - Log *log_verbose(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM | LLDB_LOG_OPTION_VERBOSE)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log_verbose(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM | LLDB_LOG_OPTION_VERBOSE)); LLDB_LOGF(log_verbose, "PlatformDarwinKernel examining '%s'", file_spec.GetPath().c_str()); @@ -578,7 +578,7 @@ void PlatformDarwinKernel::AddKextToMap(PlatformDarwinKernel *thisp, const FileSpec &file_spec) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -29,7 +29,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp @@ -21,7 +21,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -57,7 +57,7 @@ PlatformSP PlatformRemoteAppleBridge::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp @@ -21,7 +21,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -58,7 +58,7 @@ PlatformSP PlatformRemoteAppleTV::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp @@ -21,7 +21,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -55,7 +55,7 @@ PlatformSP PlatformRemoteAppleWatch::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp @@ -19,7 +19,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -136,7 +136,7 @@ } bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ uint32_t PlatformRemoteDarwinDevice::FindFileInAllSDKs(const char *platform_file_path, FileSpecList &file_list) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file, const UUID *uuid_ptr, FileSpec &local_file) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); Status error; char platform_file_path[PATH_MAX]; if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path))) { @@ -500,7 +500,7 @@ // 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp @@ -23,7 +23,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -58,7 +58,7 @@ PlatformSP PlatformRemoteMacOSX::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -18,7 +18,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -52,7 +52,7 @@ } PlatformSP PlatformRemoteiOS::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp +++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -40,7 +40,7 @@ PlatformSP PlatformNetBSD::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp +++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -40,7 +40,7 @@ PlatformSP PlatformOpenBSD::CreateInstance(bool force, const ArchSpec *arch) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -28,7 +28,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "llvm/ADT/ScopeExit.h" @@ -89,7 +89,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM)); if (IsHost()) { if (source == destination) @@ -154,7 +154,7 @@ const lldb_private::FileSpec &source, // remote file path const lldb_private::FileSpec &destination) // local file path { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM)); // Check the args, first. std::string src_path(source.GetPath()); @@ -360,7 +360,7 @@ Debugger &debugger, Target *target, Status &error) { lldb::ProcessSP process_sp; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM)); if (IsHost()) { if (target == nullptr) { @@ -413,7 +413,7 @@ lldb::ProcessSP PlatformPOSIX::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target &target, Status &error) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); LLDB_LOG(log, "target {0}", &target); ProcessSP process_sp; @@ -574,12 +574,12 @@ void *image_ptr; const char *error_str; }; - + extern void *memcpy(void *, const void *, size_t size); extern size_t strlen(const char *); - - void * __lldb_dlopen_wrapper (const char *name, + + void * __lldb_dlopen_wrapper (const char *name, const char *path_strings, char *buffer, __lldb_dlopen_result *result_ptr) @@ -593,14 +593,14 @@ result_ptr->error_str = dlerror(); return nullptr; } - + // This is the case where we have a list of paths: size_t name_len = strlen(name); while (path_strings && path_strings[0] != '\0') { size_t path_len = strlen(path_strings); memcpy((void *) buffer, (void *) path_strings, path_len); buffer[path_len] = '/'; - char *target_ptr = buffer+path_len+1; + char *target_ptr = buffer+path_len+1; memcpy((void *) target_ptr, (void *) name, name_len + 1); result_ptr->image_ptr = dlopen(buffer, RTLD_LAZY); if (result_ptr->image_ptr) { @@ -659,7 +659,7 @@ arguments.PushValue(value); arguments.PushValue(value); arguments.PushValue(value); - + do_dlopen_function = dlopen_utility_func_up->MakeFunctionCaller( clang_void_pointer_type, arguments, exe_ctx.GetThreadSP(), utility_error); if (utility_error.Fail()) { @@ -667,13 +667,13 @@ "caller: %s", utility_error.AsCString()); return nullptr; } - + do_dlopen_function = dlopen_utility_func_up->GetFunctionCaller(); if (!do_dlopen_function) { error.SetErrorString("dlopen error: could not get function caller."); return nullptr; } - + // We made a good utility function, so cache it in the process: return dlopen_utility_func_up; } @@ -688,15 +688,15 @@ std::string path; path = remote_file.GetPath(); - + ThreadSP thread_sp = process->GetThreadList().GetExpressionExecutionThread(); if (!thread_sp) { error.SetErrorString("dlopen error: no thread available to call dlopen."); return LLDB_INVALID_IMAGE_TOKEN; } - + DiagnosticManager diagnostics; - + ExecutionContext exe_ctx; thread_sp->CalculateExecutionContext(exe_ctx); @@ -714,19 +714,19 @@ // If we couldn't make it, the error will be in error, so we can exit here. if (!dlopen_utility_func) return LLDB_INVALID_IMAGE_TOKEN; - + do_dlopen_function = dlopen_utility_func->GetFunctionCaller(); if (!do_dlopen_function) { error.SetErrorString("dlopen error: could not get function caller."); return LLDB_INVALID_IMAGE_TOKEN; } arguments = do_dlopen_function->GetArgumentValues(); - + // Now insert the path we are searching for and the result structure into the // target. uint32_t permissions = ePermissionsReadable|ePermissionsWritable; size_t path_len = path.size() + 1; - lldb::addr_t path_addr = process->AllocateMemory(path_len, + lldb::addr_t path_addr = process->AllocateMemory(path_len, permissions, utility_error); if (path_addr == LLDB_INVALID_ADDRESS) { @@ -747,7 +747,7 @@ " %s", utility_error.AsCString()); return LLDB_INVALID_IMAGE_TOKEN; } - + // Make space for our return structure. It is two pointers big: the token // and the error string. const uint32_t addr_size = process->GetAddressByteSize(); @@ -759,7 +759,7 @@ "for path: %s", utility_error.AsCString()); return LLDB_INVALID_IMAGE_TOKEN; } - + // Make sure we deallocate the result structure memory auto return_cleanup = llvm::make_scope_exit([process, return_addr] { // Deallocate the buffer @@ -773,7 +773,7 @@ path_array_cleanup; // This is the address to a buffer large enough to hold the largest path - // conjoined with the library name we're passing in. This is a convenience + // conjoined with the library name we're passing in. This is a convenience // to avoid having to call malloc in the dlopen function. lldb::addr_t buffer_addr = 0x0; llvm::Optional>> @@ -781,7 +781,7 @@ // Set the values into our args and write them to the target: if (paths != nullptr) { - // First insert the paths into the target. This is expected to be a + // First insert the paths into the target. This is expected to be a // continuous buffer with the strings laid out null terminated and // end to end with an empty string terminating the buffer. // We also compute the buffer's required size as we go. @@ -799,24 +799,24 @@ buffer_size = path_size; } path_array.push_back('\0'); - - path_array_addr = process->AllocateMemory(path_array.size(), + + path_array_addr = process->AllocateMemory(path_array.size(), permissions, utility_error); if (path_array_addr == LLDB_INVALID_ADDRESS) { error.SetErrorStringWithFormat("dlopen error: could not allocate memory" - "for path array: %s", + "for path array: %s", utility_error.AsCString()); return LLDB_INVALID_IMAGE_TOKEN; } - + // Make sure we deallocate the paths array. path_array_cleanup.emplace([process, path_array_addr]() { // Deallocate the path array. process->DeallocateMemory(path_array_addr); }); - process->WriteMemory(path_array_addr, path_array.data(), + process->WriteMemory(path_array_addr, path_array.data(), path_array.size(), utility_error); if (utility_error.Fail()) { @@ -827,42 +827,42 @@ // Now make spaces in the target for the buffer. We need to add one for // the '/' that the utility function will insert and one for the '\0': buffer_size += path.size() + 2; - - buffer_addr = process->AllocateMemory(buffer_size, + + buffer_addr = process->AllocateMemory(buffer_size, permissions, utility_error); if (buffer_addr == LLDB_INVALID_ADDRESS) { error.SetErrorStringWithFormat("dlopen error: could not allocate memory" - "for buffer: %s", + "for buffer: %s", utility_error.AsCString()); return LLDB_INVALID_IMAGE_TOKEN; } - + // Make sure we deallocate the buffer memory: buffer_cleanup.emplace([process, buffer_addr]() { // Deallocate the buffer. process->DeallocateMemory(buffer_addr); }); } - + arguments.GetValueAtIndex(0)->GetScalar() = path_addr; arguments.GetValueAtIndex(1)->GetScalar() = path_array_addr; arguments.GetValueAtIndex(2)->GetScalar() = buffer_addr; arguments.GetValueAtIndex(3)->GetScalar() = return_addr; lldb::addr_t func_args_addr = LLDB_INVALID_ADDRESS; - + diagnostics.Clear(); - if (!do_dlopen_function->WriteFunctionArguments(exe_ctx, + if (!do_dlopen_function->WriteFunctionArguments(exe_ctx, func_args_addr, arguments, diagnostics)) { error.SetErrorStringWithFormat("dlopen error: could not write function " - "arguments: %s", + "arguments: %s", diagnostics.GetString().c_str()); return LLDB_INVALID_IMAGE_TOKEN; } - + // Make sure we clean up the args structure. We can't reuse it because the // Platform lives longer than the process and the Platforms don't get a // signal to clean up cached data when a process goes away. @@ -895,25 +895,25 @@ = ast->GetBasicType(eBasicTypeVoid).GetPointerType(); return_value.SetCompilerType(clang_void_pointer_type); - + ExpressionResults results = do_dlopen_function->ExecuteFunction( exe_ctx, &func_args_addr, options, diagnostics, return_value); if (results != eExpressionCompleted) { error.SetErrorStringWithFormat("dlopen error: failed executing " - "dlopen wrapper function: %s", + "dlopen wrapper function: %s", diagnostics.GetString().c_str()); return LLDB_INVALID_IMAGE_TOKEN; } - + // Read the dlopen token from the return area: - lldb::addr_t token = process->ReadPointerFromMemory(return_addr, + lldb::addr_t token = process->ReadPointerFromMemory(return_addr, utility_error); if (utility_error.Fail()) { error.SetErrorStringWithFormat("dlopen error: could not read the return " "struct: %s", utility_error.AsCString()); return LLDB_INVALID_IMAGE_TOKEN; } - + // The dlopen succeeded! if (token != 0x0) { if (loaded_image && buffer_addr != 0x0) @@ -927,19 +927,19 @@ } return process->AddImageToken(token); } - + // We got an error, lets read in the error string: std::string dlopen_error_str; - lldb::addr_t error_addr + lldb::addr_t error_addr = process->ReadPointerFromMemory(return_addr + addr_size, utility_error); if (utility_error.Fail()) { error.SetErrorStringWithFormat("dlopen error: could not read error string: " "%s", utility_error.AsCString()); return LLDB_INVALID_IMAGE_TOKEN; } - - size_t num_chars = process->ReadCStringFromMemory(error_addr + addr_size, - dlopen_error_str, + + size_t num_chars = process->ReadCStringFromMemory(error_addr + addr_size, + dlopen_error_str, utility_error); if (utility_error.Success() && num_chars > 0) error.SetErrorStringWithFormat("dlopen error: %s", diff --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp --- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp +++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp @@ -14,8 +14,8 @@ #include "lldb/Interpreter/OptionValueProperties.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Listener.h" -#include "lldb/Utility/Log.h" using namespace lldb; using namespace lldb_private; @@ -160,7 +160,7 @@ lldb::ProcessSP PlatformQemuUser::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target &target, Status &error) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -23,7 +23,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/ProcessInfo.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -92,7 +92,7 @@ bool PlatformRemoteGDBServer::GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM); const auto module_path = module_file_spec.GetPath(false); @@ -171,7 +171,7 @@ FileSpec PlatformRemoteGDBServer::GetRemoteWorkingDirectory() { if (IsConnected()) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM); FileSpec working_dir; if (m_gdb_client_up->GetWorkingDir(working_dir) && log) LLDB_LOGF(log, @@ -188,7 +188,7 @@ 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 = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM); LLDB_LOGF(log, "PlatformRemoteGDBServer::SetRemoteWorkingDirectory('%s')", working_dir.GetCString()); return m_gdb_client_up->SetWorkingDir(working_dir) == 0; @@ -318,7 +318,7 @@ } Status PlatformRemoteGDBServer::LaunchProcess(ProcessLaunchInfo &launch_info) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); Status error; LLDB_LOGF(log, "PlatformRemoteGDBServer::%s() called", __FUNCTION__); @@ -539,7 +539,7 @@ if (!IsConnected()) return Status("Not connected."); Status error = m_gdb_client_up->MakeDirectory(file_spec, mode); - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM); LLDB_LOGF(log, "PlatformRemoteGDBServer::MakeDirectory(path='%s', mode=%o) " "error = %u (%s)", @@ -553,7 +553,7 @@ return Status("Not connected."); Status error = m_gdb_client_up->GetFilePermissions(file_spec, file_permissions); - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM); LLDB_LOGF(log, "PlatformRemoteGDBServer::GetFilePermissions(path='%s', " "file_permissions=%o) error = %u (%s)", @@ -568,7 +568,7 @@ return Status("Not connected."); Status error = m_gdb_client_up->SetFilePermissions(file_spec, file_permissions); - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM); LLDB_LOGF(log, "PlatformRemoteGDBServer::SetFilePermissions(path='%s', " "file_permissions=%o) error = %u (%s)", @@ -637,7 +637,7 @@ if (!IsConnected()) return Status("Not connected."); Status error = m_gdb_client_up->CreateSymlink(src, dst); - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM); LLDB_LOGF(log, "PlatformRemoteGDBServer::CreateSymlink(src='%s', dst='%s') " "error = %u (%s)", @@ -650,7 +650,7 @@ if (!IsConnected()) return Status("Not connected."); Status error = m_gdb_client_up->Unlink(file_spec); - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp --- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp @@ -18,7 +18,7 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" diff --git a/lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.cpp b/lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.cpp --- a/lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.cpp +++ b/lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.cpp @@ -9,7 +9,7 @@ #include "ThreadFreeBSDKernel.h" #include "lldb/Target/Unwind.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "Plugins/Process/Utility/RegisterContextFreeBSD_i386.h" #include "Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h" diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -429,7 +429,7 @@ // Handles all waitpid events from the inferior process. void NativeProcessLinux::MonitorCallback(NativeThreadLinux &thread, WaitStatus status) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); // Certain activities differ based on whether the pid is the tid of the main // thread. @@ -715,7 +715,7 @@ void NativeProcessLinux::MonitorBreakpoint(NativeThreadLinux &thread) { Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_BREAKPOINTS)); + GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_BREAKPOINTS)); LLDB_LOG(log, "received breakpoint event, pid = {0}", thread.GetID()); // Mark the thread as stopped at breakpoint. @@ -732,7 +732,7 @@ void NativeProcessLinux::MonitorWatchpoint(NativeThreadLinux &thread, uint32_t wp_index) { Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_WATCHPOINTS)); + GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOG(log, "received watchpoint event, pid = {0}, wp_index = {1}", thread.GetID(), wp_index); @@ -1831,7 +1831,7 @@ // We have a pending notification and all threads have stopped. Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_BREAKPOINTS)); + GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_BREAKPOINTS)); // Clear any temporary breakpoints we used to implement software single // stepping. diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp @@ -15,7 +15,7 @@ #include "Plugins/Process/POSIX/ProcessPOSIXLog.h" #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp @@ -15,7 +15,7 @@ #include "lldb/Host/common/NativeProcessProtocol.h" #include "lldb/Host/linux/Ptrace.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp @@ -15,7 +15,7 @@ #include "lldb/Host/common/NativeProcessProtocol.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp @@ -12,7 +12,7 @@ #include "Plugins/Process/Linux/NativeProcessLinux.h" #include "lldb/Host/HostInfo.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp @@ -15,7 +15,7 @@ #include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h" #include "lldb/Host/HostInfo.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" #include diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp --- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp @@ -19,7 +19,7 @@ #include "lldb/Host/linux/Ptrace.h" #include "lldb/Host/linux/Support.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "lldb/lldb-enumerations.h" @@ -110,7 +110,7 @@ bool NativeThreadLinux::GetStopReason(ThreadStopInfo &stop_info, std::string &description) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); description.clear(); @@ -277,7 +277,7 @@ void NativeThreadLinux::SetStoppedBySignal(uint32_t signo, const siginfo_t *info) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); LLDB_LOGF(log, "NativeThreadLinux::%s called with signal 0x%02" PRIx32, __FUNCTION__, signo); @@ -391,7 +391,7 @@ } void NativeThreadLinux::SetStoppedByExec() { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); LLDB_LOGF(log, "NativeThreadLinux::%s()", __FUNCTION__); SetStopped(); @@ -493,7 +493,7 @@ } Status NativeThreadLinux::RequestStop() { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); NativeProcessLinux &process = GetProcess(); @@ -519,7 +519,7 @@ } void NativeThreadLinux::MaybeLogStateChange(lldb::StateType new_state) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); // If we're not logging, we're done. if (!log) return; diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp --- a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp @@ -18,7 +18,7 @@ #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "lldb/Utility/UUID.h" @@ -802,11 +802,11 @@ const uint32_t count = packet.GetByteSize() - offset; s.Printf(" (error = 0x%8.8x:\n", error); if (count > 0) - DumpDataExtractor(packet, + DumpDataExtractor(packet, &s, // Stream to dump to offset, // Offset within "packet" eFormatBytesWithASCII, // Format to use - 1, // Size of each item + 1, // Size of each item // in bytes count, // Number of items 16, // Number per line @@ -820,16 +820,16 @@ const uint32_t count = packet.GetByteSize() - offset; s.Printf(" (error = 0x%8.8x regs:\n", error); if (count > 0) - DumpDataExtractor(packet, + DumpDataExtractor(packet, &s, // Stream to dump to offset, // Offset within "packet" eFormatHex, // Format to use - m_addr_byte_size, // Size of each item + m_addr_byte_size, // Size of each item // in bytes count / m_addr_byte_size, // Number of items 16 / m_addr_byte_size, // Number per line - LLDB_INVALID_ADDRESS, - // Don't + LLDB_INVALID_ADDRESS, + // Don't // show addresses before // each line 0, 0); // No bitfields @@ -855,14 +855,14 @@ const uint32_t count = packet.GetByteSize() - offset; s.Printf(" (error = 0x%8.8x io:\n", error); if (count > 0) - DumpDataExtractor(packet, + DumpDataExtractor(packet, &s, // Stream to dump to offset, // Offset within "packet" eFormatHex, // Format to use 1, // Size of each item in bytes count, // Number of items 16, // Number per line - LLDB_INVALID_ADDRESS, // Don't show addresses + LLDB_INVALID_ADDRESS, // Don't show addresses // before each line 0, 0); // No bitfields } break; @@ -870,15 +870,15 @@ const uint32_t count = packet.GetByteSize() - offset; s.Printf(" (count = %u, bytes = \n", count); if (count > 0) - DumpDataExtractor(packet, + DumpDataExtractor(packet, &s, // Stream to dump to offset, // Offset within "packet" eFormatHex, // Format to use - 1, // Size of each item in + 1, // Size of each item in // bytes count, // Number of items 16, // Number per line - LLDB_INVALID_ADDRESS, // Don't show addresses + LLDB_INVALID_ADDRESS, // Don't show addresses // before each line 0, 0); // No bitfields @@ -978,12 +978,12 @@ const uint32_t nbytes = packet.GetByteSize() - offset; s.Printf(" (cpu = %u, flavor = %u, regs = \n", cpu, flavor); if (nbytes > 0) - DumpDataExtractor(packet, + DumpDataExtractor(packet, &s, // Stream to dump to - offset, // Offset within + offset, // Offset within // "packet" eFormatHex, // Format to use - m_addr_byte_size, // Size of each item in + m_addr_byte_size, // Size of each item in // bytes nbytes / m_addr_byte_size, // Number of items 16 / m_addr_byte_size, // Number per line @@ -1084,15 +1084,15 @@ s.Printf(" (address=0x%8.8x, lcpu=0x%4.4x, nbytes=0x%8.8x)", lcpu, address, nbytes); if (nbytes > 0) - DumpDataExtractor(packet, + DumpDataExtractor(packet, &s, // Stream to dump to offset, // Offset within "packet" eFormatHex, // Format to use - 1, // Size of each item in + 1, // Size of each item in // bytes nbytes, // Number of items 16, // Number per line - LLDB_INVALID_ADDRESS, // Don't show addresses + LLDB_INVALID_ADDRESS, // Don't show addresses // before each line 0, 0); // No bitfields } break; @@ -1112,15 +1112,15 @@ s.Printf(" (lcpu = %u, addr = 0x%4.4x, nbytes = %u, bytes = \n", lcpu, address, nbytes); if (nbytes > 0) - DumpDataExtractor(packet, + DumpDataExtractor(packet, &s, // Stream to dump to offset, // Offset within "packet" eFormatHex, // Format to use - 1, // Size of each item in + 1, // Size of each item in // bytes nbytes, // Number of items 16, // Number per line - LLDB_INVALID_ADDRESS, // Don't show addresses + LLDB_INVALID_ADDRESS, // Don't show addresses // before each line 0, 0); // No bitfields } break; @@ -1129,7 +1129,7 @@ const uint32_t count = packet.GetByteSize() - offset; s.Printf(" (count = %u, bytes = \n", count); if (count > 0) - DumpDataExtractor(packet, + DumpDataExtractor(packet, &s, // Stream to dump to offset, // Offset within "packet" eFormatHex, // Format to use @@ -1154,12 +1154,12 @@ &s, // Stream to dump to 0, // Offset into "packet" eFormatBytes, // Dump as hex bytes - 1, // Size of each item is 1 for + 1, // Size of each item is 1 for // single bytes packet.GetByteSize(), // Number of bytes UINT32_MAX, // Num bytes per line LLDB_INVALID_ADDRESS, // Base address - 0, 0); // Bitfield info set to not do + 0, 0); // Bitfield info set to not do // anything bitfield related } } diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -32,7 +32,7 @@ #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "lldb/Utility/StringExtractor.h" #include "lldb/Utility/UUID.h" @@ -725,7 +725,7 @@ llvm::Expected async_thread = ThreadLauncher::LaunchThread( "", ProcessKDP::AsyncThread, this); if (!async_thread) { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), "failed to launch host thread: {}", llvm::toString(async_thread.takeError())); return false; diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.h b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.h --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.h +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.h @@ -11,19 +11,21 @@ #include "lldb/Utility/Log.h" -#define KDP_LOG_PROCESS (1u << 1) -#define KDP_LOG_THREAD (1u << 2) -#define KDP_LOG_PACKETS (1u << 3) -#define KDP_LOG_MEMORY (1u << 4) // Log memory reads/writes calls -#define KDP_LOG_MEMORY_DATA_SHORT \ - (1u << 5) // Log short memory reads/writes bytes -#define KDP_LOG_MEMORY_DATA_LONG (1u << 6) // Log all memory reads/writes bytes -#define KDP_LOG_BREAKPOINTS (1u << 7) -#define KDP_LOG_WATCHPOINTS (1u << 8) -#define KDP_LOG_STEP (1u << 9) -#define KDP_LOG_COMM (1u << 10) -#define KDP_LOG_ASYNC (1u << 11) -#define KDP_LOG_ALL (UINT32_MAX) +#define KDP_LOG_PROCESS LLDB_LOG_BIT(1) +#define KDP_LOG_THREAD LLDB_LOG_BIT(2) +#define KDP_LOG_PACKETS LLDB_LOG_BIT(3) +// Log memory reads/writes calls +#define KDP_LOG_MEMORY LLDB_LOG_BIT(4) +// Log short memory reads/writes bytes +#define KDP_LOG_MEMORY_DATA_SHORT LLDB_LOG_BIT(5) +// Log all memory reads/writes bytes +#define KDP_LOG_MEMORY_DATA_LONG LLDB_LOG_BIT(6) +#define KDP_LOG_BREAKPOINTS LLDB_LOG_BIT(7) +#define KDP_LOG_WATCHPOINTS LLDB_LOG_BIT(8) +#define KDP_LOG_STEP LLDB_LOG_BIT(9) +#define KDP_LOG_COMM LLDB_LOG_BIT(10) +#define KDP_LOG_ASYNC LLDB_LOG_BIT(11) +#define KDP_LOG_ALL LLDB_LOG_ALL_BITS #define KDP_LOG_DEFAULT KDP_LOG_PACKETS namespace lldb_private { @@ -33,7 +35,7 @@ public: static void Initialize(); - static Log *GetLogIfAllCategoriesSet(uint32_t mask) { + static Log *GetLogIfAllCategoriesSet(LogMask mask) { return g_channel.GetLogIfAll(mask); } }; diff --git a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp --- a/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp +++ b/lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp @@ -12,7 +12,7 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Status.h" diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h b/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h --- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h +++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.h @@ -13,14 +13,14 @@ #include "lldb/Utility/Log.h" -#define POSIX_LOG_PROCESS (1u << 1) -#define POSIX_LOG_THREAD (1u << 2) -#define POSIX_LOG_MEMORY (1u << 4) // Log memory reads/writes calls -#define POSIX_LOG_PTRACE (1u << 5) -#define POSIX_LOG_REGISTERS (1u << 6) -#define POSIX_LOG_BREAKPOINTS (1u << 7) -#define POSIX_LOG_WATCHPOINTS (1u << 8) -#define POSIX_LOG_ALL (UINT32_MAX) +#define POSIX_LOG_PROCESS LLDB_LOG_BIT(1) +#define POSIX_LOG_THREAD LLDB_LOG_BIT(2) +#define POSIX_LOG_MEMORY LLDB_LOG_BIT(3) +#define POSIX_LOG_PTRACE LLDB_LOG_BIT(4) +#define POSIX_LOG_REGISTERS LLDB_LOG_BIT(5) +#define POSIX_LOG_BREAKPOINTS LLDB_LOG_BIT(6) +#define POSIX_LOG_WATCHPOINTS LLDB_LOG_BIT(7) +#define POSIX_LOG_ALL LLDB_LOG_ALL_BITS #define POSIX_LOG_DEFAULT POSIX_LOG_PROCESS namespace lldb_private { @@ -30,7 +30,7 @@ public: static void Initialize(); - static Log *GetLogIfAllCategoriesSet(uint32_t mask) { + static Log *GetLogIfAllCategoriesSet(LogMask mask) { return g_channel.GetLogIfAll(mask); } }; diff --git a/lldb/source/Plugins/Process/Utility/AuxVector.h b/lldb/source/Plugins/Process/Utility/AuxVector.h --- a/lldb/source/Plugins/Process/Utility/AuxVector.h +++ b/lldb/source/Plugins/Process/Utility/AuxVector.h @@ -10,7 +10,7 @@ #define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_AUXVECTOR_H #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include class AuxVector { diff --git a/lldb/source/Plugins/Process/Utility/HistoryThread.cpp b/lldb/source/Plugins/Process/Utility/HistoryThread.cpp --- a/lldb/source/Plugins/Process/Utility/HistoryThread.cpp +++ b/lldb/source/Plugins/Process/Utility/HistoryThread.cpp @@ -15,7 +15,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/StackFrameList.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include @@ -33,14 +33,14 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); LLDB_LOGF(log, "%p HistoryThread::HistoryThread", static_cast(this)); } // Destructor HistoryThread::~HistoryThread() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.cpp +++ b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.cpp @@ -8,7 +8,7 @@ #include "NativeRegisterContextDBReg_arm64.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" using namespace lldb_private; @@ -29,7 +29,7 @@ } uint32_t NativeRegisterContextDBReg_arm64::NumSupportedHardwareBreakpoints() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); llvm::Error error = ReadHardwareDebugInfo(); if (error) { LLDB_LOG_ERROR(log, std::move(error), @@ -43,7 +43,7 @@ uint32_t NativeRegisterContextDBReg_arm64::SetHardwareBreakpoint(lldb::addr_t addr, size_t size) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); LLDB_LOG(log, "addr: {0:x}, size: {1:x}", addr, size); // Read hardware breakpoint and watchpoint information. @@ -104,7 +104,7 @@ bool NativeRegisterContextDBReg_arm64::ClearHardwareBreakpoint( uint32_t hw_idx) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); LLDB_LOG(log, "hw_idx: {0}", hw_idx); // Read hardware breakpoint and watchpoint information. @@ -144,7 +144,7 @@ Status NativeRegisterContextDBReg_arm64::GetHardwareBreakHitIndex( uint32_t &bp_index, lldb::addr_t trap_addr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); LLDB_LOGF(log, "NativeRegisterContextDBReg_arm64::%s()", __FUNCTION__); @@ -164,7 +164,7 @@ } Status NativeRegisterContextDBReg_arm64::ClearAllHardwareBreakpoints() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); LLDB_LOGF(log, "NativeRegisterContextDBReg_arm64::%s()", __FUNCTION__); @@ -206,7 +206,7 @@ } uint32_t NativeRegisterContextDBReg_arm64::NumSupportedHardwareWatchpoints() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); llvm::Error error = ReadHardwareDebugInfo(); if (error) { LLDB_LOG_ERROR(log, std::move(error), @@ -219,7 +219,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOG(log, "addr: {0:x}, size: {1:x} watch_flags: {2:x}", addr, size, watch_flags); @@ -312,7 +312,7 @@ bool NativeRegisterContextDBReg_arm64::ClearHardwareWatchpoint( uint32_t wp_index) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOG(log, "wp_index: {0}", wp_index); // Read hardware breakpoint and watchpoint information. @@ -384,7 +384,7 @@ uint32_t NativeRegisterContextDBReg_arm64::GetWatchpointSize(uint32_t wp_index) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOG(log, "wp_index: {0}", wp_index); switch ((m_hwp_regs[wp_index].control >> 5) & 0xff) { @@ -402,7 +402,7 @@ } bool NativeRegisterContextDBReg_arm64::WatchpointIsEnabled(uint32_t wp_index) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOG(log, "wp_index: {0}", wp_index); if ((m_hwp_regs[wp_index].control & g_enable_bit) != 0) @@ -413,7 +413,7 @@ Status NativeRegisterContextDBReg_arm64::GetWatchpointHitIndex( uint32_t &wp_index, lldb::addr_t trap_addr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ lldb::addr_t NativeRegisterContextDBReg_arm64::GetWatchpointAddress(uint32_t wp_index) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOG(log, "wp_index: {0}", wp_index); if (wp_index >= m_max_hwp_supported) @@ -457,7 +457,7 @@ lldb::addr_t NativeRegisterContextDBReg_arm64::GetWatchpointHitAddress(uint32_t wp_index) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.cpp +++ b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.cpp @@ -8,7 +8,7 @@ #include "NativeRegisterContextDBReg_x86.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "Plugins/Process/Utility/lldb-x86-register-enums.h" @@ -242,7 +242,7 @@ uint32_t NativeRegisterContextDBReg_x86::SetHardwareWatchpoint( lldb::addr_t addr, size_t size, uint32_t watch_flags) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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/Utility/RegisterContextDarwin_arm.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp --- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp @@ -12,7 +12,7 @@ #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Scalar.h" #include "llvm/Support/Compiler.h" diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp --- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp @@ -14,7 +14,7 @@ #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Scalar.h" #include "llvm/ADT/STLExtras.h" diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp --- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp @@ -9,7 +9,7 @@ #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Scalar.h" #include "llvm/ADT/STLExtras.h" diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp --- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp @@ -15,7 +15,7 @@ #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/Scalar.h" #include "llvm/ADT/STLExtras.h" @@ -172,7 +172,7 @@ {ehframe_dwarf_fpu_##reg##i, \ ehframe_dwarf_fpu_##reg##i, LLDB_INVALID_REGNUM, \ LLDB_INVALID_REGNUM, fpu_##reg##i }, \ - nullptr, nullptr, + nullptr, nullptr, #define DEFINE_EXC(reg) \ #reg, NULL, sizeof(((RegisterContextDarwin_x86_64::EXC *) NULL)->reg), \ EXC_OFFSET(reg), eEncodingUint, eFormatHex diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDummy.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDummy.cpp --- a/lldb/source/Plugins/Process/Utility/RegisterContextDummy.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextDummy.cpp @@ -24,7 +24,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/lldb-private.h" diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextHistory.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextHistory.cpp --- a/lldb/source/Plugins/Process/Utility/RegisterContextHistory.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextHistory.cpp @@ -24,7 +24,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/lldb-private.h" diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h --- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h +++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h @@ -12,7 +12,7 @@ #include "RegisterInfoInterface.h" #include "RegisterInfoPOSIX_arm.h" #include "lldb/Target/RegisterContext.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" class RegisterContextPOSIX_arm : public lldb_private::RegisterContext { public: diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h --- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h +++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h @@ -12,7 +12,7 @@ #include "RegisterInfoInterface.h" #include "RegisterInfoPOSIX_arm64.h" #include "lldb/Target/RegisterContext.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" class RegisterContextPOSIX_arm64 : public lldb_private::RegisterContext { public: diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h --- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h +++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h @@ -12,7 +12,7 @@ #include "RegisterContext_mips.h" #include "RegisterInfoInterface.h" #include "lldb/Target/RegisterContext.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" class RegisterContextPOSIX_mips64 : public lldb_private::RegisterContext { public: diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h --- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h +++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h @@ -12,7 +12,7 @@ #include "RegisterContext_powerpc.h" #include "RegisterInfoInterface.h" #include "lldb/Target/RegisterContext.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" // Internal codes for all powerpc registers. enum { diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h --- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h +++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h @@ -13,7 +13,7 @@ #include "RegisterInfoInterface.h" #include "Utility/PPC64LE_DWARF_Registers.h" #include "lldb/Target/RegisterContext.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" class RegisterContextPOSIX_ppc64le : public lldb_private::RegisterContext { public: diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.h b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.h --- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.h +++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.h @@ -13,7 +13,7 @@ #include "RegisterInfoInterface.h" #include "lldb-s390x-register-enums.h" #include "lldb/Target/RegisterContext.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" class RegisterContextPOSIX_s390x : public lldb_private::RegisterContext { public: diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h --- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h +++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h @@ -13,7 +13,7 @@ #include "RegisterInfoInterface.h" #include "lldb-x86-register-enums.h" #include "lldb/Target/RegisterContext.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" class RegisterContextPOSIX_x86 : public lldb_private::RegisterContext { public: diff --git a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp --- a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp @@ -18,7 +18,7 @@ #include "lldb/Host/windows/ProcessLauncherWindows.h" #include "lldb/Target/Process.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Predicate.h" #include "lldb/Utility/Status.h" diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp --- a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp @@ -9,7 +9,7 @@ #include "lldb/Host/HostThread.h" #include "lldb/Host/windows/HostThreadWindows.h" #include "lldb/Host/windows/windows.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "NativeRegisterContextWindows.h" #include "NativeThreadWindows.h" diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp --- a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp @@ -18,7 +18,7 @@ #include "lldb/Host/windows/HostThreadWindows.h" #include "lldb/Host/windows/windows.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "llvm/ADT/STLExtras.h" diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm.cpp --- a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm.cpp @@ -17,7 +17,7 @@ #include "lldb/Host/windows/HostThreadWindows.h" #include "lldb/Host/windows/windows.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "llvm/ADT/STLExtras.h" diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp --- a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp @@ -17,7 +17,7 @@ #include "lldb/Host/windows/HostThreadWindows.h" #include "lldb/Host/windows/windows.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "llvm/ADT/STLExtras.h" diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp --- a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp @@ -18,7 +18,7 @@ #include "lldb/Host/windows/HostThreadWindows.h" #include "lldb/Host/windows/windows.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "llvm/ADT/STLExtras.h" diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp --- a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp @@ -19,7 +19,7 @@ #include "lldb/Host/windows/HostThreadWindows.h" #include "lldb/Host/windows/windows.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "llvm/ADT/STLExtras.h" diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp --- a/lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp @@ -13,7 +13,7 @@ #include "lldb/Host/windows/HostThreadWindows.h" #include "lldb/Host/windows/windows.h" #include "lldb/Target/Process.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "lldb/lldb-forward.h" @@ -48,7 +48,7 @@ return Status(); if (resume_state == eStateStepping) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); uint32_t flags_index = GetRegisterContext().ConvertRegisterKindToRegisterNumber( @@ -118,7 +118,7 @@ bool NativeThreadWindows::GetStopReason(ThreadStopInfo &stop_info, std::string &description) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); switch (m_state) { case eStateStopped: diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h b/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h --- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h +++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h @@ -9,7 +9,7 @@ #ifndef liblldb_ProcessWindowsLog_h_ #define liblldb_ProcessWindowsLog_h_ -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #define WINDOWS_LOG_PROCESS (1u << 1) // Log process operations #define WINDOWS_LOG_EXCEPTION (1u << 1) // Log exceptions diff --git a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp --- a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp @@ -12,8 +12,7 @@ #include "lldb/Host/windows/windows.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Unwind.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "ProcessWindows.h" @@ -61,7 +60,7 @@ TargetThreadWindows::CreateRegisterContextForFrame(StackFrame *frame) { RegisterContextSP reg_ctx_sp; uint32_t concrete_frame_idx = 0; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); if (frame) concrete_frame_idx = frame->GetConcreteFrameIndex(); @@ -131,7 +130,7 @@ return Status(); if (resume_state == eStateStepping) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "llvm/BinaryFormat/ELF.h" @@ -201,7 +201,7 @@ ArchSpec core_arch(m_core_module_sp->GetArchitecture()); target_arch.MergeFrom(core_arch); GetTarget().SetArchitecture(target_arch); - + SetUnixSignals(UnixSignals::Create(GetArchitecture())); // Ensure we found at least one thread that was stopped on a signal. @@ -238,7 +238,7 @@ exe_module_spec.GetFileSpec().SetFile( m_nt_file_entries[0].path.GetCString(), FileSpec::Style::native); if (exe_module_spec.GetFileSpec()) { - exe_module_sp = GetTarget().GetOrCreateModule(exe_module_spec, + exe_module_sp = GetTarget().GetOrCreateModule(exe_module_spec, true /* notify */); if (exe_module_sp) GetTarget().SetExecutableModule(exe_module_sp, eLoadDependentsNo); @@ -402,7 +402,7 @@ lldb::offset_t offset = 0; int pr_version = data.GetU32(&offset); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (log) { if (pr_version > 1) LLDB_LOGF(log, "FreeBSD PRSTATUS unexpected version %d", pr_version); @@ -430,7 +430,7 @@ lldb::offset_t offset = 0; int pr_version = data.GetU32(&offset); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (log) { if (pr_version > 1) LLDB_LOGF(log, "FreeBSD PRPSINFO unexpected version %d", pr_version); @@ -796,7 +796,7 @@ /// - NT_SIGINFO - Information about the signal that terminated the process /// - NT_AUXV - Process auxiliary vector /// - NT_FILE - Files mapped into memory -/// +/// /// Additionally, for each thread in the process the core file will contain at /// least the NT_PRSTATUS note, containing the thread id and general purpose /// registers. It may include additional notes for other register sets (floating diff --git a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp --- a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp @@ -11,7 +11,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Unwind.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "Plugins/Process/Utility/RegisterContextFreeBSD_i386.h" #include "Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h" @@ -64,7 +64,7 @@ ThreadElfCore::CreateRegisterContextForFrame(StackFrame *frame) { RegisterContextSP reg_ctx_sp; uint32_t concrete_frame_idx = 0; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); if (frame) concrete_frame_idx = frame->GetConcreteFrameIndex(); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -28,7 +28,7 @@ #include "lldb/Target/Platform.h" #include "lldb/Utility/Event.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/Reproducer.h" #include "lldb/Utility/StreamString.h" diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -24,7 +24,7 @@ #include "lldb/Utility/Args.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "lldb/Utility/StreamString.h" @@ -2689,7 +2689,7 @@ packet.Printf("%" PRIx64, tid); StringExtractorGDBRemote response; - if (SendPacketAndWaitForResponse(packet.GetString(), response) + if (SendPacketAndWaitForResponse(packet.GetString(), response) == PacketResult::Success) { if (response.IsOKResponse()) return {{pid, tid}}; @@ -2770,7 +2770,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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/GDBRemoteCommunicationHistory.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp @@ -11,7 +11,7 @@ // Other libraries and framework includes #include "lldb/Core/StreamFile.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace llvm; using namespace lldb; @@ -97,4 +97,3 @@ entry.packet.data.c_str()); } } - diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -30,7 +30,7 @@ #include "lldb/Target/Platform.h" #include "lldb/Utility/Endian.h" #include "lldb/Utility/GDBRemote.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/StructuredData.h" #include "llvm/ADT/StringSwitch.h" @@ -426,7 +426,7 @@ GDBRemoteCommunicationServerCommon::Handle_qUserName( StringExtractorGDBRemote &packet) { #if LLDB_ENABLE_POSIX - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "GDBRemoteCommunicationServerCommon::%s begin", __FUNCTION__); // Packet format: "qUserName:%i" where %i is the uid @@ -1020,7 +1020,7 @@ // 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -35,7 +35,7 @@ #include "lldb/Utility/Endian.h" #include "lldb/Utility/GDBRemote.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/Utility/State.h" #include "lldb/Utility/StreamString.h" @@ -241,7 +241,7 @@ } Status GDBRemoteCommunicationServerLLGS::LaunchProcess() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); if (!m_process_launch_info.GetArguments().GetArgumentCount()) return Status("%s: no process command line specified to launch", @@ -323,7 +323,7 @@ } Status GDBRemoteCommunicationServerLLGS::AttachToProcess(lldb::pid_t pid) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s pid %" PRIu64, __FUNCTION__, pid); @@ -370,7 +370,7 @@ Status GDBRemoteCommunicationServerLLGS::AttachWaitProcess( llvm::StringRef process_name, bool include_existing) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); std::chrono::milliseconds polling_interval = std::chrono::milliseconds(1); @@ -440,7 +440,7 @@ void GDBRemoteCommunicationServerLLGS::InitializeDelegate( NativeProcessProtocol *process) { assert(process && "process cannot be NULL"); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); if (log) { LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called with " @@ -454,7 +454,7 @@ GDBRemoteCommunicationServerLLGS::SendWResponse( NativeProcessProtocol *process) { assert(process && "process cannot be NULL"); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); // send W notification auto wait_status = process->GetExitStatus(); @@ -608,7 +608,7 @@ static llvm::Optional GetRegistersAsJSON(NativeThreadProtocol &thread) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_THREAD)); NativeRegisterContext& reg_ctx = thread.GetRegisterContext(); @@ -693,7 +693,7 @@ static llvm::Expected GetJSONThreadsInfo(NativeProcessProtocol &process, bool abridged) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); json::Array threads_array; @@ -766,7 +766,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread( lldb::tid_t tid) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); // Ensure we have a debugged process. if (!m_current_process || @@ -979,7 +979,7 @@ NativeProcessProtocol *process) { assert(process && "process cannot be NULL"); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__); PacketResult result = SendStopReasonForState(StateType::eStateExited); @@ -1003,7 +1003,7 @@ NativeProcessProtocol *process) { assert(process && "process cannot be NULL"); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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::ProcessStateChanged( NativeProcessProtocol *process, lldb::StateType state) { assert(process && "process cannot be NULL"); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); if (log) { LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called with " @@ -1086,7 +1086,7 @@ } void GDBRemoteCommunicationServerLLGS::DataAvailableCallback() { - Log *log(GetLogIfAnyCategoriesSet(GDBR_LOG_COMM)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_COMM)); bool interrupt = false; bool done = false; @@ -1171,7 +1171,7 @@ 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 = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)) LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s Failed to set up stdio " "forwarding: %s", @@ -1198,7 +1198,7 @@ case eConnectionStatusEndOfFile: case eConnectionStatusError: case eConnectionStatusNoConnection: - if (Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)) + if (Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)) LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s Stopping stdio " "forwarding as communication returned status %d (error: " @@ -1356,7 +1356,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_k(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); StopSTDIOForwarding(); @@ -1425,7 +1425,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_C(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__); // Ensure we have a native process. @@ -1506,7 +1506,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_c(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__); packet.SetFilePos(packet.GetFilePos() + ::strlen("c")); @@ -1556,7 +1556,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_vCont( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s handling vCont packet", __FUNCTION__); @@ -1661,7 +1661,7 @@ } void GDBRemoteCommunicationServerLLGS::SetCurrentThreadID(lldb::tid_t tid) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_THREAD)); LLDB_LOG(log, "setting current thread id to {0}", tid); m_current_tid = tid; @@ -1670,7 +1670,7 @@ } void GDBRemoteCommunicationServerLLGS::SetContinueThreadID(lldb::tid_t tid) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_THREAD)); LLDB_LOG(log, "setting continue thread id to {0}", tid); m_continue_tid = tid; @@ -1691,7 +1691,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::SendStopReasonForState( lldb::StateType process_state) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); switch (process_state) { case eStateAttaching: @@ -1822,7 +1822,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_qfThreadInfo( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_THREAD)); // Fail if we don't have a current process. if (!m_current_process || @@ -1864,7 +1864,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_g(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_THREAD)); // Move past packet name. packet.SetFilePos(strlen("g")); @@ -1919,7 +1919,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_p(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_THREAD)); // Parse out the register number from the request. packet.SetFilePos(strlen("p")); @@ -1995,7 +1995,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_P(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_THREAD)); // Ensure there is more content. if (packet.GetBytesLeft() < 1) @@ -2075,7 +2075,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_H(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_THREAD)); // Parse out which variant of $H is requested. packet.SetFilePos(strlen("H")); @@ -2166,7 +2166,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_I(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_THREAD)); // Fail if we don't have a current process. if (!m_current_process || @@ -2202,7 +2202,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_interrupt( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); // Fail if we don't have a current process. if (!m_current_process || @@ -2228,7 +2228,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_memory_read( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); if (!m_current_process || (m_current_process->GetID() == LLDB_INVALID_PROCESS_ID)) { @@ -2308,7 +2308,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle__M(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); if (!m_current_process || (m_current_process->GetID() == LLDB_INVALID_PROCESS_ID)) { @@ -2357,7 +2357,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle__m(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); if (!m_current_process || (m_current_process->GetID() == LLDB_INVALID_PROCESS_ID)) { @@ -2385,7 +2385,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_M(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); if (!m_current_process || (m_current_process->GetID() == LLDB_INVALID_PROCESS_ID)) { @@ -2465,7 +2465,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfoSupported( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); // Currently only the NativeProcessProtocol knows if it can handle a // qMemoryRegionInfoSupported request, but we're not guaranteed to be @@ -2498,7 +2498,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfo( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); // Ensure we have a process. if (!m_current_process || @@ -2580,7 +2580,7 @@ // 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); LLDB_LOG(log, "failed, no process available"); return SendErrorResponse(0x15); } @@ -2652,7 +2652,7 @@ m_current_process->SetBreakpoint(addr, size, want_hardware); if (error.Success()) return SendOKResponse(); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_BREAKPOINTS)); LLDB_LOG(log, "pid {0} failed to set breakpoint: {1}", m_current_process->GetID(), error); return SendErrorResponse(0x09); @@ -2662,7 +2662,7 @@ addr, size, watch_flags, want_hardware); if (error.Success()) return SendOKResponse(); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOG(log, "pid {0} failed to set watchpoint: {1}", m_current_process->GetID(), error); return SendErrorResponse(0x09); @@ -2674,7 +2674,7 @@ // 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); LLDB_LOG(log, "failed, no process available"); return SendErrorResponse(0x15); } @@ -2740,7 +2740,7 @@ m_current_process->RemoveBreakpoint(addr, want_hardware); if (error.Success()) return SendOKResponse(); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_BREAKPOINTS)); LLDB_LOG(log, "pid {0} failed to remove breakpoint: {1}", m_current_process->GetID(), error); return SendErrorResponse(0x09); @@ -2749,7 +2749,7 @@ const Status error = m_current_process->RemoveWatchpoint(addr); if (error.Success()) return SendOKResponse(); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOG(log, "pid {0} failed to remove watchpoint: {1}", m_current_process->GetID(), error); return SendErrorResponse(0x09); @@ -2758,7 +2758,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_s(StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); // Ensure we have a process. if (!m_continue_process || @@ -2815,7 +2815,7 @@ return llvm::createStringError(llvm::inconvertibleErrorCode(), "No thread available"); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); // Get the register context for the first thread. NativeRegisterContext ®_context = thread->GetRegisterContext(); @@ -3032,7 +3032,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_QSaveRegisterState( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_THREAD)); // Move past packet name. packet.SetFilePos(strlen("QSaveRegisterState")); @@ -3080,7 +3080,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_QRestoreRegisterState( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_THREAD)); // Parse out save id. packet.SetFilePos(strlen("QRestoreRegisterState:")); @@ -3141,7 +3141,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_vAttach( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); // Consume the ';' after vAttach. packet.SetFilePos(strlen("vAttach")); @@ -3177,7 +3177,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_vAttachWait( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); // Consume the ';' after the identifier. packet.SetFilePos(strlen("vAttachWait")); @@ -3213,7 +3213,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_vAttachOrWait( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); // Consume the ';' after the identifier. packet.SetFilePos(strlen("vAttachOrWait")); @@ -3243,7 +3243,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_vRun( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); llvm::StringRef s = packet.GetStringRef(); if (!s.consume_front("vRun;")) @@ -3322,7 +3322,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_qThreadStopInfo( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_THREAD)); packet.SetFilePos(strlen("qThreadStopInfo")); const lldb::tid_t tid = packet.GetHexMaxU64(false, LLDB_INVALID_THREAD_ID); @@ -3339,7 +3339,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_jThreadsInfo( StringExtractorGDBRemote &) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD)); // Ensure we have a debugged process. if (!m_current_process || @@ -3455,7 +3455,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_qMemTags( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); // Ensure we have a process. if (!m_current_process || @@ -3536,7 +3536,7 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerLLGS::Handle_QMemTags( StringExtractorGDBRemote &packet) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); // Ensure we have a process. if (!m_current_process || @@ -3657,7 +3657,7 @@ } void GDBRemoteCommunicationServerLLGS::MaybeCloseInferiorTerminalConnection() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); // Tell the stdio connection to shut down. if (m_stdio_communication.IsConnected()) { @@ -3701,7 +3701,7 @@ return m_current_process->GetThreadByID(current_tid); } - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_THREAD)); // Parse out the ';'. if (packet.GetBytesLeft() < 1 || packet.GetChar() != ';') { @@ -3752,7 +3752,7 @@ } void GDBRemoteCommunicationServerLLGS::ClearProcessSpecificData() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -30,7 +30,7 @@ #include "lldb/Target/Platform.h" #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/GDBRemote.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/StructuredData.h" #include "lldb/Utility/TildeExpressionResolver.h" @@ -178,7 +178,7 @@ if (hostname.empty()) hostname = "127.0.0.1"; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM)); LLDB_LOGF(log, "Launching debugserver with: %s:%u...", hostname.c_str(), *port); @@ -228,7 +228,7 @@ // Spawn a local debugserver as a platform so we can then attach or launch a // process... - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -2919,7 +2919,7 @@ uint32_t permissions, Status &error) { Log *log( - GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_EXPRESSIONS)); + LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_EXPRESSIONS)); addr_t allocated_addr = LLDB_INVALID_ADDRESS; if (m_gdb_comm.SupportsAllocDeallocMemory() != eLazyBoolNo) { @@ -3545,7 +3545,7 @@ llvm::Expected async_thread = ThreadLauncher::LaunchThread( "", ProcessGDBRemote::AsyncThread, this); if (!async_thread) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), async_thread.takeError(), "failed to launch host thread: {}"); return false; @@ -3782,7 +3782,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); LLDB_LOGF(log, "Hit New Thread Notification breakpoint."); return false; } @@ -3825,7 +3825,7 @@ } bool ProcessGDBRemote::StartNoticingNewThreads() { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (m_thread_create_bp_sp) { if (log && log->GetVerbose()) LLDB_LOGF(log, "Enabled noticing new thread breakpoint."); @@ -3851,7 +3851,7 @@ } bool ProcessGDBRemote::StopNoticingNewThreads() { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log && log->GetVerbose()) LLDB_LOGF(log, "Disabling new thread notification breakpoint."); @@ -4120,7 +4120,7 @@ bool ProcessGDBRemote::GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM); const ModuleCacheKey key(module_file_spec.GetPath(), arch.GetTriple().getTriple()); @@ -4501,7 +4501,7 @@ return llvm::createStringError(llvm::inconvertibleErrorCode(), "XML parsing not available"); - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS); LLDB_LOGF(log, "ProcessGDBRemote::%s", __FUNCTION__); LoadedModuleInfoList list; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h @@ -11,19 +11,21 @@ #include "lldb/Utility/Log.h" -#define GDBR_LOG_PROCESS (1u << 1) -#define GDBR_LOG_THREAD (1u << 2) -#define GDBR_LOG_PACKETS (1u << 3) -#define GDBR_LOG_MEMORY (1u << 4) // Log memory reads/writes calls -#define GDBR_LOG_MEMORY_DATA_SHORT \ - (1u << 5) // Log short memory reads/writes bytes -#define GDBR_LOG_MEMORY_DATA_LONG (1u << 6) // Log all memory reads/writes bytes -#define GDBR_LOG_BREAKPOINTS (1u << 7) -#define GDBR_LOG_WATCHPOINTS (1u << 8) -#define GDBR_LOG_STEP (1u << 9) -#define GDBR_LOG_COMM (1u << 10) -#define GDBR_LOG_ASYNC (1u << 11) -#define GDBR_LOG_ALL (UINT32_MAX) +#define GDBR_LOG_PROCESS LLDB_LOG_BIT(1) +#define GDBR_LOG_THREAD LLDB_LOG_BIT(2) +#define GDBR_LOG_PACKETS LLDB_LOG_BIT(3) +// Log memory reads/writes calls +#define GDBR_LOG_MEMORY LLDB_LOG_BIT(4) +// Log short memory reads/writes bytes +#define GDBR_LOG_MEMORY_DATA_SHORT LLDB_LOG_BIT(5) +// Log all memory reads/writes bytes +#define GDBR_LOG_MEMORY_DATA_LONG LLDB_LOG_BIT(6) +#define GDBR_LOG_BREAKPOINTS LLDB_LOG_BIT(7) +#define GDBR_LOG_WATCHPOINTS LLDB_LOG_BIT(8) +#define GDBR_LOG_STEP LLDB_LOG_BIT(9) +#define GDBR_LOG_COMM LLDB_LOG_BIT(10) +#define GDBR_LOG_ASYNC LLDB_LOG_BIT(11) +#define GDBR_LOG_ALL LLDB_LOG_ALL_BITS #define GDBR_LOG_DEFAULT GDBR_LOG_PACKETS namespace lldb_private { @@ -35,8 +37,12 @@ public: static void Initialize(); - static Log *GetLogIfAllCategoriesSet(uint32_t mask) { return g_channel.GetLogIfAll(mask); } - static Log *GetLogIfAnyCategoryIsSet(uint32_t mask) { return g_channel.GetLogIfAny(mask); } + static Log *GetLogIfAllCategoriesSet(LogMask mask) { + return g_channel.GetLogIfAll(mask); + } + static Log *GetLogIfAnyCategoryIsSet(LogMask mask) { + return g_channel.GetLogIfAny(mask); + } }; } // namespace process_gdb_remote diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp @@ -39,7 +39,7 @@ m_dispatch_queue_t(LLDB_INVALID_ADDRESS), m_queue_kind(eQueueKindUnknown), m_queue_serial_number(LLDB_INVALID_QUEUE_ID), m_associated_with_libdispatch_queue(eLazyBoolCalculate) { - Log *log(GetLogIfAnyCategoriesSet(GDBR_LOG_THREAD)); + Log *log(ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_THREAD)); LLDB_LOG(log, "this = {0}, pid = {1}, tid = {2}", this, process.GetID(), GetID()); // At this point we can clone reg_info for architectures supporting @@ -54,7 +54,7 @@ ThreadGDBRemote::~ThreadGDBRemote() { ProcessSP process_sp(GetProcess()); - Log *log(GetLogIfAnyCategoriesSet(GDBR_LOG_THREAD)); + Log *log(ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_THREAD)); LLDB_LOG(log, "this = {0}, pid = {1}, tid = {2}", this, process_sp ? process_sp->GetID() : LLDB_INVALID_PROCESS_ID, GetID()); DestroyThread(); @@ -222,7 +222,7 @@ StructuredData::ObjectSP ThreadGDBRemote::FetchThreadExtendedInfo() { StructuredData::ObjectSP object_sp; const lldb::user_id_t tid = GetProtocolID(); - Log *log(GetLogIfAnyCategoriesSet(GDBR_LOG_THREAD)); + Log *log(ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_THREAD)); LLDB_LOGF(log, "Fetching extended information for thread %4.4" PRIx64, tid); ProcessSP process_sp(GetProcess()); if (process_sp) { @@ -236,7 +236,7 @@ void ThreadGDBRemote::WillResume(StateType resume_state) { int signo = GetResumeSignal(); const lldb::user_id_t tid = GetProtocolID(); - Log *log(GetLogIfAnyCategoriesSet(GDBR_LOG_THREAD)); + Log *log(ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_THREAD)); LLDB_LOGF(log, "Resuming thread: %4.4" PRIx64 " with state: %s.", tid, StateAsCString(resume_state)); diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -25,7 +25,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/DataBuffer.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "ProcessMachCore.h" @@ -124,7 +124,7 @@ } bool ProcessMachCore::GetDynamicLoaderAddress(lldb::addr_t addr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_PROCESS)); llvm::MachO::mach_header header; Status error; @@ -252,7 +252,7 @@ // Process Control Status ProcessMachCore::DoLoadCore() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_PROCESS)); Status error; if (!m_core_module_sp) { diff --git a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp --- a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp +++ b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp @@ -12,7 +12,7 @@ #include "Plugins/Process/Utility/LinuxProcMaps.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" // C includes // C++ includes @@ -84,7 +84,7 @@ if (ExpectedThreads) return *ExpectedThreads; - LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_THREAD), ExpectedThreads.takeError(), "Failed to read thread list: {0}"); return {}; @@ -141,7 +141,7 @@ llvm::Expected system_info = m_file->getSystemInfo(); if (!system_info) { - LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS), system_info.takeError(), "Failed to read SystemInfo stream: {0}"); return m_arch; @@ -200,7 +200,7 @@ triple.setOS(llvm::Triple::OSType::UnknownOS); auto ExpectedCSD = m_file->getString(system_info->CSDVersionRVA); if (!ExpectedCSD) { - LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS), ExpectedCSD.takeError(), "Failed to CSD Version string: {0}"); } else { @@ -251,7 +251,7 @@ if (ExpectedModules) return *ExpectedModules; - LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_MODULES), ExpectedModules.takeError(), "Failed to read module list: {0}"); return {}; @@ -264,7 +264,7 @@ if (data.empty()) return false; - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); ParseLinuxMapRegions( llvm::toStringRef(data), [®ions, &log](llvm::Expected region) -> bool { @@ -345,7 +345,7 @@ } std::vector MinidumpParser::GetFilteredModuleList() { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_MODULES); auto ExpectedModules = GetMinidumpFile().getModuleList(); if (!ExpectedModules) { LLDB_LOG_ERROR(log, ExpectedModules.takeError(), @@ -425,7 +425,7 @@ if (ExpectedStream) return &*ExpectedStream; - LLDB_LOG_ERROR(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS), ExpectedStream.takeError(), "Failed to read minidump exception stream: {0}"); return nullptr; @@ -434,7 +434,7 @@ llvm::Optional MinidumpParser::FindMemoryRange(lldb::addr_t addr) { llvm::ArrayRef data64 = GetStream(StreamType::Memory64List); - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_MODULES); auto ExpectedMemory = GetMinidumpFile().getMemoryList(); if (!ExpectedMemory) { @@ -519,7 +519,7 @@ static bool CreateRegionsCacheFromMemoryInfoList(MinidumpParser &parser, std::vector ®ions) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_MODULES); auto ExpectedInfo = parser.GetMinidumpFile().getMemoryInfoList(); if (!ExpectedInfo) { LLDB_LOG_ERROR(log, ExpectedInfo.takeError(), @@ -556,7 +556,7 @@ static bool CreateRegionsCacheFromMemoryList(MinidumpParser &parser, std::vector ®ions) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -27,7 +27,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "llvm/BinaryFormat/Magic.h" #include "llvm/Support/MemoryBuffer.h" @@ -480,7 +480,7 @@ ModuleSP ProcessMinidump::GetOrCreateModule(UUID minidump_uuid, llvm::StringRef name, ModuleSpec module_spec) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); Status error; ModuleSP module_sp = @@ -528,7 +528,7 @@ std::vector filtered_modules = m_minidump_parser->GetFilteredModuleList(); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); for (auto module : filtered_modules) { std::string name = cantFail(m_minidump_parser->GetMinidumpFile().getString( diff --git a/lldb/source/Plugins/Process/minidump/ThreadMinidump.cpp b/lldb/source/Plugins/Process/minidump/ThreadMinidump.cpp --- a/lldb/source/Plugins/Process/minidump/ThreadMinidump.cpp +++ b/lldb/source/Plugins/Process/minidump/ThreadMinidump.cpp @@ -25,7 +25,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Unwind.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp --- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp +++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp @@ -66,7 +66,7 @@ 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", + LLDB_LOGF(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS), "%s", error.AsCString()); return nullptr; } @@ -178,7 +178,7 @@ Status ScriptedProcess::DoResume() { CheckInterpreterAndScriptObject(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); // FIXME: Fetch data from thread. const StateType thread_resume_state = eStateRunning; LLDB_LOGF(log, "ScriptedProcess::%s thread_resume_state = %s", __FUNCTION__, @@ -202,7 +202,7 @@ Status ScriptedProcess::DoStop() { CheckInterpreterAndScriptObject(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (GetInterface().ShouldStop()) { SetPrivateState(eStateStopped); diff --git a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp --- a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp +++ b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp @@ -15,8 +15,7 @@ #include "lldb/Target/StopInfo.h" #include "lldb/Target/Unwind.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" #include diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp @@ -16,7 +16,7 @@ #include "lldb/Host/File.h" #include "lldb/Host/FileSystem.h" #include "lldb/Interpreter/ScriptInterpreter.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" #include "llvm/ADT/StringSwitch.h" @@ -1022,7 +1022,7 @@ PyErr_Clear(); } } - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -133,7 +133,7 @@ ~InitializePythonRAII() { if (m_was_already_initialized) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked", m_gil_state == PyGILState_UNLOCKED ? "un" : ""); PyGILState_Release(m_gil_state); @@ -203,7 +203,7 @@ #endif if (PyEval_ThreadsInitialized()) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); m_was_already_initialized = true; m_gil_state = PyGILState_Ensure(); @@ -360,7 +360,7 @@ } bool ScriptInterpreterPythonImpl::Locker::DoAcquireLock() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); m_GILState = PyGILState_Ensure(); LLDB_LOGV(log, "Ensured PyGILState. Previous state = {0}locked", m_GILState == PyGILState_UNLOCKED ? "un" : ""); @@ -384,7 +384,7 @@ } bool ScriptInterpreterPythonImpl::Locker::DoFreeLock() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); LLDB_LOGV(log, "Releasing PyGILState. Returning to state = {0}locked", m_GILState == PyGILState_UNLOCKED ? "un" : ""); PyGILState_Release(m_GILState); @@ -572,7 +572,7 @@ } void ScriptInterpreterPythonImpl::LeaveSession() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); if (log) log->PutCString("ScriptInterpreterPythonImpl::LeaveSession()"); @@ -642,7 +642,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); if (m_session_is_active) { LLDB_LOGF( log, @@ -944,7 +944,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); if (IsExecutingPython()) { PyThreadState *state = PyThreadState_GET(); diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp @@ -7,8 +7,7 @@ //===----------------------------------------------------------------------===// #include "lldb/Host/Config.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/lldb-enumerations.h" #if LLDB_ENABLE_PYTHON diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp @@ -7,8 +7,7 @@ //===----------------------------------------------------------------------===// #include "lldb/Host/Config.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/lldb-enumerations.h" #if LLDB_ENABLE_PYTHON diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp @@ -7,8 +7,7 @@ //===----------------------------------------------------------------------===// #include "lldb/Host/Config.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/lldb-enumerations.h" #if LLDB_ENABLE_PYTHON diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp --- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -28,7 +28,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Target/ThreadPlanCallOnFunctionExit.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegularExpression.h" #define DARWIN_LOG_TYPE_VALUE "DarwinLog" @@ -958,7 +958,7 @@ }; EnableOptionsSP ParseAutoEnableOptions(Status &error, Debugger &debugger) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); // We are abusing the options data model here so that we can parse options // without requiring the Debugger instance. @@ -1062,7 +1062,7 @@ void StructuredDataDarwinLog::HandleArrivalOfStructuredData( Process &process, ConstString type_name, const StructuredData::ObjectSP &object_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (log) { StreamString json_stream; if (object_sp) @@ -1211,7 +1211,7 @@ void StructuredDataDarwinLog::ModulesDidLoad(Process &process, ModuleList &module_list) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "StructuredDataDarwinLog::%s called (process uid %u)", __FUNCTION__, process.GetUniqueID()); @@ -1388,7 +1388,7 @@ // 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM)); // If the target architecture is not one that supports DarwinLog, we have // nothing to do here. @@ -1466,7 +1466,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "StructuredDataDarwinLog::%s() called", __FUNCTION__); // Get the current thread. @@ -1570,7 +1570,7 @@ } void StructuredDataDarwinLog::AddInitCompletionHook(Process &process) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "StructuredDataDarwinLog::%s() called (process uid %u)", __FUNCTION__, process.GetUniqueID()); @@ -1769,7 +1769,7 @@ } void StructuredDataDarwinLog::EnableNow() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp +++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp @@ -17,7 +17,7 @@ #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/TypeMap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "llvm/ADT/StringExtras.h" @@ -228,7 +228,7 @@ if (FunctionSP func_sp = comp_unit.FindFunctionByUID(id)) return func_sp; - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); FunctionSP func_sp; addr_t base = GetBaseFileAddress(); if (base == LLDB_INVALID_ADDRESS) { @@ -347,7 +347,7 @@ return; m_inline_origins.emplace(); - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); for (llvm::StringRef line : lines(Record::InlineOrigin)) { auto record = InlineOriginRecord::parse(line); if (!record) { @@ -455,7 +455,7 @@ llvm::DenseSet &searched_symbol_files, TypeMap &types) {} void SymbolFileBreakpad::AddSymbols(Symtab &symtab) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); Module &module = *m_objfile_sp->GetModule(); addr_t base = GetBaseFileAddress(); if (base == LLDB_INVALID_ADDRESS) { @@ -581,7 +581,7 @@ bool SymbolFileBreakpad::ParseCFIUnwindRow(llvm::StringRef unwind_rules, const RegisterInfoResolver &resolver, UnwindPlan::Row &row) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); llvm::BumpPtrAllocator node_alloc; llvm::Triple triple = m_objfile_sp->GetArchitecture().GetTriple(); @@ -690,7 +690,7 @@ UnwindPlanSP SymbolFileBreakpad::ParseWinUnwindPlan(const Bookmark &bookmark, const RegisterInfoResolver &resolver) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); addr_t base = GetBaseFileAddress(); if (base == LLDB_INVALID_ADDRESS) return nullptr; @@ -794,7 +794,7 @@ return; m_files.emplace(); - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); for (llvm::StringRef line : lines(Record::File)) { auto record = FileRecord::parse(line); if (!record) { @@ -815,7 +815,7 @@ return; m_cu_data.emplace(); - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ return; m_unwind_data.emplace(); - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -32,7 +32,7 @@ #include "lldb/Symbol/TypeMap.h" #include "lldb/Target/Language.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "llvm/Demangle/Demangle.h" diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp @@ -14,7 +14,7 @@ #include "lldb/Core/Module.h" #include "lldb/Symbol/ObjectFile.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace lldb_private; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp @@ -10,7 +10,7 @@ #include "DWARFDebugArangeSet.h" #include "DWARFUnit.h" #include "LogChannelDWARF.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Timer.h" using namespace lldb; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h --- a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h @@ -11,12 +11,12 @@ #include "lldb/Utility/Log.h" -#define DWARF_LOG_DEBUG_INFO (1u << 1) -#define DWARF_LOG_DEBUG_LINE (1u << 2) -#define DWARF_LOG_LOOKUPS (1u << 3) -#define DWARF_LOG_TYPE_COMPLETION (1u << 4) -#define DWARF_LOG_DEBUG_MAP (1u << 5) -#define DWARF_LOG_ALL (UINT32_MAX) +#define DWARF_LOG_DEBUG_INFO LLDB_LOG_BIT(1) +#define DWARF_LOG_DEBUG_LINE LLDB_LOG_BIT(2) +#define DWARF_LOG_LOOKUPS LLDB_LOG_BIT(3) +#define DWARF_LOG_TYPE_COMPLETION LLDB_LOG_BIT(4) +#define DWARF_LOG_DEBUG_MAP LLDB_LOG_BIT(5) +#define DWARF_LOG_ALL LLDB_LOG_ALL_BITS #define DWARF_LOG_DEFAULT (DWARF_LOG_DEBUG_INFO) namespace lldb_private { @@ -27,8 +27,8 @@ static void Initialize(); static void Terminate(); - static Log *GetLogIfAll(uint32_t mask) { return g_channel.GetLogIfAll(mask); } - static Log *GetLogIfAny(uint32_t mask) { return g_channel.GetLogIfAny(mask); } + static Log *GetLogIfAll(LogMask mask) { return g_channel.GetLogIfAll(mask); } + static Log *GetLogIfAny(LogMask mask) { return g_channel.GetLogIfAny(mask); } }; } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -825,7 +825,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Unable to parse function"); return nullptr; } @@ -2099,7 +2099,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Unable to match namespace decl using TypeSystem"); return false; @@ -2871,7 +2871,7 @@ auto type_system_or_err = GetTypeSystemForLanguage(language); if (auto err = type_system_or_err.takeError()) { LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), + LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Cannot get TypeSystem for language {}", Language::GetNameForLanguageType(language)); } else { @@ -2969,7 +2969,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Unable to parse type"); return {}; } @@ -3803,7 +3803,7 @@ if (!has_call_edges) return {}; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); LLDB_LOG(log, "CollectCallEdges: Found call site info in {0}", function_die.GetPubname()); @@ -4027,7 +4027,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Unable to get DWARFASTParser"); return nullptr; } diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp --- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -29,7 +29,7 @@ #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/Variable.h" #include "lldb/Symbol/VariableList.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/DebugInfo/CodeView/CVRecord.h" #include "llvm/DebugInfo/CodeView/CVTypeVisitor.h" @@ -302,7 +302,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Failed to initialize"); } else { ts_or_err->SetSymbolFile(this); @@ -1904,4 +1904,3 @@ // PDB files are a separate file that contains all debug info. return m_index->pdb().getFileSize(); } - diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp --- a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp @@ -169,7 +169,7 @@ TypeSystemClang::SetIntegerInitializerForVariable( decl, constant.Value.extOrTrunc(type_width)); } else { - LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ decl->setConstexpr(true); } else { LLDB_LOG( - GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST), + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -1298,7 +1298,7 @@ TypeSystemClang::SetIntegerInitializerForVariable( decl, value.toAPSInt().extOrTrunc(type_width)); } else { - LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ decl, value.toAPFloat()); decl->setConstexpr(true); } else { - LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -24,7 +24,7 @@ #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/TypeMap.h" #include "lldb/Symbol/Variable.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegularExpression.h" #include "llvm/DebugInfo/PDB/GenericError.h" @@ -307,7 +307,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Unable to parse PDBFunc"); return nullptr; } @@ -557,7 +557,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Unable to ResolveTypeUID"); return nullptr; } @@ -594,7 +594,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Unable to get dynamic array info for UID"); return false; } @@ -616,7 +616,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Unable to get decl for UID"); return CompilerDecl(); } @@ -646,7 +646,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Unable to get DeclContext for UID"); return CompilerDeclContext(); } @@ -676,7 +676,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Unable to get DeclContext containing UID"); return CompilerDeclContext(); } @@ -705,7 +705,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Unable to parse decls for context"); return; } @@ -1445,7 +1445,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Unable to dump ClangAST"); return; } @@ -1658,7 +1658,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Unable to get PDB AST parser"); return nullptr; } @@ -1678,7 +1678,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Unable to find namespace {}", name.AsCString()); return CompilerDeclContext(); @@ -1974,7 +1974,7 @@ decl_ctx_type_system->GetMinimumLanguage(nullptr)); if (auto err = type_system_or_err.takeError()) { LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), + LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -129,7 +129,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); lldb::addr_t args_addr = LLDB_INVALID_ADDRESS; FunctionCaller *get_item_info_caller = nullptr; @@ -218,7 +218,7 @@ TargetSP target_sp(thread.CalculateTarget()); TypeSystemClang *clang_ast_context = ScratchTypeSystemClang::GetForTarget(*target_sp); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); 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 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -133,7 +133,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); lldb::addr_t args_addr = LLDB_INVALID_ADDRESS; FunctionCaller *get_pending_items_caller = nullptr; @@ -217,7 +217,7 @@ TargetSP target_sp(thread.CalculateTarget()); TypeSystemClang *clang_ast_context = ScratchTypeSystemClang::GetForTarget(*target_sp); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); 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 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -146,7 +146,7 @@ Address impl_code_address; DiagnosticManager diagnostics; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); lldb::addr_t args_addr = LLDB_INVALID_ADDRESS; FunctionCaller *get_queues_caller = nullptr; @@ -222,7 +222,7 @@ TargetSP target_sp(thread.CalculateTarget()); TypeSystemClang *clang_ast_context = ScratchTypeSystemClang::GetForTarget(*target_sp); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); 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 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp @@ -22,7 +22,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "lldb/lldb-private.h" @@ -140,7 +140,7 @@ ExecutionContext exe_ctx(thread_sp); Address impl_code_address; DiagnosticManager diagnostics; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); lldb::addr_t args_addr = LLDB_INVALID_ADDRESS; FunctionCaller *get_thread_item_info_caller = nullptr; @@ -224,7 +224,7 @@ TargetSP target_sp(thread.CalculateTarget()); TypeSystemClang *clang_ast_context = ScratchTypeSystemClang::GetForTarget(*target_sp); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); 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 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -24,7 +24,7 @@ #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "SystemRuntimeMacOSX.h" @@ -880,7 +880,7 @@ lldb_private::QueueList &queue_list) { Status error; DataBufferHeap data(queues_buffer_size, 0); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYSTEM_RUNTIME)); 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.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -34,8 +34,8 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Flags.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/lldb-enumerations.h" class DWARFASTParserClang; @@ -92,7 +92,7 @@ void SetOwningModule(OptionalClangModuleID id); /// \} }; - + /// A TypeSystem implementation based on Clang. /// /// This class uses a single clang::ASTContext as the backend for storing @@ -335,7 +335,7 @@ llvm::SmallVector names; llvm::SmallVector args; - + const char * pack_name = nullptr; std::unique_ptr packed_args; }; @@ -538,7 +538,7 @@ #ifndef NDEBUG bool Verify(lldb::opaque_compiler_type_t type) override; #endif - + bool IsArrayType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size, bool *is_incomplete) override; diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -67,7 +67,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/Scalar.h" @@ -689,7 +689,7 @@ class NullDiagnosticConsumer : public DiagnosticConsumer { public: NullDiagnosticConsumer() { - m_log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); + m_log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); } void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, @@ -1148,7 +1148,7 @@ break; } - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES); 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 +1492,7 @@ // 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS); LLDB_LOG(log, "Don't know how to compare template parameter to passed" " value. Decl kind of parameter is: {0}", @@ -9793,7 +9793,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_TARGET), std::move(err), "Couldn't get scratch TypeSystemClang"); return nullptr; } diff --git a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp --- a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp +++ b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp @@ -21,7 +21,7 @@ #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -72,7 +72,7 @@ m_arch, nullptr, nullptr, range.GetBaseAddress(), opcode_data, opcode_size, 99999, prefer_file_cache)); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); if (disasm_sp) { @@ -379,7 +379,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); if (log && log->GetVerbose()) { StreamString strm; @@ -411,7 +411,7 @@ instruction->GetArchitecture().GetByteOrder(), instruction->GetArchitecture().GetAddressByteSize()); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); if (log && log->GetVerbose()) { StreamString strm; @@ -492,7 +492,7 @@ RegisterValue ®_value) { bool synthetic = GetRegisterValue(*reg_info, reg_value); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); if (log && log->GetVerbose()) { @@ -518,7 +518,7 @@ bool UnwindAssemblyInstEmulation::WriteRegister( EmulateInstruction *instruction, const EmulateInstruction::Context &context, const RegisterInfo *reg_info, const RegisterValue ®_value) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); if (log && log->GetVerbose()) { diff --git a/lldb/source/Symbol/Block.cpp b/lldb/source/Symbol/Block.cpp --- a/lldb/source/Symbol/Block.cpp +++ b/lldb/source/Symbol/Block.cpp @@ -13,7 +13,7 @@ #include "lldb/Symbol/Function.h" #include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/VariableList.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include @@ -334,7 +334,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Symbol/CompactUnwindInfo.cpp +++ b/lldb/source/Symbol/CompactUnwindInfo.cpp @@ -15,7 +15,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "llvm/Support/MathExtras.h" @@ -182,7 +182,7 @@ if (ArchSpec arch = m_objfile.GetArchitecture()) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); if (log && log->GetVerbose()) { StreamString strm; addr.Dump( @@ -251,7 +251,7 @@ return; } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Symbol/DWARFCallFrameInfo.cpp +++ b/lldb/source/Symbol/DWARFCallFrameInfo.cpp @@ -16,7 +16,7 @@ #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ArchSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Timer.h" #include #include @@ -396,7 +396,7 @@ void DWARFCallFrameInfo::GetCFIData() { if (!m_cfi_data_initialized) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset, Address startaddr, UnwindPlan &unwind_plan) { - Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Symbol/Function.cpp +++ b/lldb/source/Symbol/Function.cpp @@ -18,7 +18,7 @@ #include "lldb/Symbol/SymbolFile.h" #include "lldb/Target/Language.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/Support/Casting.h" using namespace lldb; @@ -122,7 +122,7 @@ lldb::addr_t CallEdge::GetLoadAddress(lldb::addr_t unresolved_pc, Function &caller, Target &target) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); const Address &caller_start_addr = caller.GetAddressRange().GetBaseAddress(); @@ -152,7 +152,7 @@ if (resolved) return; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); LLDB_LOG(log, "DirectCallEdge: Lazily parsing the call graph for {0}", lazy_callee.symbol_name); @@ -191,7 +191,7 @@ Function *IndirectCallEdge::GetCallee(ModuleList &images, ExecutionContext &exe_ctx) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); Status error; Value callee_addr_val; if (!call_target.Evaluate(&exe_ctx, exe_ctx.GetRegisterContext(), @@ -295,7 +295,7 @@ if (m_call_edges_resolved) return m_call_edges; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Symbol/LocateSymbolFile.cpp +++ b/lldb/source/Symbol/LocateSymbolFile.cpp @@ -15,7 +15,7 @@ #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Reproducer.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/Timer.h" @@ -152,7 +152,7 @@ static bool LocateDSYMInVincinityOfExecutable(const ModuleSpec &module_spec, FileSpec &dsym_fspec) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Symbol/LocateSymbolFileMacOSX.cpp +++ b/lldb/source/Symbol/LocateSymbolFileMacOSX.cpp @@ -26,7 +26,7 @@ #include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/ReproducerProvider.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/Timer.h" @@ -44,7 +44,7 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec, ModuleSpec &return_module_spec) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); if (!ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup()) { LLDB_LOGF(log, "Spotlight lookup for .dSYM bundles is disabled."); return 0; @@ -306,7 +306,7 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict, ModuleSpec &module_spec) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); bool success = false; if (uuid_dict != NULL && CFGetTypeID(uuid_dict) == CFDictionaryGetTypeID()) { std::string str; @@ -592,7 +592,7 @@ g_dsym_for_uuid_exe_path, file_path); if (!command.GetString().empty()) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -19,7 +19,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Timer.h" #include "lldb/lldb-private.h" @@ -251,7 +251,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); LLDB_LOGF(log, "%p ObjectFile::ObjectFile() module = %p (%s), file = %s, " "file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64, @@ -270,7 +270,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); LLDB_LOGF(log, "%p ObjectFile::ObjectFile() module = %p (%s), process = %p, " "header_addr = 0x%" PRIx64, @@ -280,7 +280,7 @@ } ObjectFile::~ObjectFile() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); LLDB_LOGF(log, "%p ObjectFile::~ObjectFile ()\n", static_cast(this)); } @@ -573,7 +573,7 @@ void ObjectFile::ClearSymtab() { ModuleSP module_sp(GetModule()); if (module_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -19,7 +19,7 @@ #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/Variable.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -477,7 +477,7 @@ curr_inlined_block_inlined_info->GetCallSite().GetColumn(); return true; } else { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); if (log) { LLDB_LOGF( diff --git a/lldb/source/Symbol/SymbolFile.cpp b/lldb/source/Symbol/SymbolFile.cpp --- a/lldb/source/Symbol/SymbolFile.cpp +++ b/lldb/source/Symbol/SymbolFile.cpp @@ -15,7 +15,7 @@ #include "lldb/Symbol/TypeMap.h" #include "lldb/Symbol/TypeSystem.h" #include "lldb/Symbol/VariableList.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "lldb/lldb-private.h" diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -11,7 +11,7 @@ #include "lldb/Core/Module.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Scalar.h" #include "lldb/Utility/StreamString.h" @@ -536,7 +536,7 @@ m_symbol_file->GetTypeSystemForLanguage(eLanguageTypeC); if (auto err = type_system_or_err.takeError()) { LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS), + LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_SYMBOLS), std::move(err), "Unable to construct void type from TypeSystemClang"); } else { diff --git a/lldb/source/Symbol/UnwindPlan.cpp b/lldb/source/Symbol/UnwindPlan.cpp --- a/lldb/source/Symbol/UnwindPlan.cpp +++ b/lldb/source/Symbol/UnwindPlan.cpp @@ -13,7 +13,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/DebugInfo/DWARF/DWARFExpression.h" using namespace lldb; @@ -406,7 +406,7 @@ if (idx < m_row_list.size()) return m_row_list[idx]; else { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); LLDB_LOGF(log, "error: UnwindPlan::GetRowAtIndex(idx = %u) invalid index " "(number rows is %u)", @@ -417,7 +417,7 @@ const UnwindPlan::RowSP UnwindPlan::GetLastRow() const { if (m_row_list.empty()) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); LLDB_LOGF(log, "UnwindPlan::GetLastRow() when rows are empty"); return UnwindPlan::RowSP(); } @@ -434,7 +434,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); if (log) { StreamString s; if (addr.Dump(&s, nullptr, Address::DumpStyleSectionNameOffset)) { @@ -457,7 +457,7 @@ if (GetRowAtIndex(0).get() == nullptr || GetRowAtIndex(0)->GetCFAValue().GetValueType() == Row::FAValue::unspecified) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/ABI.cpp +++ b/lldb/source/Target/ABI.cpp @@ -15,7 +15,7 @@ #include "lldb/Symbol/TypeSystem.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/MC/TargetRegistry.h" #include @@ -203,7 +203,7 @@ const llvm::Target *target = llvm::TargetRegistry::lookupTarget(triple, lookup_error); if (!target) { - LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/AssertFrameRecognizer.cpp +++ b/lldb/source/Target/AssertFrameRecognizer.cpp @@ -6,8 +6,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Target/AssertFrameRecognizer.h" @@ -53,7 +52,7 @@ location.symbols_are_regex = true; break; default: - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); LLDB_LOG(log, "AssertFrameRecognizer::GetAbortLocation Unsupported OS"); return false; } @@ -83,7 +82,7 @@ location.symbols.push_back(ConstString("__GI___assert_fail")); break; default: - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); LLDB_LOG(log, "AssertFrameRecognizer::GetAssertLocation Unsupported OS"); return false; } @@ -151,7 +150,7 @@ prev_frame_sp = thread_sp->GetStackFrameAtIndex(frame_index); if (!prev_frame_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/DynamicRegisterInfo.cpp +++ b/lldb/source/Target/DynamicRegisterInfo.cpp @@ -11,7 +11,7 @@ #include "lldb/DataFormatters/FormatManager.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Utility/ArchSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/StringExtractor.h" #include "lldb/Utility/StructuredData.h" @@ -192,7 +192,7 @@ size_t DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict, const ArchSpec &arch) { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/Memory.cpp +++ b/lldb/source/Target/Memory.cpp @@ -9,7 +9,7 @@ #include "lldb/Target/Memory.h" #include "lldb/Target/Process.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RangeMap.h" #include "lldb/Utility/State.h" @@ -265,8 +265,8 @@ // We must return something valid for zero bytes. if (size == 0) size = 1; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); - + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ addr_t addr = m_process.DoAllocateMemory(page_byte_size, permissions, error); - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (log) { LLDB_LOGF(log, "Process::DoAllocateMemory (byte_size = 0x%8.8" PRIx32 @@ -390,7 +390,7 @@ if (block_sp) addr = block_sp->ReserveBlock(byte_size); } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "AllocatedMemoryCache::AllocateMemory (byte_size = 0x%8.8" PRIx32 ", permissions = %s) => 0x%16.16" PRIx64, @@ -410,7 +410,7 @@ break; } } - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/ModuleCache.cpp +++ b/lldb/source/Target/ModuleCache.cpp @@ -13,7 +13,7 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Host/File.h" #include "lldb/Host/LockFile.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/FileUtilities.h" @@ -80,7 +80,7 @@ void DeleteExistingModule(const FileSpec &root_dir_spec, const FileSpec &sysroot_module_path_spec) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES)); UUID module_uuid; { auto module_sp = diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -34,7 +34,7 @@ #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StructuredData.h" #include "llvm/Support/FileSystem.h" @@ -391,7 +391,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); LLDB_LOGF(log, "%p Platform::Platform()", static_cast(this)); } @@ -620,7 +620,7 @@ Status Platform::Install(const FileSpec &src, const FileSpec &dst) { Status error; - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM); LLDB_LOGF(log, "Platform::Install (src='%s', dst='%s')", src.GetPath().c_str(), dst.GetPath().c_str()); FileSpec fixed_dst(dst); @@ -730,7 +730,7 @@ bool Platform::SetWorkingDirectory(const FileSpec &file_spec) { if (IsHost()) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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()); @@ -799,7 +799,7 @@ } bool Platform::SetRemoteWorkingDirectory(const FileSpec &working_dir) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PLATFORM); LLDB_LOGF(log, "Platform::SetRemoteWorkingDirectory('%s')", working_dir.GetCString()); m_working_dir = working_dir; @@ -1053,7 +1053,7 @@ Status Platform::LaunchProcess(ProcessLaunchInfo &launch_info) { Status error; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); LLDB_LOGF(log, "Platform::%s()", __FUNCTION__); // Take care of the host case so that each subclass can just call this @@ -1106,7 +1106,7 @@ } Status Platform::KillProcess(const lldb::pid_t pid) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); LLDB_LOGF(log, "Platform::%s, pid %" PRIu64, __FUNCTION__, pid); if (!IsHost()) { @@ -1120,7 +1120,7 @@ lldb::ProcessSP Platform::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target &target, Status &error) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); LLDB_LOG(log, "target = {0})", &target); ProcessSP process_sp; @@ -1247,7 +1247,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); LLDB_LOGF(log, "[PutFile] Using block by block transfer....\n"); auto source_open_options = @@ -1643,7 +1643,7 @@ !GetGlobalPlatformProperties().GetModuleCacheDirectory()) return false; - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -64,7 +64,7 @@ #include "lldb/Target/ThreadPlanStack.h" #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/Event.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/NameMatches.h" #include "lldb/Utility/ProcessInfo.h" #include "lldb/Utility/SelectHelper.h" @@ -439,7 +439,7 @@ m_run_thread_plan_lock(), m_can_jit(eCanJITDontKnow) { CheckInWithManager(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); LLDB_LOGF(log, "%p Process::Process()", static_cast(this)); if (!m_unix_signals_sp) @@ -489,7 +489,7 @@ } Process::~Process() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); LLDB_LOGF(log, "%p Process::~Process()", static_cast(this)); StopPrivateStateThread(); @@ -630,7 +630,7 @@ auto Result = m_iohandler_sync.WaitForValueNotEqualTo(iohandler_id, timeout); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (Result) { LLDB_LOG( log, @@ -657,7 +657,7 @@ if (state == eStateDetached || state == eStateExited) return state; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOG(log, "timeout = {0}", timeout); if (!wait_always && StateIsStoppedState(state, true) && @@ -954,7 +954,7 @@ StateType Process::GetStateChangedEvents(EventSP &event_sp, const Timeout &timeout, ListenerSP hijack_listener_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOG(log, "timeout = {0}, event_sp)...", timeout); ListenerSP listener_sp = hijack_listener_sp; @@ -976,7 +976,7 @@ } Event *Process::PeekAtStateChangedEvents() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::%s...", __FUNCTION__); @@ -997,7 +997,7 @@ StateType Process::GetStateChangedEventsPrivate(EventSP &event_sp, const Timeout &timeout) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOG(log, "timeout = {0}, event_sp)...", timeout); StateType state = eStateInvalid; @@ -1016,7 +1016,7 @@ bool Process::GetEventsPrivate(EventSP &event_sp, const Timeout &timeout, bool control_only) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOG(log, "timeout = {0}, event_sp)...", timeout); if (control_only) @@ -1050,7 +1050,7 @@ // 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 | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS)); LLDB_LOGF( log, "Process::SetExitStatus (status=%i (0x%8.8x), description=%s%s%s)", @@ -1106,7 +1106,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::SetProcessExitStatus (pid=%" PRIu64 ", exited=%i, signal=%i, exit_status=%i)\n", @@ -1307,7 +1307,7 @@ GetTarget().GetStatistics().SetFirstPublicStopTime(); } - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::SetPublicState (state = %s, restarted = %i)", StateAsCString(new_state), restarted); @@ -1337,7 +1337,7 @@ } Status Process::Resume() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::Resume -- locking run lock"); if (!m_public_run_lock.TrySetRunning()) { @@ -1356,7 +1356,7 @@ static const char *g_resume_sync_name = "lldb.Process.ResumeSynchronous.hijack"; Status Process::ResumeSynchronous(Stream *stream) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::ResumeSynchronous -- locking run lock"); if (!m_public_run_lock.TrySetRunning()) { @@ -1416,7 +1416,7 @@ if (m_finalizing) return; - Log *log(lldb_private::GetLogIfAnyCategoriesSet( + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet( LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_UNWIND)); bool state_changed = false; @@ -1755,7 +1755,7 @@ Status Process::EnableSoftwareBreakpoint(BreakpointSite *bp_site) { Status error; assert(bp_site != nullptr); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_BREAKPOINTS)); const addr_t bp_addr = bp_site->GetLoadAddress(); LLDB_LOGF( log, "Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64, @@ -1831,7 +1831,7 @@ Status Process::DisableSoftwareBreakpoint(BreakpointSite *bp_site) { Status error; assert(bp_site != nullptr); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_BREAKPOINTS)); addr_t bp_addr = bp_site->GetLoadAddress(); lldb::user_id_t breakID = bp_site->GetID(); LLDB_LOGF(log, @@ -2265,7 +2265,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::AllocateMemory(size=%" PRIu64 ", permissions=%s) => 0x%16.16" PRIx64 @@ -2289,7 +2289,7 @@ bool Process::CanJIT() { if (m_can_jit == eCanJITDontKnow) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); Status err; uint64_t allocated_memory = AllocateMemory( @@ -2335,7 +2335,7 @@ #else error = DoDeallocateMemory(ptr); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::DeallocateMemory(addr=0x%16.16" PRIx64 ") => err = %s (m_stop_id = %u, m_memory_id = %u)", @@ -2348,7 +2348,7 @@ 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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); if (log) { LLDB_LOGF(log, "Process::ReadModuleFromMemory reading %s binary from memory", @@ -2449,7 +2449,7 @@ // be a way to express this path, without actually having a module. // The way to do that is to set the ExecutableFile in the LaunchInfo. // Figure that out here: - + FileSpec exe_spec_to_use; if (!exe_module) { if (!launch_info.GetExecutableFile()) { @@ -2459,7 +2459,7 @@ exe_spec_to_use = launch_info.GetExecutableFile(); } else exe_spec_to_use = exe_module->GetFileSpec(); - + if (exe_module && FileSystem::Instance().Exists(exe_module->GetFileSpec())) { // Install anything that might need to be installed prior to launching. // For host systems, this will do nothing, but if we are connected to a @@ -2601,7 +2601,7 @@ WaitForProcessToStop(llvm::None, &event_sp, true, listener_sp); if (!StateIsStoppedState(state, false)) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::Halt() failed to stop, state is: %s", StateAsCString(state)); error.SetErrorString( @@ -2641,7 +2641,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF( log, "Process::AttachCompletionHandler::%s process=%p, exec_count=%" PRIu32, @@ -2650,7 +2650,7 @@ Process::NextEventAction::EventActionResult Process::AttachCompletionHandler::PerformAction(lldb::EventSP &event_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); StateType state = ProcessEventData::GetStateFromEvent(event_sp.get()); LLDB_LOGF(log, @@ -2843,7 +2843,7 @@ } void Process::CompleteAttach() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TARGET)); LLDB_LOGF(log, "Process::%s()", __FUNCTION__); @@ -2999,7 +2999,7 @@ } Status Process::PrivateResume() { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_STEP)); LLDB_LOGF(log, "Process::PrivateResume() m_stop_id = %u, public state: %s " @@ -3104,7 +3104,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::%s() About to stop.", __FUNCTION__); ListenerSP listener_sp( @@ -3311,7 +3311,7 @@ const StateType state = Process::ProcessEventData::GetStateFromEvent(event_ptr); bool return_value = true; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EVENTS | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_EVENTS | LIBLLDB_LOG_PROCESS)); switch (state) { @@ -3463,7 +3463,7 @@ } bool Process::StartPrivateStateThread(bool is_secondary_thread) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); bool already_running = PrivateStateThreadIsValid(); LLDB_LOGF(log, "Process::%s()%s ", __FUNCTION__, @@ -3501,7 +3501,7 @@ ThreadLauncher::LaunchThread(thread_name, Process::PrivateStateThread, (void *)args_ptr, 8 * 1024 * 1024); if (!private_state_thread) { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), "failed to launch host thread: {}", llvm::toString(private_state_thread.takeError())); return false; @@ -3525,7 +3525,7 @@ if (m_private_state_thread.IsJoinable()) ControlPrivateStateThread(eBroadcastInternalStateControlStop); else { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF( log, "Went to stop the private state thread, but it was already invalid."); @@ -3533,7 +3533,7 @@ } void Process::ControlPrivateStateThread(uint32_t signal) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); assert(signal == eBroadcastInternalStateControlStop || signal == eBroadcastInternalStateControlPause || @@ -3591,7 +3591,7 @@ } void Process::HandlePrivateEvent(EventSP &event_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); m_resume_requested = false; const StateType new_state = @@ -3726,7 +3726,7 @@ thread_result_t Process::RunPrivateStateThread(bool is_secondary_thread) { bool control_only = true; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::%s (arg = %p, pid = %" PRIu64 ") thread starting...", __FUNCTION__, static_cast(this), GetID()); @@ -3926,7 +3926,7 @@ 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 | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS)); LLDB_LOGF( log, @@ -3938,7 +3938,7 @@ 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 | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "The thread at position %u changed from %u to %u while " @@ -4232,7 +4232,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::GetProfileData (buf = %p, size = %" PRIu64 ")", static_cast(buf), static_cast(buf_size)); if (bytes_available > buf_size) { @@ -4253,7 +4253,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::GetSTDOUT (buf = %p, size = %" PRIu64 ")", static_cast(buf), static_cast(buf_size)); if (bytes_available > buf_size) { @@ -4272,7 +4272,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::GetSTDERR (buf = %p, size = %" PRIu64 ")", static_cast(buf), static_cast(buf_size)); if (bytes_available > buf_size) { @@ -4453,7 +4453,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::%s pushing IO handler", __FUNCTION__); io_handler_sp->SetIsDone(false); @@ -4562,7 +4562,7 @@ EventSP &event_to_broadcast_sp, const EvaluateExpressionOptions &options, bool handle_interrupts) { - Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS); + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS); ThreadSP thread_sp = thread_plan_sp->GetTarget() .GetProcessSP() @@ -4730,7 +4730,7 @@ lldb::StateType old_state = eStateInvalid; lldb::ThreadPlanSP stopper_base_plan_sp; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS)); if (m_private_state_thread.EqualsThread(Host::GetCurrentThread())) { // Yikes, we are running on the private state thread! So we can't wait for @@ -5498,7 +5498,7 @@ stop_format); ++num_thread_infos_dumped; } else { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::GetThreadStatus - thread 0x" PRIu64 " vanished while running Thread::GetStatus."); } @@ -5586,7 +5586,7 @@ } void Process::DidExec() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::%s()", __FUNCTION__); Target &target = GetTarget(); @@ -5890,7 +5890,7 @@ void Process::MapSupportedStructuredDataPlugins( const StructuredData::Array &supported_type_names) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/RegisterContextUnwind.cpp +++ b/lldb/source/Target/RegisterContextUnwind.cpp @@ -32,7 +32,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/lldb-private.h" @@ -112,7 +112,7 @@ // zeroth frame or currently executing frame. void RegisterContextUnwind::InitializeZerothFrame() { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); ExecutionContext exe_ctx(m_thread.shared_from_this()); RegisterContextSP reg_ctx_sp = m_thread.GetRegisterContext(); @@ -303,7 +303,7 @@ // RegisterContextUnwind "below" it to provide things like its current pc value. void RegisterContextUnwind::InitializeNonZerothFrame() { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); if (IsFrameZero()) { m_frame_type = eNotAValidFrame; UnwindLogMsg("non-zeroth frame tests positive for IsFrameZero -- that " @@ -383,7 +383,7 @@ // symbol/function information - just stick in some reasonable defaults and // hope we can unwind past this frame. If we're above a trap handler, // we may be at a bogus address because we jumped through a bogus function - // pointer and trapped, so don't force the arch default unwind plan in that + // pointer and trapped, so don't force the arch default unwind plan in that // case. ModuleSP pc_module_sp(m_current_pc.GetModule()); if ((!m_current_pc.IsValid() || !pc_module_sp) && @@ -1247,7 +1247,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); // Have we already found this register location? if (!m_registers.empty()) { @@ -1286,7 +1286,7 @@ // arch default unwind plan is used as the Fast Unwind Plan, we // need to recognize this & switch over to the Full Unwind Plan // to see what unwind rule that (more knoweldgeable, probably) - // UnwindPlan has. If the full UnwindPlan says the register + // UnwindPlan has. If the full UnwindPlan says the register // location is Undefined, then it really is. if (active_row->GetRegisterInfo(regnum.GetAsKind(unwindplan_registerkind), unwindplan_regloc) && @@ -1334,13 +1334,13 @@ m_full_unwind_plan_sp->GetReturnAddressRegister() != LLDB_INVALID_REGNUM) { // If this is a trap handler frame, we should have access to - // the complete register context when the interrupt/async + // the complete register context when the interrupt/async // signal was received, we should fetch the actual saved $pc // value instead of the Return Address register. // If $pc is not available, fall back to the RA reg. UnwindPlan::Row::RegisterLocation scratch; if (m_frame_type == eTrapHandlerFrame && - active_row->GetRegisterInfo + active_row->GetRegisterInfo (pc_regnum.GetAsKind (unwindplan_registerkind), scratch)) { UnwindLogMsg("Providing pc register instead of rewriting to " "RA reg because this is a trap handler and there is " @@ -2324,7 +2324,7 @@ } void RegisterContextUnwind::UnwindLogMsg(const char *fmt, ...) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); if (log) { va_list args; va_start(args, fmt); @@ -2346,7 +2346,7 @@ } void RegisterContextUnwind::UnwindLogMsgVerbose(const char *fmt, ...) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/SectionLoadList.cpp +++ b/lldb/source/Target/SectionLoadList.cpp @@ -13,7 +13,7 @@ #include "lldb/Symbol/Block.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/SymbolContext.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -63,7 +63,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); ModuleSP module_sp(section->GetModule()); if (module_sp) { @@ -136,7 +136,7 @@ size_t unload_count = 0; if (section_sp) { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); if (log && log->GetVerbose()) { ModuleSP module_sp = section_sp->GetModule(); @@ -171,7 +171,7 @@ bool SectionLoadList::SetSectionUnloaded(const lldb::SectionSP §ion_sp, addr_t load_addr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_DYNAMIC_LOADER)); if (log && log->GetVerbose()) { ModuleSP module_sp = section_sp->GetModule(); diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp --- a/lldb/source/Target/StackFrame.cpp +++ b/lldb/source/Target/StackFrame.cpp @@ -29,7 +29,7 @@ #include "lldb/Target/StackFrameRecognizer.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegisterValue.h" #include "lldb/lldb-enumerations.h" @@ -1193,7 +1193,7 @@ LanguageType lang_type = GetLanguage(); if (lang_type == eLanguageTypeUnknown) { - SymbolContext sc = GetSymbolContext(eSymbolContextFunction + SymbolContext sc = GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol); if (sc.function) { lang_type = sc.function->GetMangled().GuessLanguage(); @@ -1337,7 +1337,7 @@ target_sp->GetScratchTypeSystemForLanguage(eLanguageTypeC); if (auto err = c_type_system_or_err.takeError()) { LLDB_LOG_ERROR( - lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD), + LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_THREAD), std::move(err), "Unable to guess value for given address"); return ValueObjectSP(); } else { @@ -1411,7 +1411,7 @@ Status error; ValueObjectSP pointee = base->Dereference(error); - + if (!pointee) { return ValueObjectSP(); } diff --git a/lldb/source/Target/StackFrameList.cpp b/lldb/source/Target/StackFrameList.cpp --- a/lldb/source/Target/StackFrameList.cpp +++ b/lldb/source/Target/StackFrameList.cpp @@ -21,7 +21,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/Unwind.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/ADT/SmallPtrSet.h" #include @@ -65,7 +65,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log && log->GetVerbose()) LLDB_LOGF( log, @@ -89,7 +89,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log && log->GetVerbose()) LLDB_LOGF( log, @@ -187,7 +187,7 @@ } m_current_inlined_pc = curr_pc; m_current_inlined_depth = num_inlined_functions + 1; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log && log->GetVerbose()) LLDB_LOGF(log, "ResetCurrentInlinedDepth: setting inlined " @@ -250,7 +250,7 @@ using CallSequence = std::vector; /// Find the unique path through the call graph from \p begin (with return PC -/// \p return_pc) to \p end. On success this path is stored into \p path, and +/// \p return_pc) to \p end. On success this path is stored into \p path, and /// on failure \p path is unchanged. static void FindInterveningFrames(Function &begin, Function &end, ExecutionContext &exe_ctx, Target &target, @@ -376,7 +376,7 @@ if (!next_reg_ctx_sp) return; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); StackFrame &prev_frame = *m_frames.back().get(); diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp --- a/lldb/source/Target/StopInfo.cpp +++ b/lldb/source/Target/StopInfo.cpp @@ -21,7 +21,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" #include "lldb/Target/UnixSignals.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" using namespace lldb; @@ -145,7 +145,7 @@ bp_site_sp->BumpHitCounts(); m_should_stop = bp_site_sp->ShouldStop(&context); } else { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::%s could not find breakpoint site id: %" PRId64 @@ -264,7 +264,7 @@ ThreadSP thread_sp(m_thread_wp.lock()); if (thread_sp) { - Log *log = lldb_private::GetLogIfAnyCategoriesSet( + Log *log = LLDBLog::GetLogIfAnyCategoryIsSet( LIBLLDB_LOG_BREAKPOINTS | LIBLLDB_LOG_STEP); if (!thread_sp->IsValid()) { @@ -565,7 +565,7 @@ m_should_stop = true; m_should_stop_is_valid = true; Log *log_process( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log_process, "Process::%s could not find breakpoint site id: %" PRId64 @@ -696,7 +696,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "Process::%s could not find watchpoint location id: %" PRId64 @@ -719,7 +719,7 @@ } void PerformAction(Event *event_ptr) override { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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. @@ -918,7 +918,7 @@ } else { Log *log_process( - lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -54,7 +54,7 @@ #include "lldb/Utility/Event.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/Timer.h" @@ -108,10 +108,10 @@ CheckInWithManager(); - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT), "{0} Target::Target()", static_cast(this)); if (target_arch.IsValid()) { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET), "Target::Target created with architecture {0} ({1})", target_arch.GetArchitectureName(), target_arch.GetTriple().getTriple().c_str()); @@ -121,7 +121,7 @@ } Target::~Target() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); LLDB_LOG(log, "{0} Target::~Target()", static_cast(this)); DeleteCurrentProcess(); } @@ -647,7 +647,7 @@ else m_breakpoint_list.Add(bp_sp, true); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); if (log) { StreamString s; bp_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose); @@ -743,7 +743,7 @@ m_breakpoint_list.FindBreakpointsByName(bp_name.GetName().AsCString()); if (!expected_vector) { - LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS), "invalid breakpoint name: {}", llvm::toString(expected_vector.takeError())); return; @@ -789,7 +789,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOGF(log, "Target::%s (addr = 0x%8.8" PRIx64 " size = %" PRIu64 " type = %u)\n", @@ -873,7 +873,7 @@ } void Target::RemoveAllowedBreakpoints() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); LLDB_LOGF(log, "Target::%s \n", __FUNCTION__); m_breakpoint_list.RemoveAllowed(true); @@ -882,7 +882,7 @@ } void Target::RemoveAllBreakpoints(bool internal_also) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); LLDB_LOGF(log, "Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no"); @@ -894,7 +894,7 @@ } void Target::DisableAllBreakpoints(bool internal_also) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); LLDB_LOGF(log, "Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no"); @@ -904,14 +904,14 @@ } void Target::DisableAllowedBreakpoints() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); LLDB_LOGF(log, "Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no"); @@ -921,14 +921,14 @@ } void Target::EnableAllowedBreakpoints() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 +948,7 @@ } bool Target::DisableBreakpointByID(break_id_t break_id) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 +966,7 @@ } bool Target::EnableBreakpointByID(break_id_t break_id) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 +1144,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOGF(log, "Target::%s\n", __FUNCTION__); if (!end_to_end) { @@ -1173,7 +1173,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOGF(log, "Target::%s\n", __FUNCTION__); if (!end_to_end) { @@ -1200,7 +1200,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOGF(log, "Target::%s\n", __FUNCTION__); if (!end_to_end) { @@ -1226,7 +1226,7 @@ // Assumption: Caller holds the list mutex lock for m_watchpoint_list. bool Target::ClearAllWatchpointHitCounts() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOGF(log, "Target::%s\n", __FUNCTION__); for (WatchpointSP wp_sp : m_watchpoint_list.Watchpoints()) { @@ -1240,7 +1240,7 @@ // Assumption: Caller holds the list mutex lock for m_watchpoint_list. bool Target::ClearAllWatchpointHistoricValues() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOGF(log, "Target::%s\n", __FUNCTION__); for (WatchpointSP wp_sp : m_watchpoint_list.Watchpoints()) { @@ -1255,7 +1255,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOGF(log, "Target::%s\n", __FUNCTION__); if (!ProcessIsValid()) @@ -1272,7 +1272,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOGF(log, "Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id); if (!ProcessIsValid()) @@ -1291,7 +1291,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOGF(log, "Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id); if (!ProcessIsValid()) @@ -1310,7 +1310,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 +1327,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); LLDB_LOGF(log, "Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id); if (!ProcessIsValid()) @@ -1392,7 +1392,7 @@ void Target::SetExecutableModule(ModuleSP &executable_sp, LoadDependentFiles load_dependent_files) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET)); ClearModules(false); if (executable_sp) { @@ -1457,7 +1457,7 @@ } bool Target::SetArchitecture(const ArchSpec &arch_spec, bool set_platform) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET)); bool missing_local_arch = !m_arch.GetSpec().IsValid(); bool replace_local_arch = true; bool compatible_local_arch = false; @@ -1545,7 +1545,7 @@ } bool Target::MergeArchitecture(const ArchSpec &arch_spec) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ -2185,7 +2185,7 @@ // 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 | + if (Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_TARGET | LIBLLDB_LOG_MODULES)) { StreamString message; auto dump = [&message](Module &dump_module) -> void { @@ -2303,7 +2303,7 @@ auto type_system_or_err = GetScratchTypeSystemForLanguage(language, create_on_demand); if (!type_system_or_err) - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_TARGET), type_system_or_err.takeError(), "Language '{}' has expression support but no scratch type " "system available", @@ -2320,7 +2320,7 @@ 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), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_TARGET), std::move(err), "Unable to get persistent expression state for language {}", Language::GetNameForLanguageType(language)); @@ -2419,7 +2419,7 @@ } void Target::SetDefaultArchitecture(const ArchSpec &arch) { - LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET), + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET), "setting target's default architecture to {0} ({1})", arch.GetArchitectureName(), arch.GetTriple().getTriple()); Target::GetGlobalProperties().SetDefaultArchitecture(arch); @@ -2478,7 +2478,7 @@ auto type_system_or_err = GetScratchTypeSystemForLanguage(eLanguageTypeC); if (auto err = type_system_or_err.takeError()) { - LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET), + LLDB_LOG_ERROR(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_TARGET), std::move(err), "Unable to get scratch type system"); } else { persistent_var_sp = @@ -2809,7 +2809,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); Status error = m_process_sp->PrivateResume(); if (error.Success()) { LLDB_LOG(log, "Resuming from RunStopHooks"); @@ -2965,7 +2965,7 @@ Status Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { m_stats.SetLaunchOrAttachTime(); Status error; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET)); LLDB_LOGF(log, "Target::%s() called for %s", __FUNCTION__, launch_info.GetExecutableFile().GetPath().c_str()); @@ -3250,7 +3250,7 @@ } void Target::FinalizeFileActions(ProcessLaunchInfo &info) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -43,7 +43,7 @@ #include "lldb/Target/ThreadPlanStepUntil.h" #include "lldb/Target/ThreadSpec.h" #include "lldb/Target/UnwindLLDB.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/State.h" #include "lldb/Utility/Stream.h" @@ -228,7 +228,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); LLDB_LOGF(log, "%p Thread::Thread(tid = 0x%4.4" PRIx64 ")", static_cast(this), GetID()); @@ -236,7 +236,7 @@ } Thread::~Thread() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ -445,7 +445,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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() : "", @@ -576,7 +576,7 @@ } void Thread::SelectMostRelevantFrame() { - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD); + Log *log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD); auto frames_list_sp = GetStackFrameList(); @@ -730,7 +730,7 @@ bool should_stop = true; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (GetResumeState() == eStateSuspended) { LLDB_LOGF(log, @@ -955,7 +955,7 @@ StateType thread_state = GetResumeState(); StateType temp_thread_state = GetTemporaryResumeState(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (thread_state == eStateSuspended || thread_state == eStateInvalid) { LLDB_LOGF(log, @@ -983,7 +983,7 @@ } if (GetPlans().AnyCompletedPlans()) { - // Pass skip_private = false to GetCompletedPlan, since we want to ask + // Pass skip_private = false to GetCompletedPlan, since we want to ask // the last plan, regardless of whether it is private or not. LLDB_LOGF(log, "Thread::ShouldReportStop() tid = 0x%4.4" PRIx64 @@ -1019,9 +1019,9 @@ return eVoteNoOpinion; } - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (GetPlans().AnyCompletedPlans()) { - // Pass skip_private = false to GetCompletedPlan, since we want to ask + // Pass skip_private = false to GetCompletedPlan, since we want to ask // the last plan, regardless of whether it is private or not. LLDB_LOGF(log, "Current Plan for thread %d(%p) (0x%4.4" PRIx64 @@ -1066,7 +1066,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log) { StreamString s; thread_plan_sp->GetDescription(&s, lldb::eDescriptionLevelFull); @@ -1074,12 +1074,12 @@ static_cast(this), s.GetData(), thread_plan_sp->GetThread().GetID()); } - + GetPlans().PushPlan(std::move(thread_plan_sp)); } void Thread::PopPlan() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); ThreadPlanSP popped_plan_sp = GetPlans().PopPlan(); if (log) { LLDB_LOGF(log, "Popping plan: \"%s\", tid = 0x%4.4" PRIx64 ".", @@ -1088,11 +1088,11 @@ } void Thread::DiscardPlan() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); ThreadPlanSP discarded_plan_sp = GetPlans().PopPlan(); LLDB_LOGF(log, "Discarding plan: \"%s\", tid = 0x%4.4" PRIx64 ".", - discarded_plan_sp->GetName(), + discarded_plan_sp->GetName(), discarded_plan_sp->GetThread().GetID()); } @@ -1191,7 +1191,7 @@ } void Thread::DiscardThreadPlansUpToPlan(ThreadPlan *up_to_plan_ptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); LLDB_LOGF(log, "Discarding thread plans for thread tid = 0x%4.4" PRIx64 ", up to %p", @@ -1200,7 +1200,7 @@ } void Thread::DiscardThreadPlans(bool force) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log) { LLDB_LOGF(log, "Discarding thread plans for thread (tid = 0x%4.4" PRIx64 @@ -1221,7 +1221,7 @@ if (!innermost_expr_plan) { error.SetErrorString("No expressions currently active on this thread"); return error; - } + } DiscardThreadPlansUpToPlan(innermost_expr_plan); return error; } @@ -1365,7 +1365,7 @@ } lldb::ThreadPlanSP Thread::QueueThreadPlanForStepScripted( - bool abort_other_plans, const char *class_name, + bool abort_other_plans, const char *class_name, StructuredData::ObjectSP extra_args_sp, bool stop_other_threads, Status &status) { diff --git a/lldb/source/Target/ThreadList.cpp b/lldb/source/Target/ThreadList.cpp --- a/lldb/source/Target/ThreadList.cpp +++ b/lldb/source/Target/ThreadList.cpp @@ -16,7 +16,7 @@ #include "lldb/Target/ThreadList.h" #include "lldb/Target/ThreadPlan.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" using namespace lldb; @@ -39,7 +39,7 @@ // the assignment occurs std::lock(GetMutex(), rhs.GetMutex()); std::lock_guard guard(GetMutex(), std::adopt_lock); - std::lock_guard rhs_guard(rhs.GetMutex(), + std::lock_guard rhs_guard(rhs.GetMutex(), std::adopt_lock); m_process = rhs.m_process; @@ -225,7 +225,7 @@ bool ThreadList::ShouldStop(Event *event_ptr) { // Running events should never stop, obviously... - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ m_process->UpdateThreadListIfNeeded(); collection::iterator pos, end = m_threads.end(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); LLDB_LOGF(log, "ThreadList::%s %" PRIu64 " threads", __FUNCTION__, (uint64_t)m_threads.size()); @@ -416,7 +416,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); for (pos = m_threads.begin(); pos != end; ++pos) { if ((*pos)->GetResumeState() != eStateSuspended) { @@ -460,7 +460,7 @@ m_process->UpdateThreadListIfNeeded(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log && log->GetVerbose()) LLDB_LOGF(log, "Turning off notification of new threads while single stepping " @@ -514,13 +514,13 @@ } if (wants_solo_run) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/ThreadPlan.cpp +++ b/lldb/source/Target/ThreadPlan.cpp @@ -12,7 +12,7 @@ #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" using namespace lldb; @@ -76,7 +76,7 @@ } Vote ThreadPlan::ShouldReportStop(Event *event_ptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (m_report_stop_vote == eVoteNoOpinion) { ThreadPlan *prev_plan = GetPreviousPlan(); @@ -116,7 +116,7 @@ m_cached_plan_explains_stop = eLazyBoolCalculate; if (current_plan) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log) { RegisterContext *reg_ctx = GetThread().GetRegisterContext().get(); @@ -195,7 +195,7 @@ ", ptid = 0x%" PRIx64 ")", LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); #else - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); if (log) log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 ", ptid = 0x%" PRIx64 ")", @@ -211,7 +211,7 @@ ", ptid = 0x%" PRIx64 ")", LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); #else - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); if (log) log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 ", ptid = 0x%" PRIx64 ")", @@ -227,7 +227,7 @@ ", ptid = 0x%" PRIx64 ")", LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); #else - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); if (log) log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 ", ptid = 0x%" PRIx64 ")", @@ -243,7 +243,7 @@ ", ptid = 0x%" PRIx64 ")", LLVM_PRETTY_FUNCTION, GetThread().GetID(), GetThread().GetProtocolID()); #else - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); if (log) log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 ", ptid = 0x%" PRIx64 ")", @@ -261,7 +261,7 @@ ", ptid = 0x%" PRIx64 ")", LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); #else - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); if (log) log->Error("%s called on thread that has been destroyed (tid = 0x%" PRIx64 ", ptid = 0x%" PRIx64 ")", @@ -278,7 +278,7 @@ ", ptid = 0x%" PRIx64 ")", LLVM_PRETTY_FUNCTION, m_tid, GetThread().GetProtocolID()); #else - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/ThreadPlanBase.cpp +++ b/lldb/source/Target/ThreadPlanBase.cpp @@ -16,7 +16,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/StopInfo.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -73,7 +73,7 @@ m_report_stop_vote = eVoteYes; m_report_run_vote = eVoteYes; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); StopInfoSP stop_info_sp = GetPrivateStopInfo(); if (stop_info_sp) { @@ -125,7 +125,7 @@ LLDB_LOGF( log, "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64 - " (exception: %s)", + " (exception: %s)", m_tid, stop_info_sp->GetDescription()); GetThread().DiscardThreadPlans(false); return true; @@ -148,7 +148,7 @@ LLDB_LOGF( log, "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64 - " (signal: %s)", + " (signal: %s)", m_tid, stop_info_sp->GetDescription()); GetThread().DiscardThreadPlans(false); return true; diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -21,7 +21,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanRunToAddress.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" #include @@ -46,7 +46,7 @@ if (!abi) return false; - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_STEP)); SetBreakpoints(); @@ -143,7 +143,7 @@ } void ThreadPlanCallFunction::ReportRegisterState(const char *message) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log && log->GetVerbose()) { StreamString strm; RegisterContext *reg_ctx = GetThread().GetRegisterContext().get(); @@ -166,7 +166,7 @@ } void ThreadPlanCallFunction::DoTakedown(bool success) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_STEP)); if (!m_valid) { // Don't call DoTakedown if we were never valid to begin with. @@ -242,7 +242,7 @@ } bool ThreadPlanCallFunction::DoPlanExplainsStop(Event *event_ptr) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP | + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS)); m_real_stop_info_sp = GetPrivateStopInfo(); @@ -371,7 +371,7 @@ #ifndef SINGLE_STEP_EXPRESSIONS Thread &thread = GetThread(); - m_subplan_sp = std::make_shared(thread, m_start_addr, + m_subplan_sp = std::make_shared(thread, m_start_addr, m_stop_other_threads); thread.QueueThreadPlan(m_subplan_sp, false); @@ -382,7 +382,7 @@ bool ThreadPlanCallFunction::WillStop() { return true; } bool ThreadPlanCallFunction::MischiefManaged() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (IsPlanComplete()) { LLDB_LOGF(log, "ThreadPlanCallFunction(%p): Completed call function plan.", @@ -433,7 +433,7 @@ (m_objc_language_runtime && m_objc_language_runtime->ExceptionBreakpointsExplainStop( stop_info_sp))) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_STEP)); LLDB_LOGF(log, "ThreadPlanCallFunction::BreakpointsExplainStop - Hit an " "exception breakpoint, setting plan complete."); diff --git a/lldb/source/Target/ThreadPlanCallFunctionUsingABI.cpp b/lldb/source/Target/ThreadPlanCallFunctionUsingABI.cpp --- a/lldb/source/Target/ThreadPlanCallFunctionUsingABI.cpp +++ b/lldb/source/Target/ThreadPlanCallFunctionUsingABI.cpp @@ -12,7 +12,7 @@ #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" using namespace lldb; diff --git a/lldb/source/Target/ThreadPlanCallUserExpression.cpp b/lldb/source/Target/ThreadPlanCallUserExpression.cpp --- a/lldb/source/Target/ThreadPlanCallUserExpression.cpp +++ b/lldb/source/Target/ThreadPlanCallUserExpression.cpp @@ -23,7 +23,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanRunToAddress.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -66,7 +66,7 @@ } bool ThreadPlanCallUserExpression::MischiefManaged() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/ThreadPlanPython.cpp +++ b/lldb/source/Target/ThreadPlanPython.cpp @@ -17,7 +17,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" #include "lldb/Target/ThreadPlanPython.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" using namespace lldb; @@ -63,14 +63,14 @@ ScriptInterpreter *script_interp = GetScriptInterpreter(); if (script_interp) { m_implementation_sp = script_interp->CreateScriptedThreadPlan( - m_class_name.c_str(), m_args_data, m_error_str, + m_class_name.c_str(), m_args_data, m_error_str, this->shared_from_this()); } } } bool ThreadPlanPython::ShouldStop(Event *event_ptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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::IsPlanStale() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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::DoPlanExplainsStop(Event *event_ptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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::MischiefManaged() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ } lldb::StateType ThreadPlanPython::GetPlanRunState() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ } bool ThreadPlanPython::WillStop() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/ThreadPlanRunToAddress.cpp +++ b/lldb/source/Target/ThreadPlanRunToAddress.cpp @@ -11,7 +11,7 @@ #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -169,7 +169,7 @@ bool ThreadPlanRunToAddress::WillStop() { return true; } bool ThreadPlanRunToAddress::MischiefManaged() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (AtOurAddress()) { // Remove the breakpoint diff --git a/lldb/source/Target/ThreadPlanShouldStopHere.cpp b/lldb/source/Target/ThreadPlanShouldStopHere.cpp --- a/lldb/source/Target/ThreadPlanShouldStopHere.cpp +++ b/lldb/source/Target/ThreadPlanShouldStopHere.cpp @@ -10,7 +10,7 @@ #include "lldb/Symbol/Symbol.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Thread.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace lldb; using namespace lldb_private; @@ -41,7 +41,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log) { lldb::addr_t current_addr = m_owner->GetThread().GetRegisterContext()->GetPC(0); @@ -62,7 +62,7 @@ if (!frame) return true; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if ((operation == eFrameCompareOlder && flags.Test(eStepOutAvoidNoDebug)) || (operation == eFrameCompareYounger && flags.Test(eStepInAvoidNoDebug)) || @@ -98,7 +98,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get(); if (!frame) diff --git a/lldb/source/Target/ThreadPlanStack.cpp b/lldb/source/Target/ThreadPlanStack.cpp --- a/lldb/source/Target/ThreadPlanStack.cpp +++ b/lldb/source/Target/ThreadPlanStack.cpp @@ -11,7 +11,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp --- a/lldb/source/Target/ThreadPlanStepInRange.cpp +++ b/lldb/source/Target/ThreadPlanStepInRange.cpp @@ -18,7 +18,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanStepOut.h" #include "lldb/Target/ThreadPlanStepThrough.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/Stream.h" @@ -125,7 +125,7 @@ } bool ThreadPlanStepInRange::ShouldStop(Event *event_ptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log) { StreamString s; @@ -269,7 +269,7 @@ if (bytes_to_skip != 0) { func_start_address.Slide(bytes_to_skip); - log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP); + log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP); LLDB_LOGF(log, "Pushing past prologue "); m_sub_plan_sp = thread.QueueThreadPlanForRunToAddress( @@ -344,7 +344,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP), "Stepping out of function \"%s\" because it matches " "the avoid regexp \"%s\" - match substring: \"%s\".", frame_function_name, @@ -363,7 +363,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); // First see if the ThreadPlanShouldStopHere default implementation thinks we // should get out of here: @@ -445,7 +445,7 @@ return_value = true; } } else if (IsUsuallyUnexplainedStopReason(reason)) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log) log->PutCString("ThreadPlanStepInRange got asked if it explains the " "stop for some reason other than step."); @@ -468,7 +468,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/ThreadPlanStepInstruction.cpp +++ b/lldb/source/Target/ThreadPlanStepInstruction.cpp @@ -9,10 +9,9 @@ #include "lldb/Target/ThreadPlanStepInstruction.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" -#include "lldb/Target/RegisterContext.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -96,7 +95,7 @@ } bool ThreadPlanStepInstruction::IsPlanStale() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); Thread &thread = GetThread(); StackID cur_frame_id = thread.GetStackFrameAtIndex(0)->GetStackID(); if (cur_frame_id == m_stack_id) { @@ -128,7 +127,7 @@ bool ThreadPlanStepInstruction::ShouldStop(Event *event_ptr) { Thread &thread = GetThread(); if (m_step_over) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); StackFrameSP cur_frame_sp = thread.GetStackFrameAtIndex(0); if (!cur_frame_sp) { LLDB_LOGF( @@ -244,7 +243,7 @@ bool ThreadPlanStepInstruction::MischiefManaged() { if (IsPlanComplete()) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/ThreadPlanStepOut.cpp +++ b/lldb/source/Target/ThreadPlanStepOut.cpp @@ -21,7 +21,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/ThreadPlanStepOverRange.h" #include "lldb/Target/ThreadPlanStepThrough.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include @@ -43,7 +43,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); SetFlagsToDefault(); SetupAvoidNoDebug(step_out_avoids_code_without_debug_info); @@ -137,7 +137,7 @@ return; } - Breakpoint *return_bp = + Breakpoint *return_bp = GetTarget().CreateBreakpoint(m_return_addr, true, false).get(); if (return_bp != nullptr) { @@ -423,7 +423,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log) LLDB_LOGF(log, "Completed step out plan."); if (m_return_bp_id != LLDB_INVALID_BREAK_ID) { @@ -447,7 +447,7 @@ if (!immediate_return_from_sp) return false; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp +++ b/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp @@ -10,7 +10,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -51,7 +51,7 @@ if (stop_info_sp) { StopReason reason = stop_info_sp->GetStopReason(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); LLDB_LOG(log, "Step over breakpoint stopped for reason: {0}.", Thread::StopReasonAsString(reason)); @@ -66,11 +66,11 @@ // that a breakpoint hit, and trigger the actions, etc. Otherwise you // would see the PC at the breakpoint without having triggered the // actions, then you'd continue, the PC wouldn't change, and you'd see - // the breakpoint hit, which would be odd. So the lower levels fake - // "step onto breakpoint address" and return that as a breakpoint hit. - // So our trace step COULD appear as a breakpoint hit if the next - // instruction also contained a breakpoint. We don't want to handle - // that, since we really don't know what to do with breakpoint hits. + // the breakpoint hit, which would be odd. So the lower levels fake + // "step onto breakpoint address" and return that as a breakpoint hit. + // So our trace step COULD appear as a breakpoint hit if the next + // instruction also contained a breakpoint. We don't want to handle + // that, since we really don't know what to do with breakpoint hits. // But make sure we don't set ourselves to auto-continue or we'll wrench // control away from the plans that can deal with this. // Be careful, however, as we may have "seen a breakpoint under the PC @@ -134,7 +134,7 @@ // didn't get a chance to run. return false; } else { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/ThreadPlanStepOverRange.cpp +++ b/lldb/source/Target/ThreadPlanStepOverRange.cpp @@ -17,7 +17,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanStepOut.h" #include "lldb/Target/ThreadPlanStepThrough.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" using namespace lldb_private; @@ -124,7 +124,7 @@ } bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); Thread &thread = GetThread(); if (log) { @@ -200,7 +200,7 @@ // we are in a stub then it's likely going to be hard to get out from // here. It is probably easiest to step into the stub, and then it will // be straight-forward to step out. - new_plan_sp = thread.QueueThreadPlanForStepThrough(m_stack_id, false, + new_plan_sp = thread.QueueThreadPlanForStepThrough(m_stack_id, false, stop_others, m_status); } else { // The current clang (at least through 424) doesn't always get the @@ -341,7 +341,7 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); StopInfoSP stop_info_sp = GetPrivateStopInfo(); bool return_value; @@ -375,7 +375,7 @@ // step over that. bool in_inlined_stack = thread.DecrementCurrentInlinedDepth(); if (in_inlined_stack) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/ThreadPlanStepRange.cpp +++ b/lldb/source/Target/ThreadPlanStepRange.cpp @@ -19,7 +19,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanRunToAddress.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -65,7 +65,7 @@ } Vote ThreadPlanStepRange::ShouldReportStop(Event *event_ptr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); const Vote vote = IsPlanComplete() ? eVoteYes : eVoteNo; LLDB_LOGF(log, "ThreadPlanStepRange::ShouldReportStop() returning vote %i\n", @@ -98,14 +98,14 @@ } bool ThreadPlanStepRange::InRange() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); bool ret_value = false; Thread &thread = GetThread(); lldb::addr_t pc_load_addr = thread.GetRegisterContext()->GetPC(); size_t num_ranges = m_address_ranges.size(); for (size_t i = 0; i < num_ranges; i++) { - ret_value = + ret_value = m_address_ranges[i].ContainsLoadAddress(pc_load_addr, &GetTarget()); if (ret_value) break; @@ -293,7 +293,7 @@ void ThreadPlanStepRange::ClearNextBranchBreakpoint() { if (m_next_branch_bp_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ if (m_next_branch_bp_sp) return true; - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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) @@ -315,7 +315,7 @@ // clear the m_found_calls, we'll rediscover it for this range. m_found_calls = false; - + lldb::addr_t cur_addr = GetThread().GetRegisterContext()->GetPC(); // Find the current address in our address ranges, and fetch the disassembly // if we haven't already: @@ -386,7 +386,7 @@ bool ThreadPlanStepRange::NextRangeBreakpointExplainsStop( lldb::StopInfoSP stop_info_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (!m_next_branch_bp_sp) return false; @@ -453,7 +453,7 @@ } if (done) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); LLDB_LOGF(log, "Completed step through range plan."); ClearNextBranchBreakpoint(); ThreadPlan::MischiefManaged(); @@ -464,7 +464,7 @@ } bool ThreadPlanStepRange::IsPlanStale() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); FrameComparison frame_order = CompareCurrentFrameToStartFrame(); if (frame_order == eFrameCompareOlder) { @@ -482,7 +482,7 @@ lldb::addr_t addr = GetThread().GetRegisterContext()->GetPC() - 1; size_t num_ranges = m_address_ranges.size(); for (size_t i = 0; i < num_ranges; i++) { - bool in_range = + bool in_range = m_address_ranges[i].ContainsLoadAddress(addr, &GetTarget()); if (in_range) { SetPlanComplete(); diff --git a/lldb/source/Target/ThreadPlanStepThrough.cpp b/lldb/source/Target/ThreadPlanStepThrough.cpp --- a/lldb/source/Target/ThreadPlanStepThrough.cpp +++ b/lldb/source/Target/ThreadPlanStepThrough.cpp @@ -13,7 +13,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -60,7 +60,7 @@ m_backstop_bkpt_id = return_bp->GetID(); return_bp->SetBreakpointKind("step-through-backstop"); } - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ } } - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log) { lldb::addr_t current_address = GetThread().GetRegisterContext()->GetPC(0); if (m_sub_plan_sp) { @@ -227,7 +227,7 @@ } bool ThreadPlanStepThrough::MischiefManaged() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (!IsPlanComplete()) { return false; @@ -252,7 +252,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Target/ThreadPlanStepUntil.cpp +++ b/lldb/source/Target/ThreadPlanStepUntil.cpp @@ -14,7 +14,7 @@ #include "lldb/Target/RegisterContext.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace lldb; using namespace lldb_private; @@ -315,7 +315,7 @@ // here. bool done = false; if (IsPlanComplete()) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); LLDB_LOGF(log, "Completed step until plan."); Clear(); diff --git a/lldb/source/Target/ThreadPlanTracer.cpp b/lldb/source/Target/ThreadPlanTracer.cpp --- a/lldb/source/Target/ThreadPlanTracer.cpp +++ b/lldb/source/Target/ThreadPlanTracer.cpp @@ -25,7 +25,7 @@ #include "lldb/Target/ThreadPlan.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/State.h" using namespace lldb; @@ -55,7 +55,7 @@ Thread &ThreadPlanTracer::GetThread() { if (m_thread) return *m_thread; - + ThreadSP thread_sp = m_process.GetThreadList().FindThreadByID(m_tid); m_thread = thread_sp.get(); return *m_thread; @@ -106,10 +106,9 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_TYPES), + 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 --- a/lldb/source/Target/UnwindLLDB.cpp +++ b/lldb/source/Target/UnwindLLDB.cpp @@ -17,7 +17,7 @@ #include "lldb/Target/RegisterContextUnwind.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" using namespace lldb; using namespace lldb_private; @@ -101,7 +101,7 @@ return true; unwind_done: - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); if (log) { LLDB_LOGF(log, "th%d Unwind of this thread is complete.", m_thread.GetIndexID()); @@ -119,7 +119,7 @@ if (m_unwind_complete) return nullptr; - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); CursorSP prev_frame = m_frames.back(); uint32_t cur_idx = m_frames.size(); @@ -315,7 +315,7 @@ } bool UnwindLLDB::AddOneMoreFrame(ABI *abi) { - Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 --- a/lldb/source/Utility/ArchSpec.cpp +++ b/lldb/source/Utility/ArchSpec.cpp @@ -8,7 +8,7 @@ #include "lldb/Utility/ArchSpec.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StringList.h" #include "lldb/lldb-defines.h" #include "llvm/ADT/STLExtras.h" @@ -902,7 +902,7 @@ m_triple.setArch(core_def->machine); } } else { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET | LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_PLATFORM)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_TARGET | LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_PLATFORM)); LLDB_LOGF(log, "Unable to find a core definition for cpu 0x%" PRIx32 " sub %" PRId32, @@ -1126,8 +1126,8 @@ break; // v. https://en.wikipedia.org/wiki/ARM_Cortex-M#Silicon_customization - // Cortex-M0 - ARMv6-M - armv6m - // Cortex-M3 - ARMv7-M - armv7m + // Cortex-M0 - ARMv6-M - armv6m + // Cortex-M3 - ARMv7-M - armv7m // Cortex-M4 - ARMv7E-M - armv7em case ArchSpec::eCore_arm_armv7em: if (!enforce_exact_match) { @@ -1144,8 +1144,8 @@ break; // v. https://en.wikipedia.org/wiki/ARM_Cortex-M#Silicon_customization - // Cortex-M0 - ARMv6-M - armv6m - // Cortex-M3 - ARMv7-M - armv7m + // Cortex-M0 - ARMv6-M - armv6m + // Cortex-M3 - ARMv7-M - armv7m // Cortex-M4 - ARMv7E-M - armv7em case ArchSpec::eCore_arm_armv7m: if (!enforce_exact_match) { @@ -1162,8 +1162,8 @@ break; // v. https://en.wikipedia.org/wiki/ARM_Cortex-M#Silicon_customization - // Cortex-M0 - ARMv6-M - armv6m - // Cortex-M3 - ARMv7-M - armv7m + // Cortex-M0 - ARMv6-M - armv6m + // Cortex-M3 - ARMv7-M - armv7m // Cortex-M4 - ARMv7E-M - armv7em case ArchSpec::eCore_arm_armv6m: if (!enforce_exact_match) { diff --git a/lldb/source/Utility/Broadcaster.cpp b/lldb/source/Utility/Broadcaster.cpp --- a/lldb/source/Utility/Broadcaster.cpp +++ b/lldb/source/Utility/Broadcaster.cpp @@ -10,8 +10,8 @@ #include "lldb/Utility/Event.h" #include "lldb/Utility/Listener.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" @@ -28,7 +28,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); LLDB_LOG(log, "{0} Broadcaster::Broadcaster(\"{1}\")", static_cast(this), GetBroadcasterName()); } @@ -38,7 +38,7 @@ m_hijacking_listeners(), m_hijacking_masks() {} Broadcaster::~Broadcaster() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); LLDB_LOG(log, "{0} Broadcaster::~Broadcaster(\"{1}\")", static_cast(this), GetBroadcasterName()); @@ -210,7 +210,7 @@ hijacking_listener_sp.reset(); } - if (Log *log = lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EVENTS)) { + if (Log *log = LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_EVENTS)) { StreamString event_description; event_sp->Dump(&event_description); LLDB_LOGF(log, @@ -261,7 +261,7 @@ 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(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_EVENTS)); LLDB_LOG( log, "{0} Broadcaster(\"{1}\")::HijackBroadcaster (listener(\"{2}\")={3})", @@ -292,7 +292,7 @@ if (!m_hijacking_listeners.empty()) { ListenerSP listener_sp = m_hijacking_listeners.back(); - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EVENTS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_EVENTS)); LLDB_LOG(log, "{0} Broadcaster(\"{1}\")::RestoreBroadcaster (about to pop " "listener(\"{2}\")={3})", diff --git a/lldb/source/Utility/CMakeLists.txt b/lldb/source/Utility/CMakeLists.txt --- a/lldb/source/Utility/CMakeLists.txt +++ b/lldb/source/Utility/CMakeLists.txt @@ -42,8 +42,8 @@ IOObject.cpp LLDBAssert.cpp Listener.cpp + LLDBLog.cpp Log.cpp - Logging.cpp NameMatches.cpp ProcessInfo.cpp RegisterValue.cpp diff --git a/lldb/source/Utility/DataExtractor.cpp b/lldb/source/Utility/DataExtractor.cpp --- a/lldb/source/Utility/DataExtractor.cpp +++ b/lldb/source/Utility/DataExtractor.cpp @@ -16,7 +16,7 @@ #include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/LLDBAssert.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/UUID.h" diff --git a/lldb/source/Utility/LLDBLog.cpp b/lldb/source/Utility/LLDBLog.cpp new file mode 100644 --- /dev/null +++ b/lldb/source/Utility/LLDBLog.cpp @@ -0,0 +1,78 @@ +//===-- Logging.cpp -------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "lldb/Utility/LLDBLog.h" + +#include "llvm/ADT/ArrayRef.h" + +#include + +using namespace lldb_private; + +static constexpr Log::Category g_categories[] = { + {{"api"}, {"log API calls and return values"}, LIBLLDB_LOG_API}, + {{"ast"}, {"log AST"}, LIBLLDB_LOG_AST}, + {{"break"}, {"log breakpoints"}, LIBLLDB_LOG_BREAKPOINTS}, + {{"commands"}, {"log command argument parsing"}, LIBLLDB_LOG_COMMANDS}, + {{"comm"}, {"log communication activities"}, LIBLLDB_LOG_COMMUNICATION}, + {{"conn"}, {"log connection details"}, LIBLLDB_LOG_CONNECTION}, + {{"demangle"}, + {"log mangled names to catch demangler crashes"}, + LIBLLDB_LOG_DEMANGLE}, + {{"dyld"}, + {"log shared library related activities"}, + LIBLLDB_LOG_DYNAMIC_LOADER}, + {{"event"}, + {"log broadcaster, listener and event queue activities"}, + LIBLLDB_LOG_EVENTS}, + {{"expr"}, {"log expressions"}, LIBLLDB_LOG_EXPRESSIONS}, + {{"formatters"}, + {"log data formatters related activities"}, + LIBLLDB_LOG_DATAFORMATTERS}, + {{"host"}, {"log host activities"}, LIBLLDB_LOG_HOST}, + {{"jit"}, {"log JIT events in the target"}, LIBLLDB_LOG_JIT_LOADER}, + {{"language"}, {"log language runtime events"}, LIBLLDB_LOG_LANGUAGE}, + {{"mmap"}, {"log mmap related activities"}, LIBLLDB_LOG_MMAP}, + {{"module"}, + {"log module activities such as when modules are created, destroyed, " + "replaced, and more"}, + LIBLLDB_LOG_MODULES}, + {{"object"}, + {"log object construction/destruction for important objects"}, + LIBLLDB_LOG_OBJECT}, + {{"os"}, {"log OperatingSystem plugin related activities"}, LIBLLDB_LOG_OS}, + {{"platform"}, + {"log platform events and activities"}, + LIBLLDB_LOG_PLATFORM}, + {{"process"}, {"log process events and activities"}, LIBLLDB_LOG_PROCESS}, + {{"script"}, + {"log events about the script interpreter"}, + LIBLLDB_LOG_SCRIPT}, + {{"state"}, + {"log private and public process state changes"}, + LIBLLDB_LOG_STATE}, + {{"step"}, {"log step related activities"}, LIBLLDB_LOG_STEP}, + {{"symbol"}, + {"log symbol related issues and warnings"}, + LIBLLDB_LOG_SYMBOLS}, + {{"system-runtime"}, + {"log system runtime events"}, + LIBLLDB_LOG_SYSTEM_RUNTIME}, + {{"target"}, {"log target events and activities"}, LIBLLDB_LOG_TARGET}, + {{"temp"}, + {"log internal temporary debug messages"}, + LIBLLDB_LOG_TEMPORARY}, + {{"thread"}, {"log thread events and activities"}, LIBLLDB_LOG_THREAD}, + {{"types"}, {"log type system related activities"}, LIBLLDB_LOG_TYPES}, + {{"unwind"}, {"log stack unwind activities"}, LIBLLDB_LOG_UNWIND}, + {{"watch"}, {"log watchpoint related activities"}, LIBLLDB_LOG_WATCHPOINTS}, +}; + +Log::Channel LLDBLog::g_channel(g_categories, LIBLLDB_LOG_DEFAULT); + +void LLDBLog::Initialize() { Log::Register("lldb", g_channel); } diff --git a/lldb/source/Utility/Listener.cpp b/lldb/source/Utility/Listener.cpp --- a/lldb/source/Utility/Listener.cpp +++ b/lldb/source/Utility/Listener.cpp @@ -11,8 +11,8 @@ #include "lldb/Utility/Broadcaster.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Event.h" -#include "lldb/Utility/Log.h" -#include "lldb/Utility/Logging.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/LLDBLog.h" #include "llvm/ADT/Optional.h" @@ -40,14 +40,14 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); Clear(); @@ -56,7 +56,7 @@ } void Listener::Clear() { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); std::lock_guard broadcasters_guard( m_broadcasters_mutex); broadcaster_collection::iterator pos, end = m_broadcasters.end(); @@ -97,7 +97,7 @@ uint32_t acquired_mask = broadcaster->AddListener(this->shared_from_this(), event_mask); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); if (log != nullptr) LLDB_LOGF(log, "%p Listener::StartListeningForEvents (broadcaster = %p, " @@ -128,7 +128,7 @@ uint32_t acquired_mask = broadcaster->AddListener(this->shared_from_this(), event_mask); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); if (log != nullptr) { void **pointer = reinterpret_cast(&callback); LLDB_LOGF(log, @@ -200,7 +200,7 @@ } void Listener::AddEvent(EventSP &event_sp) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); + Log *log(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ // 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS)); if (m_events.empty()) return false; @@ -348,7 +348,7 @@ 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(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 @@ result = m_events_condition.wait_for(lock, *timeout); if (result == std::cv_status::timeout) { - log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS); + log = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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 = LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_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/Log.cpp b/lldb/source/Utility/Log.cpp --- a/lldb/source/Utility/Log.cpp +++ b/lldb/source/Utility/Log.cpp @@ -54,13 +54,14 @@ }); } -uint32_t Log::GetFlags(llvm::raw_ostream &stream, const ChannelMap::value_type &entry, - llvm::ArrayRef categories) { +LogMask Log::GetFlags(llvm::raw_ostream &stream, + const ChannelMap::value_type &entry, + llvm::ArrayRef categories) { bool list_categories = false; - uint32_t flags = 0; + LogMask flags = 0; for (const char *category : categories) { if (llvm::StringRef("all").equals_insensitive(category)) { - flags |= UINT32_MAX; + flags |= LLDB_LOG_ALL_BITS; continue; } if (llvm::StringRef("default").equals_insensitive(category)) { @@ -85,10 +86,10 @@ } void Log::Enable(const std::shared_ptr &stream_sp, - uint32_t options, uint32_t flags) { + uint32_t options, LogMask flags) { llvm::sys::ScopedWriter lock(m_mutex); - uint32_t mask = m_mask.fetch_or(flags, std::memory_order_relaxed); + LogMask mask = m_mask.fetch_or(flags, std::memory_order_relaxed); if (mask | flags) { m_options.store(options, std::memory_order_relaxed); m_stream_sp = stream_sp; @@ -96,10 +97,10 @@ } } -void Log::Disable(uint32_t flags) { +void Log::Disable(LogMask flags) { llvm::sys::ScopedWriter lock(m_mutex); - uint32_t mask = m_mask.fetch_and(~flags, std::memory_order_relaxed); + LogMask mask = m_mask.fetch_and(~flags, std::memory_order_relaxed); if (!(mask & ~flags)) { m_stream_sp.reset(); m_channel.log_ptr.store(nullptr, std::memory_order_relaxed); @@ -178,10 +179,6 @@ Printf("warning: %s", Content.c_str()); } -void Log::Initialize() { - InitializeLldbChannel(); -} - void Log::Register(llvm::StringRef name, Channel &channel) { auto iter = g_channel_map->try_emplace(name, channel); assert(iter.second == true); @@ -191,7 +188,7 @@ void Log::Unregister(llvm::StringRef name) { auto iter = g_channel_map->find(name); assert(iter != g_channel_map->end()); - iter->second.Disable(UINT32_MAX); + iter->second.Disable(LLDB_LOG_ALL_BITS); g_channel_map->erase(iter); } @@ -204,7 +201,7 @@ error_stream << llvm::formatv("Invalid log channel '{0}'.\n", channel); return false; } - uint32_t flags = categories.empty() + LogMask flags = categories.empty() ? iter->second.m_channel.default_flags : GetFlags(error_stream, *iter, categories); iter->second.Enable(log_stream_sp, log_options, flags); @@ -219,8 +216,8 @@ error_stream << llvm::formatv("Invalid log channel '{0}'.\n", channel); return false; } - uint32_t flags = categories.empty() - ? UINT32_MAX + LogMask flags = categories.empty() + ? LLDB_LOG_ALL_BITS : GetFlags(error_stream, *iter, categories); iter->second.Disable(flags); return true; @@ -239,7 +236,7 @@ void Log::DisableAllLogChannels() { for (auto &entry : *g_channel_map) - entry.second.Disable(UINT32_MAX); + entry.second.Disable(LLDB_LOG_ALL_BITS); } void Log::ForEachChannelCategory( diff --git a/lldb/source/Utility/Logging.cpp b/lldb/source/Utility/Logging.cpp deleted file mode 100644 --- a/lldb/source/Utility/Logging.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===-- Logging.cpp -------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "lldb/Utility/Logging.h" -#include "lldb/Utility/Log.h" - -#include "llvm/ADT/ArrayRef.h" - -#include - -using namespace lldb_private; - -static constexpr Log::Category g_categories[] = { - {{"api"}, {"log API calls and return values"}, LIBLLDB_LOG_API}, - {{"ast"}, {"log AST"}, LIBLLDB_LOG_AST}, - {{"break"}, {"log breakpoints"}, LIBLLDB_LOG_BREAKPOINTS}, - {{"commands"}, {"log command argument parsing"}, LIBLLDB_LOG_COMMANDS}, - {{"comm"}, {"log communication activities"}, LIBLLDB_LOG_COMMUNICATION}, - {{"conn"}, {"log connection details"}, LIBLLDB_LOG_CONNECTION}, - {{"demangle"}, {"log mangled names to catch demangler crashes"}, LIBLLDB_LOG_DEMANGLE}, - {{"dyld"}, {"log shared library related activities"}, LIBLLDB_LOG_DYNAMIC_LOADER}, - {{"event"}, {"log broadcaster, listener and event queue activities"}, LIBLLDB_LOG_EVENTS}, - {{"expr"}, {"log expressions"}, LIBLLDB_LOG_EXPRESSIONS}, - {{"formatters"}, {"log data formatters related activities"}, LIBLLDB_LOG_DATAFORMATTERS}, - {{"host"}, {"log host activities"}, LIBLLDB_LOG_HOST}, - {{"jit"}, {"log JIT events in the target"}, LIBLLDB_LOG_JIT_LOADER}, - {{"language"}, {"log language runtime events"}, LIBLLDB_LOG_LANGUAGE}, - {{"mmap"}, {"log mmap related activities"}, LIBLLDB_LOG_MMAP}, - {{"module"}, {"log module activities such as when modules are created, destroyed, replaced, and more"}, LIBLLDB_LOG_MODULES}, - {{"object"}, {"log object construction/destruction for important objects"}, LIBLLDB_LOG_OBJECT}, - {{"os"}, {"log OperatingSystem plugin related activities"}, LIBLLDB_LOG_OS}, - {{"platform"}, {"log platform events and activities"}, LIBLLDB_LOG_PLATFORM}, - {{"process"}, {"log process events and activities"}, LIBLLDB_LOG_PROCESS}, - {{"script"}, {"log events about the script interpreter"}, LIBLLDB_LOG_SCRIPT}, - {{"state"}, {"log private and public process state changes"}, LIBLLDB_LOG_STATE}, - {{"step"}, {"log step related activities"}, LIBLLDB_LOG_STEP}, - {{"symbol"}, {"log symbol related issues and warnings"}, LIBLLDB_LOG_SYMBOLS}, - {{"system-runtime"}, {"log system runtime events"}, LIBLLDB_LOG_SYSTEM_RUNTIME}, - {{"target"}, {"log target events and activities"}, LIBLLDB_LOG_TARGET}, - {{"temp"}, {"log internal temporary debug messages"}, LIBLLDB_LOG_TEMPORARY}, - {{"thread"}, {"log thread events and activities"}, LIBLLDB_LOG_THREAD}, - {{"types"}, {"log type system related activities"}, LIBLLDB_LOG_TYPES}, - {{"unwind"}, {"log stack unwind activities"}, LIBLLDB_LOG_UNWIND}, - {{"watch"}, {"log watchpoint related activities"}, LIBLLDB_LOG_WATCHPOINTS}, -}; - -static Log::Channel g_log_channel(g_categories, LIBLLDB_LOG_DEFAULT); - -void lldb_private::InitializeLldbChannel() { - Log::Register("lldb", g_log_channel); -} - -Log *lldb_private::GetLogIfAllCategoriesSet(uint32_t mask) { - return g_log_channel.GetLogIfAll(mask); -} - -Log *lldb_private::GetLogIfAnyCategoriesSet(uint32_t mask) { - return g_log_channel.GetLogIfAny(mask); -} diff --git a/lldb/source/Utility/ReproducerInstrumentation.cpp b/lldb/source/Utility/ReproducerInstrumentation.cpp --- a/lldb/source/Utility/ReproducerInstrumentation.cpp +++ b/lldb/source/Utility/ReproducerInstrumentation.cpp @@ -31,7 +31,7 @@ if (!g_global_boundary) { g_global_boundary = true; m_local_boundary = true; - LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API), "{0} ({1})", + LLDB_LOG(LLDBLog::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API), "{0} ({1})", pretty_func, pretty_args); } } diff --git a/lldb/source/Utility/StringList.cpp b/lldb/source/Utility/StringList.cpp --- a/lldb/source/Utility/StringList.cpp +++ b/lldb/source/Utility/StringList.cpp @@ -8,7 +8,7 @@ #include "lldb/Utility/StringList.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" #include "llvm/ADT/ArrayRef.h" diff --git a/lldb/tools/lldb-server/LLDBServerUtilities.cpp b/lldb/tools/lldb-server/LLDBServerUtilities.cpp --- a/lldb/tools/lldb-server/LLDBServerUtilities.cpp +++ b/lldb/tools/lldb-server/LLDBServerUtilities.cpp @@ -9,7 +9,7 @@ #include "LLDBServerUtilities.h" #include "lldb/Utility/Args.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "llvm/ADT/SmallVector.h" diff --git a/lldb/tools/lldb-server/lldb-gdbserver.cpp b/lldb/tools/lldb-server/lldb-gdbserver.cpp --- a/lldb/tools/lldb-server/lldb-gdbserver.cpp +++ b/lldb/tools/lldb-server/lldb-gdbserver.cpp @@ -94,7 +94,7 @@ static void sighup_handler(MainLoopBase &mainloop) { ++g_sighup_received_count; - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + Log *log(LLDBLog::GetLogIfAnyCategoryIsSet(LIBLLDB_LOG_PROCESS)); LLDB_LOGF(log, "lldb-server:%s swallowing SIGHUP (receive count=%d)", __FUNCTION__, g_sighup_received_count); diff --git a/lldb/unittests/Utility/LogTest.cpp b/lldb/unittests/Utility/LogTest.cpp --- a/lldb/unittests/Utility/LogTest.cpp +++ b/lldb/unittests/Utility/LogTest.cpp @@ -9,7 +9,7 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" -#include "lldb/Utility/Log.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/StreamString.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Threading.h" @@ -230,7 +230,7 @@ llvm::StringRef Msg = logAndTakeOutput("Hello World"); char File[12]; char Function[17]; - + sscanf(Msg.str().c_str(), "%[^:]:%s Hello World", File, Function); EXPECT_STRCASEEQ("LogTest.cpp", File); EXPECT_STREQ("logAndTakeOutput", Function);