[Lldb-commits] [lldb] e0e36e3 - [lldb] Fix incorrect uses of LLDB_LOG_ERROR

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 5 11:27:57 PDT 2023


Author: Jonas Devlieghere
Date: 2023-07-05T11:27:52-07:00
New Revision: e0e36e3725b50ac690d1839f0e9476e93ff7988d

URL: https://github.com/llvm/llvm-project/commit/e0e36e3725b50ac690d1839f0e9476e93ff7988d
DIFF: https://github.com/llvm/llvm-project/commit/e0e36e3725b50ac690d1839f0e9476e93ff7988d.diff

LOG: [lldb] Fix incorrect uses of LLDB_LOG_ERROR

Fix incorrect uses of LLDB_LOG_ERROR. The macro doesn't automatically
inject the error in the log message: it merely passes the error as the
first argument to formatv and therefore must be referenced with {0}.

Thanks to Nicholas Allegra for collecting a list of places where the
macro was misused.

rdar://111581655

Differential revision: https://reviews.llvm.org/D154530

Added: 
    

Modified: 
    lldb/source/Breakpoint/Watchpoint.cpp
    lldb/source/Core/ValueObjectRegister.cpp
    lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
    lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
    lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
    lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
    lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
    lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
    lldb/source/Symbol/Type.cpp
    lldb/source/Target/StackFrame.cpp
    lldb/source/Target/Target.cpp
    lldb/source/Target/ThreadPlanTracer.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Breakpoint/Watchpoint.cpp b/lldb/source/Breakpoint/Watchpoint.cpp
index 597e696c71276c..b6e6d4a5a32d5e 100644
--- a/lldb/source/Breakpoint/Watchpoint.cpp
+++ b/lldb/source/Breakpoint/Watchpoint.cpp
@@ -41,14 +41,14 @@ Watchpoint::Watchpoint(Target &target, lldb::addr_t addr, uint32_t size,
         target.GetScratchTypeSystemForLanguage(eLanguageTypeC);
     if (auto err = type_system_or_err.takeError()) {
       LLDB_LOG_ERROR(GetLog(LLDBLog::Watchpoints), std::move(err),
-                     "Failed to set type.");
+                     "Failed to set type: {0}");
     } else {
       if (auto ts = *type_system_or_err)
         m_type =
             ts->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 8 * size);
       else
         LLDB_LOG_ERROR(GetLog(LLDBLog::Watchpoints), std::move(err),
-                       "Failed to set type. Typesystem is no longer live.");
+                       "Failed to set type: Typesystem is no longer live: {0}");
     }
   }
 

diff  --git a/lldb/source/Core/ValueObjectRegister.cpp b/lldb/source/Core/ValueObjectRegister.cpp
index 798868997a05c1..c2b84c11347359 100644
--- a/lldb/source/Core/ValueObjectRegister.cpp
+++ b/lldb/source/Core/ValueObjectRegister.cpp
@@ -202,7 +202,7 @@ CompilerType ValueObjectRegister::GetCompilerTypeImpl() {
             exe_module->GetTypeSystemForLanguage(eLanguageTypeC);
         if (auto err = type_system_or_err.takeError()) {
           LLDB_LOG_ERROR(GetLog(LLDBLog::Types), std::move(err),
-                         "Unable to get CompilerType from TypeSystem");
+                         "Unable to get CompilerType from TypeSystem: {0}");
         } else {
           if (auto ts = *type_system_or_err)
             m_compiler_type = ts->GetBuiltinTypeForEncodingAndBitSize(

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
index c92ac4bdec1480..e780cd8285c455 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
@@ -45,7 +45,7 @@ class BlockPointerSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
         lldb::eLanguageTypeC_plus_plus);
     if (auto err = type_system_or_err.takeError()) {
       LLDB_LOG_ERROR(GetLog(LLDBLog::DataFormatters), std::move(err),
-                     "Failed to get scratch TypeSystemClang");
+                     "Failed to get scratch TypeSystemClang: {0}");
       return;
     }
 

diff  --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index ef54c2b5044b0b..a2e1c8e54dd4e5 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -1685,7 +1685,7 @@ AppleObjCRuntimeV2::SharedCacheImageHeaders::CreateSharedCacheImageHeaders(
                                   entsize));
   if (auto Err = shared_cache_image_headers->UpdateIfNeeded()) {
     LLDB_LOG_ERROR(log, std::move(Err),
-                   "Failed to update SharedCacheImageHeaders");
+                   "Failed to update SharedCacheImageHeaders: {0}");
     return nullptr;
   }
 
@@ -1745,7 +1745,7 @@ bool AppleObjCRuntimeV2::SharedCacheImageHeaders::IsImageLoaded(
   if (auto Err = UpdateIfNeeded()) {
     Log *log = GetLog(LLDBLog::Process | LLDBLog::Types);
     LLDB_LOG_ERROR(log, std::move(Err),
-                   "Failed to update SharedCacheImageHeaders");
+                   "Failed to update SharedCacheImageHeaders: {0}");
   }
   return m_loaded_images.test(image_index);
 }
@@ -1754,7 +1754,7 @@ uint64_t AppleObjCRuntimeV2::SharedCacheImageHeaders::GetVersion() {
   if (auto Err = UpdateIfNeeded()) {
     Log *log = GetLog(LLDBLog::Process | LLDBLog::Types);
     LLDB_LOG_ERROR(log, std::move(Err),
-                   "Failed to update SharedCacheImageHeaders");
+                   "Failed to update SharedCacheImageHeaders: {0}");
   }
   return m_version;
 }

diff  --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index 9267a1a2a67656..b17701ea4a15cf 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -729,7 +729,7 @@ bool ProcessKDP::StartAsyncThread() {
       "<lldb.process.kdp-remote.async>", [this] { return AsyncThread(); });
   if (!async_thread) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Host), async_thread.takeError(),
-                   "failed to launch host thread: {}");
+                   "failed to launch host thread: {0}");
     return false;
   }
   m_async_thread = *async_thread;

diff  --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 84d2010acefe4b..522dee9f768620 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -3430,7 +3430,7 @@ bool ProcessGDBRemote::StartAsyncThread() {
         });
     if (!async_thread) {
       LLDB_LOG_ERROR(GetLog(LLDBLog::Host), async_thread.takeError(),
-                     "failed to launch host thread: {}");
+                     "failed to launch host thread: {0}");
       return false;
     }
     m_async_thread = *async_thread;

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
index aa5d7f61dbfbb8..b38dd2b88c9d0b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
@@ -43,7 +43,7 @@ void DWARFDebugAranges::extract(const DWARFDataExtractor &debug_aranges_data) {
       Log *log = GetLog(DWARFLog::DebugInfo);
       LLDB_LOG_ERROR(log, std::move(error),
                      "DWARFDebugAranges::extract failed to extract "
-                     ".debug_aranges set at offset %#" PRIx64,
+                     ".debug_aranges set at offset {1:x}: {0}",
                      set_offset);
     } else {
       const uint32_t num_descriptors = set.NumDescriptors();

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index e0c0d2f48ec17c..37a8470cdf8b21 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -830,7 +830,7 @@ Function *SymbolFileDWARF::ParseFunction(CompileUnit &comp_unit,
   auto type_system_or_err = GetTypeSystemForLanguage(GetLanguage(*die.GetCU()));
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to parse function");
+                   "Unable to parse function: {0}");
     return nullptr;
   }
   auto ts = *type_system_or_err;
@@ -878,7 +878,7 @@ SymbolFileDWARF::ConstructFunctionDemangledName(const DWARFDIE &die) {
   auto type_system_or_err = GetTypeSystemForLanguage(GetLanguage(*die.GetCU()));
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to construct demangled name for function");
+                   "Unable to construct demangled name for function: {0}");
     return ConstString();
   }
 
@@ -1066,7 +1066,7 @@ SymbolFileDWARF::GetTypeUnitSupportFiles(DWARFTypeUnit &tu) {
       Log *log = GetLog(DWARFLog::DebugInfo);
       LLDB_LOG_ERROR(log, std::move(error),
                      "SymbolFileDWARF::GetTypeUnitSupportFiles failed to parse "
-                     "the line table prologue");
+                     "the line table prologue: {0}");
     };
     ElapsedTime elapsed(m_parse_time);
     llvm::Error error = prologue.parse(data, &line_table_offset, report, ctx);
@@ -2131,7 +2131,7 @@ bool SymbolFileDWARF::DeclContextMatchesThisSymbolFile(
       decl_ctx_type_system->GetMinimumLanguage(nullptr));
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to match namespace decl using TypeSystem");
+                   "Unable to match namespace decl using TypeSystem: {0}");
     return false;
   }
 
@@ -2977,7 +2977,7 @@ SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext(const DWARFDIE &die) {
       auto type_system_or_err = GetTypeSystemForLanguage(language);
       if (auto err = type_system_or_err.takeError()) {
         LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                       "Cannot get TypeSystem for language {}",
+                       "Cannot get TypeSystem for language {1}: {0}",
                        Language::GetNameForLanguageType(language));
       } else {
         type_system = *type_system_or_err;
@@ -3100,7 +3100,7 @@ TypeSP SymbolFileDWARF::ParseType(const SymbolContext &sc, const DWARFDIE &die,
   auto type_system_or_err = GetTypeSystemForLanguage(GetLanguage(*die.GetCU()));
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to parse type");
+                   "Unable to parse type: {0}");
     return {};
   }
   auto ts = *type_system_or_err;
@@ -4162,7 +4162,7 @@ DWARFASTParser *SymbolFileDWARF::GetDWARFParser(DWARFUnit &unit) {
   auto type_system_or_err = GetTypeSystem(unit);
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to get DWARFASTParser");
+                   "Unable to get DWARFASTParser: {0}");
     return nullptr;
   }
   if (auto ts = *type_system_or_err)

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 8c91033ba26044..f14fb32621b308 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -358,7 +358,7 @@ void SymbolFileNativePDB::InitializeObject() {
       lldb::eLanguageTypeC_plus_plus);
   if (auto err = ts_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Failed to initialize");
+                   "Failed to initialize: {0}");
   } else {
     if (auto ts = *ts_or_err)
       ts->SetSymbolFile(this);

diff  --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index 241272ae84300d..78eabc35ebf9f1 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -319,7 +319,7 @@ SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc(const PDBSymbolFunc &pdb_func,
   auto type_system_or_err = GetTypeSystemForLanguage(lang);
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to parse PDBFunc");
+                   "Unable to parse PDBFunc: {0}");
     return nullptr;
   }
 
@@ -570,7 +570,7 @@ lldb_private::Type *SymbolFilePDB::ResolveTypeUID(lldb::user_id_t type_uid) {
       GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to ResolveTypeUID");
+                   "Unable to ResolveTypeUID: {0}");
     return nullptr;
   }
 
@@ -607,7 +607,7 @@ bool SymbolFilePDB::CompleteType(lldb_private::CompilerType &compiler_type) {
       GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to get dynamic array info for UID");
+                   "Unable to get dynamic array info for UID: {0}");
     return false;
   }
   auto ts = *type_system_or_err;
@@ -629,7 +629,7 @@ lldb_private::CompilerDecl SymbolFilePDB::GetDeclForUID(lldb::user_id_t uid) {
       GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to get decl for UID");
+                   "Unable to get decl for UID: {0}");
     return CompilerDecl();
   }
   auto ts = *type_system_or_err;
@@ -659,7 +659,7 @@ SymbolFilePDB::GetDeclContextForUID(lldb::user_id_t uid) {
       GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to get DeclContext for UID");
+                   "Unable to get DeclContext for UID: {0}");
     return CompilerDeclContext();
   }
 
@@ -690,7 +690,7 @@ SymbolFilePDB::GetDeclContextContainingUID(lldb::user_id_t uid) {
       GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to get DeclContext containing UID");
+                   "Unable to get DeclContext containing UID: {0}");
     return CompilerDeclContext();
   }
 
@@ -720,7 +720,7 @@ void SymbolFilePDB::ParseDeclsForContext(
       GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to parse decls for context");
+                   "Unable to parse decls for context: {0}");
     return;
   }
 
@@ -1469,7 +1469,7 @@ void SymbolFilePDB::DumpClangAST(Stream &s) {
       GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to dump ClangAST");
+                   "Unable to dump ClangAST: {0}");
     return;
   }
 
@@ -1682,7 +1682,7 @@ PDBASTParser *SymbolFilePDB::GetPDBAstParser() {
       GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to get PDB AST parser");
+                   "Unable to get PDB AST parser: {0}");
     return nullptr;
   }
 
@@ -1703,7 +1703,7 @@ SymbolFilePDB::FindNamespace(lldb_private::ConstString name,
       GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to find namespace {}", name.AsCString());
+                   "Unable to find namespace {1}: {0}", name.AsCString());
     return CompilerDeclContext();
   }
   auto ts = *type_system_or_err;
@@ -1998,7 +1998,7 @@ bool SymbolFilePDB::DeclContextMatchesThisSymbolFile(
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(
         GetLog(LLDBLog::Symbols), std::move(err),
-        "Unable to determine if DeclContext matches this symbol file");
+        "Unable to determine if DeclContext matches this symbol file: {0}");
     return false;
   }
 

diff  --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
index 63d07dbec673f0..a1c016cb680052 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
@@ -148,7 +148,7 @@ lldb::addr_t AppleGetItemInfoHandler::SetupGetItemInfoFunction(
             eLanguageTypeObjC, exe_ctx);
         if (!utility_fn_or_error) {
           LLDB_LOG_ERROR(log, utility_fn_or_error.takeError(),
-                         "Failed to create utility function: {0}.");
+                         "Failed to create utility function: {0}");
         }
         m_get_item_info_impl_code = std::move(*utility_fn_or_error);
       } else {
@@ -162,13 +162,13 @@ lldb::addr_t AppleGetItemInfoHandler::SetupGetItemInfoFunction(
               eLanguageTypeC);
       if (auto err = type_system_or_err.takeError()) {
         LLDB_LOG_ERROR(log, std::move(err),
-                       "Error inserting get-item-info function");
+                       "Error inserting get-item-info function: {0}");
         return args_addr;
       }
       auto ts = *type_system_or_err;
       if (!ts)
         return args_addr;
-      
+
       CompilerType get_item_info_return_type =
           ts->GetBasicTypeFromAST(eBasicTypeVoid)
               .GetPointerType();

diff  --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index f901c24298a305..66284eb73cad03 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -546,8 +546,9 @@ bool Type::ResolveCompilerType(ResolveState compiler_type_resolve_state) {
       auto type_system_or_err =
           m_symbol_file->GetTypeSystemForLanguage(eLanguageTypeC);
       if (auto err = type_system_or_err.takeError()) {
-        LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                       "Unable to construct void type from TypeSystemClang");
+        LLDB_LOG_ERROR(
+            GetLog(LLDBLog::Symbols), std::move(err),
+            "Unable to construct void type from TypeSystemClang: {0}");
       } else {
         CompilerType void_compiler_type;
         auto ts = *type_system_or_err;

diff  --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index 43ce8758d5abc1..11ada92348ecee 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -1360,7 +1360,7 @@ lldb::ValueObjectSP StackFrame::GuessValueForAddress(lldb::addr_t addr) {
             target_sp->GetScratchTypeSystemForLanguage(eLanguageTypeC);
         if (auto err = c_type_system_or_err.takeError()) {
           LLDB_LOG_ERROR(GetLog(LLDBLog::Thread), std::move(err),
-                         "Unable to guess value for given address");
+                         "Unable to guess value for given address: {0}");
           return ValueObjectSP();
         } else {
           auto ts = *c_type_system_or_err;

diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index d9cd0f0a3d1570..e91fb380443538 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -2387,10 +2387,11 @@ Target::GetScratchTypeSystems(bool create_on_demand) {
     auto type_system_or_err =
         GetScratchTypeSystemForLanguage(language, create_on_demand);
     if (!type_system_or_err)
-      LLDB_LOG_ERROR(GetLog(LLDBLog::Target), type_system_or_err.takeError(),
-                     "Language '{}' has expression support but no scratch type "
-                     "system available",
-                     Language::GetNameForLanguageType(language));
+      LLDB_LOG_ERROR(
+          GetLog(LLDBLog::Target), type_system_or_err.takeError(),
+          "Language '{1}' has expression support but no scratch type "
+          "system available: {0}",
+          Language::GetNameForLanguageType(language));
     else
       if (auto ts = *type_system_or_err)
         scratch_type_systems.push_back(ts);
@@ -2408,9 +2409,10 @@ Target::GetPersistentExpressionStateForLanguage(lldb::LanguageType language) {
   auto type_system_or_err = GetScratchTypeSystemForLanguage(language, true);
 
   if (auto err = type_system_or_err.takeError()) {
-    LLDB_LOG_ERROR(GetLog(LLDBLog::Target), std::move(err),
-                   "Unable to get persistent expression state for language {}",
-                   Language::GetNameForLanguageType(language));
+    LLDB_LOG_ERROR(
+        GetLog(LLDBLog::Target), std::move(err),
+        "Unable to get persistent expression state for language {1}: {0}",
+        Language::GetNameForLanguageType(language));
     return nullptr;
   }
 
@@ -2418,7 +2420,7 @@ Target::GetPersistentExpressionStateForLanguage(lldb::LanguageType language) {
     return ts->GetPersistentExpressionState();
 
   LLDB_LOG(GetLog(LLDBLog::Target),
-           "Unable to get persistent expression state for language {}",
+           "Unable to get persistent expression state for language {1}: {0}",
            Language::GetNameForLanguageType(language));
   return nullptr;
 }
@@ -2617,7 +2619,7 @@ ExpressionResults Target::EvaluateExpression(
       auto ts = *type_system_or_err;
       if (!ts)
         LLDB_LOG_ERROR(GetLog(LLDBLog::Target), std::move(err),
-                       "Scratch type system is no longer live");
+                       "Scratch type system is no longer live: {0}");
       else
         persistent_var_sp =
             ts->GetPersistentExpressionState()->GetVariable(expr);

diff  --git a/lldb/source/Target/ThreadPlanTracer.cpp b/lldb/source/Target/ThreadPlanTracer.cpp
index 25e2e4013355ca..f4d80ba890718e 100644
--- a/lldb/source/Target/ThreadPlanTracer.cpp
+++ b/lldb/source/Target/ThreadPlanTracer.cpp
@@ -56,7 +56,7 @@ Stream *ThreadPlanTracer::GetLogStream() {
 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;
@@ -107,8 +107,9 @@ TypeFromUser ThreadPlanAssemblyTracer::GetIntPointerType() {
       auto type_system_or_err =
           target_sp->GetScratchTypeSystemForLanguage(eLanguageTypeC);
       if (auto err = type_system_or_err.takeError()) {
-        LLDB_LOG_ERROR(GetLog(LLDBLog::Types), std::move(err),
-                       "Unable to get integer pointer type from TypeSystem");
+        LLDB_LOG_ERROR(
+            GetLog(LLDBLog::Types), std::move(err),
+            "Unable to get integer pointer type from TypeSystem: {0}");
       } else {
         if (auto ts = *type_system_or_err)
           m_intptr_type = TypeFromUser(ts->GetBuiltinTypeForEncodingAndBitSize(


        


More information about the lldb-commits mailing list