diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-07-24 17:56:10 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-07-24 17:56:10 +0000 |
commit | 63e5fb76ecfed3434252868d8cf07d676f979f2f (patch) | |
tree | 349d6bd303f53aa57b988dee284c7f264404a8fc /lldb/source/Symbol | |
parent | 2bf871be4c35d70db080dde789cf9bb334c04057 (diff) | |
download | bcm5719-llvm-63e5fb76ecfed3434252868d8cf07d676f979f2f.tar.gz bcm5719-llvm-63e5fb76ecfed3434252868d8cf07d676f979f2f.zip |
[Logging] Replace Log::Printf with LLDB_LOG macro (NFC)
This patch replaces explicit calls to log::Printf with the new LLDB_LOGF
macro. The macro is similar to LLDB_LOG but supports printf-style format
strings, instead of formatv-style format strings.
So instead of writing:
if (log)
log->Printf("%s\n", str);
You'd write:
LLDB_LOG(log, "%s\n", str);
This change was done mechanically with the command below. I replaced the
spurious if-checks with vim, since I know how to do multi-line
replacements with it.
find . -type f -name '*.cpp' -exec \
sed -i '' -E 's/log->Printf\(/LLDB_LOGF\(log, /g' "{}" +
Differential revision: https://reviews.llvm.org/D65128
llvm-svn: 366936
Diffstat (limited to 'lldb/source/Symbol')
-rw-r--r-- | lldb/source/Symbol/Block.cpp | 32 | ||||
-rw-r--r-- | lldb/source/Symbol/ClangASTContext.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Symbol/ClangASTImporter.cpp | 182 | ||||
-rw-r--r-- | lldb/source/Symbol/CompactUnwindInfo.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Symbol/DWARFCallFrameInfo.cpp | 13 | ||||
-rw-r--r-- | lldb/source/Symbol/LocateSymbolFile.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Symbol/LocateSymbolFileMacOSX.cpp | 67 | ||||
-rw-r--r-- | lldb/source/Symbol/ObjectFile.cpp | 36 | ||||
-rw-r--r-- | lldb/source/Symbol/SymbolContext.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Symbol/UnwindPlan.cpp | 38 |
10 files changed, 198 insertions, 187 deletions
diff --git a/lldb/source/Symbol/Block.cpp b/lldb/source/Symbol/Block.cpp index 6fe617080f9..523539a4ded 100644 --- a/lldb/source/Symbol/Block.cpp +++ b/lldb/source/Symbol/Block.cpp @@ -337,22 +337,24 @@ void Block::AddRange(const Range &range) { const Declaration &func_decl = func_type->GetDeclaration(); if (func_decl.GetLine()) { - log->Printf("warning: %s:%u block {0x%8.8" PRIx64 - "} has range[%u] [0x%" PRIx64 " - 0x%" PRIx64 - ") which is not contained in parent block {0x%8.8" PRIx64 - "} in function {0x%8.8" PRIx64 "} from %s", - func_decl.GetFile().GetPath().c_str(), func_decl.GetLine(), - GetID(), (uint32_t)m_ranges.GetSize(), block_start_addr, - block_end_addr, parent_block->GetID(), function->GetID(), - module_sp->GetFileSpec().GetPath().c_str()); + LLDB_LOGF(log, + "warning: %s:%u block {0x%8.8" PRIx64 + "} has range[%u] [0x%" PRIx64 " - 0x%" PRIx64 + ") which is not contained in parent block {0x%8.8" PRIx64 + "} in function {0x%8.8" PRIx64 "} from %s", + func_decl.GetFile().GetPath().c_str(), func_decl.GetLine(), + GetID(), (uint32_t)m_ranges.GetSize(), block_start_addr, + block_end_addr, parent_block->GetID(), function->GetID(), + module_sp->GetFileSpec().GetPath().c_str()); } else { - log->Printf("warning: block {0x%8.8" PRIx64 - "} has range[%u] [0x%" PRIx64 " - 0x%" PRIx64 - ") which is not contained in parent block {0x%8.8" PRIx64 - "} in function {0x%8.8" PRIx64 "} from %s", - GetID(), (uint32_t)m_ranges.GetSize(), block_start_addr, - block_end_addr, parent_block->GetID(), function->GetID(), - module_sp->GetFileSpec().GetPath().c_str()); + LLDB_LOGF(log, + "warning: block {0x%8.8" PRIx64 "} has range[%u] [0x%" PRIx64 + " - 0x%" PRIx64 + ") which is not contained in parent block {0x%8.8" PRIx64 + "} in function {0x%8.8" PRIx64 "} from %s", + GetID(), (uint32_t)m_ranges.GetSize(), block_start_addr, + block_end_addr, parent_block->GetID(), function->GetID(), + module_sp->GetFileSpec().GetPath().c_str()); } } parent_block->AddRange(range); diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index 205523355ce..b348ba7508d 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -956,7 +956,7 @@ public: llvm::SmallVector<char, 32> diag_str(10); info.FormatDiagnostic(diag_str); diag_str.push_back('\0'); - m_log->Printf("Compiler diagnostic: %s\n", diag_str.data()); + LLDB_LOGF(m_log, "Compiler diagnostic: %s\n", diag_str.data()); } } diff --git a/lldb/source/Symbol/ClangASTImporter.cpp b/lldb/source/Symbol/ClangASTImporter.cpp index 32d0c47693b..5319f794ef9 100644 --- a/lldb/source/Symbol/ClangASTImporter.cpp +++ b/lldb/source/Symbol/ClangASTImporter.cpp @@ -30,28 +30,28 @@ ClangASTMetrics::Counters ClangASTMetrics::local_counters = {0, 0, 0, 0, 0, 0}; void ClangASTMetrics::DumpCounters(Log *log, ClangASTMetrics::Counters &counters) { - log->Printf(" Number of visible Decl queries by name : %" PRIu64, - counters.m_visible_query_count); - log->Printf(" Number of lexical Decl queries : %" PRIu64, - counters.m_lexical_query_count); - log->Printf(" Number of imports initiated by LLDB : %" PRIu64, - counters.m_lldb_import_count); - log->Printf(" Number of imports conducted by Clang : %" PRIu64, - counters.m_clang_import_count); - log->Printf(" Number of Decls completed : %" PRIu64, - counters.m_decls_completed_count); - log->Printf(" Number of records laid out : %" PRIu64, - counters.m_record_layout_count); + LLDB_LOGF(log, " Number of visible Decl queries by name : %" PRIu64, + counters.m_visible_query_count); + LLDB_LOGF(log, " Number of lexical Decl queries : %" PRIu64, + counters.m_lexical_query_count); + LLDB_LOGF(log, " Number of imports initiated by LLDB : %" PRIu64, + counters.m_lldb_import_count); + LLDB_LOGF(log, " Number of imports conducted by Clang : %" PRIu64, + counters.m_clang_import_count); + LLDB_LOGF(log, " Number of Decls completed : %" PRIu64, + counters.m_decls_completed_count); + LLDB_LOGF(log, " Number of records laid out : %" PRIu64, + counters.m_record_layout_count); } void ClangASTMetrics::DumpCounters(Log *log) { if (!log) return; - log->Printf("== ClangASTMetrics output =="); - log->Printf("-- Global metrics --"); + LLDB_LOGF(log, "== ClangASTMetrics output =="); + LLDB_LOGF(log, "-- Global metrics --"); DumpCounters(log, global_counters); - log->Printf("-- Local metrics --"); + LLDB_LOGF(log, "-- Local metrics --"); DumpCounters(log, local_counters); } @@ -127,14 +127,16 @@ clang::Decl *ClangASTImporter::CopyDecl(clang::ASTContext *dst_ast, user_id = metadata->GetUserID(); if (NamedDecl *named_decl = dyn_cast<NamedDecl>(decl)) - log->Printf(" [ClangASTImporter] WARNING: Failed to import a %s " - "'%s', metadata 0x%" PRIx64, - decl->getDeclKindName(), - named_decl->getNameAsString().c_str(), user_id); + LLDB_LOGF(log, + " [ClangASTImporter] WARNING: Failed to import a %s " + "'%s', metadata 0x%" PRIx64, + decl->getDeclKindName(), + named_decl->getNameAsString().c_str(), user_id); else - log->Printf(" [ClangASTImporter] WARNING: Failed to import a %s, " - "metadata 0x%" PRIx64, - decl->getDeclKindName(), user_id); + LLDB_LOGF(log, + " [ClangASTImporter] WARNING: Failed to import a %s, " + "metadata 0x%" PRIx64, + decl->getDeclKindName(), user_id); } return nullptr; } @@ -211,12 +213,12 @@ private: if (clang::Decl *escaped_child = GetEscapedChild(decl)) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - if (log) - log->Printf(" [ClangASTImporter] DeclContextOverride couldn't " - "override (%sDecl*)%p - its child (%sDecl*)%p escapes", - decl->getDeclKindName(), static_cast<void *>(decl), - escaped_child->getDeclKindName(), - static_cast<void *>(escaped_child)); + LLDB_LOGF(log, + " [ClangASTImporter] DeclContextOverride couldn't " + "override (%sDecl*)%p - its child (%sDecl*)%p escapes", + decl->getDeclKindName(), static_cast<void *>(decl), + escaped_child->getDeclKindName(), + static_cast<void *>(escaped_child)); lldbassert(0 && "Couldn't override!"); } @@ -254,12 +256,12 @@ ClangASTImporter::DeportType(clang::ASTContext *dst_ctx, lldb::opaque_compiler_type_t type) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - if (log) - log->Printf(" [ClangASTImporter] DeportType called on (%sType*)0x%llx " - "from (ASTContext*)%p to (ASTContext*)%p", - QualType::getFromOpaquePtr(type)->getTypeClassName(), - (unsigned long long)type, static_cast<void *>(src_ctx), - static_cast<void *>(dst_ctx)); + LLDB_LOGF(log, + " [ClangASTImporter] DeportType called on (%sType*)0x%llx " + "from (ASTContext*)%p to (ASTContext*)%p", + QualType::getFromOpaquePtr(type)->getTypeClassName(), + (unsigned long long)type, static_cast<void *>(src_ctx), + static_cast<void *>(dst_ctx)); ImporterDelegateSP delegate_sp(GetDelegate(dst_ctx, src_ctx)); @@ -294,11 +296,11 @@ clang::Decl *ClangASTImporter::DeportDecl(clang::ASTContext *dst_ctx, clang::Decl *decl) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - if (log) - log->Printf(" [ClangASTImporter] DeportDecl called on (%sDecl*)%p from " - "(ASTContext*)%p to (ASTContext*)%p", - decl->getDeclKindName(), static_cast<void *>(decl), - static_cast<void *>(src_ctx), static_cast<void *>(dst_ctx)); + LLDB_LOGF(log, + " [ClangASTImporter] DeportDecl called on (%sDecl*)%p from " + "(ASTContext*)%p to (ASTContext*)%p", + decl->getDeclKindName(), static_cast<void *>(decl), + static_cast<void *>(src_ctx), static_cast<void *>(dst_ctx)); ImporterDelegateSP delegate_sp(GetDelegate(dst_ctx, src_ctx)); @@ -321,11 +323,11 @@ clang::Decl *ClangASTImporter::DeportDecl(clang::ASTContext *dst_ctx, if (!result) return nullptr; - if (log) - log->Printf( - " [ClangASTImporter] DeportDecl deported (%sDecl*)%p to (%sDecl*)%p", - decl->getDeclKindName(), static_cast<void *>(decl), - result->getDeclKindName(), static_cast<void *>(result)); + LLDB_LOGF( + log, + " [ClangASTImporter] DeportDecl deported (%sDecl*)%p to (%sDecl*)%p", + decl->getDeclKindName(), static_cast<void *>(decl), + result->getDeclKindName(), static_cast<void *>(result)); return result; } @@ -533,9 +535,8 @@ void ClangASTImporter::InsertRecordDecl(clang::RecordDecl *decl, void ClangASTImporter::CompleteDecl(clang::Decl *decl) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - if (log) - log->Printf(" [ClangASTImporter] CompleteDecl called on (%sDecl*)%p", - decl->getDeclKindName(), static_cast<void *>(decl)); + LLDB_LOGF(log, " [ClangASTImporter] CompleteDecl called on (%sDecl*)%p", + decl->getDeclKindName(), static_cast<void *>(decl)); if (ObjCInterfaceDecl *interface_decl = dyn_cast<ObjCInterfaceDecl>(decl)) { if (!interface_decl->getDefinition()) { @@ -817,9 +818,9 @@ void ClangASTImporter::BuildNamespaceMap(const clang::NamespaceDecl *decl) { void ClangASTImporter::ForgetDestination(clang::ASTContext *dst_ast) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - if (log) - log->Printf(" [ClangASTImporter] Forgetting destination (ASTContext*)%p", - static_cast<void *>(dst_ast)); + LLDB_LOGF(log, + " [ClangASTImporter] Forgetting destination (ASTContext*)%p", + static_cast<void *>(dst_ast)); m_metadata_map.erase(dst_ast); } @@ -830,10 +831,10 @@ void ClangASTImporter::ForgetSource(clang::ASTContext *dst_ast, Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - if (log) - log->Printf(" [ClangASTImporter] Forgetting source->dest " - "(ASTContext*)%p->(ASTContext*)%p", - static_cast<void *>(src_ast), static_cast<void *>(dst_ast)); + LLDB_LOGF(log, + " [ClangASTImporter] Forgetting source->dest " + "(ASTContext*)%p->(ASTContext*)%p", + static_cast<void *>(src_ast), static_cast<void *>(dst_ast)); if (!md) return; @@ -1045,15 +1046,17 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from, from_named_decl->printName(name_stream); name_stream.flush(); - log->Printf(" [ClangASTImporter] Imported (%sDecl*)%p, named %s (from " - "(Decl*)%p), metadata 0x%" PRIx64, - from->getDeclKindName(), static_cast<void *>(to), - name_string.c_str(), static_cast<void *>(from), user_id); + LLDB_LOGF(log, + " [ClangASTImporter] Imported (%sDecl*)%p, named %s (from " + "(Decl*)%p), metadata 0x%" PRIx64, + from->getDeclKindName(), static_cast<void *>(to), + name_string.c_str(), static_cast<void *>(from), user_id); } else { - log->Printf(" [ClangASTImporter] Imported (%sDecl*)%p (from " - "(Decl*)%p), metadata 0x%" PRIx64, - from->getDeclKindName(), static_cast<void *>(to), - static_cast<void *>(from), user_id); + LLDB_LOGF(log, + " [ClangASTImporter] Imported (%sDecl*)%p (from " + "(Decl*)%p), metadata 0x%" PRIx64, + from->getDeclKindName(), static_cast<void *>(to), + static_cast<void *>(from), user_id); } } @@ -1080,14 +1083,14 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from, if (direct_completer.get() != this) direct_completer->ASTImporter::Imported(origin_iter->second.decl, to); - if (log) - log->Printf(" [ClangASTImporter] Propagated origin " - "(Decl*)%p/(ASTContext*)%p from (ASTContext*)%p to " - "(ASTContext*)%p", - static_cast<void *>(origin_iter->second.decl), - static_cast<void *>(origin_iter->second.ctx), - static_cast<void *>(&from->getASTContext()), - static_cast<void *>(&to->getASTContext())); + LLDB_LOGF(log, + " [ClangASTImporter] Propagated origin " + "(Decl*)%p/(ASTContext*)%p from (ASTContext*)%p to " + "(ASTContext*)%p", + static_cast<void *>(origin_iter->second.decl), + static_cast<void *>(origin_iter->second.ctx), + static_cast<void *>(&from->getASTContext()), + static_cast<void *>(&to->getASTContext())); } else { if (m_decls_to_deport && m_decls_already_deported) { if (isa<TagDecl>(to) || isa<ObjCInterfaceDecl>(to)) { @@ -1107,10 +1110,10 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from, to_context_md->m_origins[to] = DeclOrigin(m_source_ctx, from); } - if (log) - log->Printf(" [ClangASTImporter] Decl has no origin information in " - "(ASTContext*)%p", - static_cast<void *>(&from->getASTContext())); + LLDB_LOGF(log, + " [ClangASTImporter] Decl has no origin information in " + "(ASTContext*)%p", + static_cast<void *>(&from->getASTContext())); } if (clang::NamespaceDecl *to_namespace = @@ -1130,11 +1133,11 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from, } else { to_context_md->m_origins[to] = DeclOrigin(m_source_ctx, from); - if (log) - log->Printf(" [ClangASTImporter] Sourced origin " - "(Decl*)%p/(ASTContext*)%p into (ASTContext*)%p", - static_cast<void *>(from), static_cast<void *>(m_source_ctx), - static_cast<void *>(&to->getASTContext())); + LLDB_LOGF(log, + " [ClangASTImporter] Sourced origin " + "(Decl*)%p/(ASTContext*)%p into (ASTContext*)%p", + static_cast<void *>(from), static_cast<void *>(m_source_ctx), + static_cast<void *>(&to->getASTContext())); } if (TagDecl *from_tag_decl = dyn_cast<TagDecl>(from)) { @@ -1143,13 +1146,13 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from, to_tag_decl->setHasExternalLexicalStorage(); to_tag_decl->getPrimaryContext()->setMustBuildLookupTable(); - if (log) - log->Printf( - " [ClangASTImporter] To is a TagDecl - attributes %s%s [%s->%s]", - (to_tag_decl->hasExternalLexicalStorage() ? " Lexical" : ""), - (to_tag_decl->hasExternalVisibleStorage() ? " Visible" : ""), - (from_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"), - (to_tag_decl->isCompleteDefinition() ? "complete" : "incomplete")); + LLDB_LOGF( + log, + " [ClangASTImporter] To is a TagDecl - attributes %s%s [%s->%s]", + (to_tag_decl->hasExternalLexicalStorage() ? " Lexical" : ""), + (to_tag_decl->hasExternalVisibleStorage() ? " Visible" : ""), + (from_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"), + (to_tag_decl->isCompleteDefinition() ? "complete" : "incomplete")); } if (isa<NamespaceDecl>(from)) { @@ -1171,15 +1174,16 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from, if (log) { if (ObjCInterfaceDecl *to_interface_decl = llvm::dyn_cast<ObjCInterfaceDecl>(to_container_decl)) { - log->Printf( + LLDB_LOGF( + log, " [ClangASTImporter] To is an ObjCInterfaceDecl - attributes " "%s%s%s", (to_interface_decl->hasExternalLexicalStorage() ? " Lexical" : ""), (to_interface_decl->hasExternalVisibleStorage() ? " Visible" : ""), (to_interface_decl->hasDefinition() ? " HasDefinition" : "")); } else { - log->Printf( - " [ClangASTImporter] To is an %sDecl - attributes %s%s", + LLDB_LOGF( + log, " [ClangASTImporter] To is an %sDecl - attributes %s%s", ((Decl *)to_container_decl)->getDeclKindName(), (to_container_decl->hasExternalLexicalStorage() ? " Lexical" : ""), (to_container_decl->hasExternalVisibleStorage() ? " Visible" : "")); diff --git a/lldb/source/Symbol/CompactUnwindInfo.cpp b/lldb/source/Symbol/CompactUnwindInfo.cpp index 1a634f29736..363853c5135 100644 --- a/lldb/source/Symbol/CompactUnwindInfo.cpp +++ b/lldb/source/Symbol/CompactUnwindInfo.cpp @@ -190,8 +190,8 @@ bool CompactUnwindInfo::GetUnwindPlan(Target &target, Address addr, Address::DumpStyle::DumpStyleResolvedDescriptionNoFunctionArguments, Address::DumpStyle::DumpStyleFileAddress, arch.GetAddressByteSize()); - log->Printf("Got compact unwind encoding 0x%x for function %s", - function_info.encoding, strm.GetData()); + LLDB_LOGF(log, "Got compact unwind encoding 0x%x for function %s", + function_info.encoding, strm.GetData()); } if (function_info.valid_range_offset_start != 0 && diff --git a/lldb/source/Symbol/DWARFCallFrameInfo.cpp b/lldb/source/Symbol/DWARFCallFrameInfo.cpp index 64bd22bd5cd..b4e74e9a289 100644 --- a/lldb/source/Symbol/DWARFCallFrameInfo.cpp +++ b/lldb/source/Symbol/DWARFCallFrameInfo.cpp @@ -773,13 +773,12 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset, // useful for compilers that move epilogue code into the body of a // function.) if (stack.empty()) { - if (log) - log->Printf("DWARFCallFrameInfo::%s(dwarf_offset: %" PRIx32 - ", startaddr: %" PRIx64 - " encountered DW_CFA_restore_state but state stack " - "is empty. Corrupt unwind info?", - __FUNCTION__, dwarf_offset, - startaddr.GetFileAddress()); + LLDB_LOGF(log, + "DWARFCallFrameInfo::%s(dwarf_offset: %" PRIx32 + ", startaddr: %" PRIx64 + " encountered DW_CFA_restore_state but state stack " + "is empty. Corrupt unwind info?", + __FUNCTION__, dwarf_offset, startaddr.GetFileAddress()); break; } lldb::addr_t offset = row->GetOffset(); diff --git a/lldb/source/Symbol/LocateSymbolFile.cpp b/lldb/source/Symbol/LocateSymbolFile.cpp index bfdb6e705f4..e42ea2fc83b 100644 --- a/lldb/source/Symbol/LocateSymbolFile.cpp +++ b/lldb/source/Symbol/LocateSymbolFile.cpp @@ -157,8 +157,8 @@ static bool LocateDSYMInVincinityOfExecutable(const ModuleSpec &module_spec, if (::LookForDsymNextToExecutablePath(module_spec, exec_fspec, dsym_fspec)) { if (log) { - log->Printf("dSYM with matching UUID & arch found at %s", - dsym_fspec.GetPath().c_str()); + LLDB_LOGF(log, "dSYM with matching UUID & arch found at %s", + dsym_fspec.GetPath().c_str()); } return true; } else { @@ -189,8 +189,8 @@ static bool LocateDSYMInVincinityOfExecutable(const ModuleSpec &module_spec, if (::LookForDsymNextToExecutablePath(module_spec, parent_dirs, dsym_fspec)) { if (log) { - log->Printf("dSYM with matching UUID & arch found at %s", - dsym_fspec.GetPath().c_str()); + LLDB_LOGF(log, "dSYM with matching UUID & arch found at %s", + dsym_fspec.GetPath().c_str()); } return true; } diff --git a/lldb/source/Symbol/LocateSymbolFileMacOSX.cpp b/lldb/source/Symbol/LocateSymbolFileMacOSX.cpp index 4e16382d53e..8b56fcc18cc 100644 --- a/lldb/source/Symbol/LocateSymbolFileMacOSX.cpp +++ b/lldb/source/Symbol/LocateSymbolFileMacOSX.cpp @@ -45,8 +45,7 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec, ModuleSpec &return_module_spec) { Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); if (!ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup()) { - if (log) - log->Printf("Spotlight lookup for .dSYM bundles is disabled."); + LLDB_LOGF(log, "Spotlight lookup for .dSYM bundles is disabled."); return 0; } @@ -102,9 +101,10 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec, if (::CFURLGetFileSystemRepresentation( dsym_url.get(), true, (UInt8 *)path, sizeof(path) - 1)) { if (log) { - log->Printf("DebugSymbols framework returned dSYM path of %s for " - "UUID %s -- looking for the dSYM", - path, uuid->GetAsString().c_str()); + LLDB_LOGF(log, + "DebugSymbols framework returned dSYM path of %s for " + "UUID %s -- looking for the dSYM", + path, uuid->GetAsString().c_str()); } FileSpec dsym_filespec(path); if (path[0] == '~') @@ -124,9 +124,10 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec, if (log) { if (::CFURLGetFileSystemRepresentation( dsym_url.get(), true, (UInt8 *)path, sizeof(path) - 1)) { - log->Printf("DebugSymbols framework returned dSYM path of %s for " - "UUID %s -- looking for an exec file", - path, uuid->GetAsString().c_str()); + LLDB_LOGF(log, + "DebugSymbols framework returned dSYM path of %s for " + "UUID %s -- looking for an exec file", + path, uuid->GetAsString().c_str()); } } @@ -145,8 +146,8 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec, if (exec_cf_path && ::CFStringGetFileSystemRepresentation( exec_cf_path, path, sizeof(path))) { if (log) { - log->Printf("plist bundle has exec path of %s for UUID %s", - path, uuid->GetAsString().c_str()); + LLDB_LOGF(log, "plist bundle has exec path of %s for UUID %s", + path, uuid->GetAsString().c_str()); } ++items_found; FileSpec exec_filespec(path); @@ -168,9 +169,10 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec, if (dsym_extension_pos) { *dsym_extension_pos = '\0'; if (log) { - log->Printf("Looking for executable binary next to dSYM " - "bundle with name with name %s", - path); + LLDB_LOGF(log, + "Looking for executable binary next to dSYM " + "bundle with name with name %s", + path); } FileSpec file_spec(path); FileSystem::Instance().Resolve(file_spec); @@ -199,9 +201,10 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec, ++items_found; return_module_spec.GetFileSpec() = bundle_exe_file_spec; if (log) { - log->Printf("Executable binary %s next to dSYM is " - "compatible; using", - path); + LLDB_LOGF(log, + "Executable binary %s next to dSYM is " + "compatible; using", + path); } } } @@ -228,9 +231,10 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec, ++items_found; return_module_spec.GetFileSpec() = file_spec; if (log) { - log->Printf("Executable binary %s next to dSYM is " - "compatible; using", - path); + LLDB_LOGF(log, + "Executable binary %s next to dSYM is " + "compatible; using", + path); } } break; @@ -315,9 +319,9 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict, module_spec.GetFileSpec().SetFile(str.c_str(), FileSpec::Style::native); FileSystem::Instance().Resolve(module_spec.GetFileSpec()); if (log) { - log->Printf( - "From dsymForUUID plist: Symbol rich executable is at '%s'", - str.c_str()); + LLDB_LOGF(log, + "From dsymForUUID plist: Symbol rich executable is at '%s'", + str.c_str()); } } } @@ -331,7 +335,8 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict, FileSystem::Instance().Resolve(module_spec.GetFileSpec()); success = true; if (log) { - log->Printf("From dsymForUUID plist: dSYM is at '%s'", str.c_str()); + LLDB_LOGF(log, "From dsymForUUID plist: dSYM is at '%s'", + str.c_str()); } } } @@ -582,11 +587,11 @@ bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec, std::string command_output; if (log) { if (!uuid_str.empty()) - log->Printf("Calling %s with UUID %s to find dSYM", - g_dsym_for_uuid_exe_path, uuid_str.c_str()); + LLDB_LOGF(log, "Calling %s with UUID %s to find dSYM", + g_dsym_for_uuid_exe_path, uuid_str.c_str()); else if (file_path[0] != '\0') - log->Printf("Calling %s with file %s to find dSYM", - g_dsym_for_uuid_exe_path, file_path); + LLDB_LOGF(log, "Calling %s with file %s to find dSYM", + g_dsym_for_uuid_exe_path, file_path); } Status error = Host::RunShellCommand( command.GetData(), @@ -643,11 +648,11 @@ bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec, } else { if (log) { if (!uuid_str.empty()) - log->Printf("Called %s on %s, no matches", - g_dsym_for_uuid_exe_path, uuid_str.c_str()); + LLDB_LOGF(log, "Called %s on %s, no matches", + g_dsym_for_uuid_exe_path, uuid_str.c_str()); else if (file_path[0] != '\0') - log->Printf("Called %s on %s, no matches", - g_dsym_for_uuid_exe_path, file_path); + LLDB_LOGF(log, "Called %s on %s, no matches", + g_dsym_for_uuid_exe_path, file_path); } } } diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index 172d2b3f01e..35510a25495 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -271,13 +271,13 @@ ObjectFile::ObjectFile(const lldb::ModuleSP &module_sp, if (data_sp) m_data.SetData(data_sp, data_offset, length); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); - if (log) - log->Printf("%p ObjectFile::ObjectFile() module = %p (%s), file = %s, " - "file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64, - static_cast<void *>(this), static_cast<void *>(module_sp.get()), - module_sp->GetSpecificationDescription().c_str(), - m_file ? m_file.GetPath().c_str() : "<NULL>", m_file_offset, - m_length); + LLDB_LOGF(log, + "%p ObjectFile::ObjectFile() module = %p (%s), file = %s, " + "file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64, + static_cast<void *>(this), static_cast<void *>(module_sp.get()), + module_sp->GetSpecificationDescription().c_str(), + m_file ? m_file.GetPath().c_str() : "<NULL>", m_file_offset, + m_length); } ObjectFile::ObjectFile(const lldb::ModuleSP &module_sp, @@ -290,18 +290,17 @@ ObjectFile::ObjectFile(const lldb::ModuleSP &module_sp, if (header_data_sp) m_data.SetData(header_data_sp, 0, header_data_sp->GetByteSize()); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); - if (log) - log->Printf("%p ObjectFile::ObjectFile() module = %p (%s), process = %p, " - "header_addr = 0x%" PRIx64, - static_cast<void *>(this), static_cast<void *>(module_sp.get()), - module_sp->GetSpecificationDescription().c_str(), - static_cast<void *>(process_sp.get()), m_memory_addr); + LLDB_LOGF(log, + "%p ObjectFile::ObjectFile() module = %p (%s), process = %p, " + "header_addr = 0x%" PRIx64, + static_cast<void *>(this), static_cast<void *>(module_sp.get()), + module_sp->GetSpecificationDescription().c_str(), + static_cast<void *>(process_sp.get()), m_memory_addr); } ObjectFile::~ObjectFile() { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); - if (log) - log->Printf("%p ObjectFile::~ObjectFile ()\n", static_cast<void *>(this)); + LLDB_LOGF(log, "%p ObjectFile::~ObjectFile ()\n", static_cast<void *>(this)); } bool ObjectFile::SetModulesArchitecture(const ArchSpec &new_arch) { @@ -595,10 +594,9 @@ void ObjectFile::ClearSymtab() { if (module_sp) { std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); - if (log) - log->Printf("%p ObjectFile::ClearSymtab () symtab = %p", - static_cast<void *>(this), - static_cast<void *>(m_symtab_up.get())); + LLDB_LOGF(log, "%p ObjectFile::ClearSymtab () symtab = %p", + static_cast<void *>(this), + static_cast<void *>(m_symtab_up.get())); m_symtab_up.reset(); } } diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp index 183330a7269..ccd74b7556f 100644 --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -494,7 +494,8 @@ bool SymbolContext::GetParentOfInlinedScope(const Address &curr_frame_pc, Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); if (log) { - log->Printf( + LLDB_LOGF( + log, "warning: inlined block 0x%8.8" PRIx64 " doesn't have a range that contains file address 0x%" PRIx64, curr_inlined_block->GetID(), curr_frame_pc.GetFileAddress()); diff --git a/lldb/source/Symbol/UnwindPlan.cpp b/lldb/source/Symbol/UnwindPlan.cpp index 774f9cb587e..6af85d699d6 100644 --- a/lldb/source/Symbol/UnwindPlan.cpp +++ b/lldb/source/Symbol/UnwindPlan.cpp @@ -402,10 +402,10 @@ const UnwindPlan::RowSP UnwindPlan::GetRowAtIndex(uint32_t idx) const { return m_row_list[idx]; else { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); - if (log) - log->Printf("error: UnwindPlan::GetRowAtIndex(idx = %u) invalid index " - "(number rows is %u)", - idx, (uint32_t)m_row_list.size()); + LLDB_LOGF(log, + "error: UnwindPlan::GetRowAtIndex(idx = %u) invalid index " + "(number rows is %u)", + idx, (uint32_t)m_row_list.size()); return UnwindPlan::RowSP(); } } @@ -413,8 +413,7 @@ const UnwindPlan::RowSP UnwindPlan::GetRowAtIndex(uint32_t idx) const { const UnwindPlan::RowSP UnwindPlan::GetLastRow() const { if (m_row_list.empty()) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); - if (log) - log->Printf("UnwindPlan::GetLastRow() when rows are empty"); + LLDB_LOGF(log, "UnwindPlan::GetLastRow() when rows are empty"); return UnwindPlan::RowSP(); } return m_row_list.back(); @@ -434,13 +433,14 @@ bool UnwindPlan::PlanValidAtAddress(Address addr) { if (log) { StreamString s; if (addr.Dump(&s, nullptr, Address::DumpStyleSectionNameOffset)) { - log->Printf("UnwindPlan is invalid -- no unwind rows for UnwindPlan " - "'%s' at address %s", - m_source_name.GetCString(), s.GetData()); + LLDB_LOGF(log, + "UnwindPlan is invalid -- no unwind rows for UnwindPlan " + "'%s' at address %s", + m_source_name.GetCString(), s.GetData()); } else { - log->Printf( - "UnwindPlan is invalid -- no unwind rows for UnwindPlan '%s'", - m_source_name.GetCString()); + LLDB_LOGF(log, + "UnwindPlan is invalid -- no unwind rows for UnwindPlan '%s'", + m_source_name.GetCString()); } } return false; @@ -456,13 +456,15 @@ bool UnwindPlan::PlanValidAtAddress(Address addr) { if (log) { StreamString s; if (addr.Dump(&s, nullptr, Address::DumpStyleSectionNameOffset)) { - log->Printf("UnwindPlan is invalid -- no CFA register defined in row 0 " - "for UnwindPlan '%s' at address %s", - m_source_name.GetCString(), s.GetData()); + LLDB_LOGF(log, + "UnwindPlan is invalid -- no CFA register defined in row 0 " + "for UnwindPlan '%s' at address %s", + m_source_name.GetCString(), s.GetData()); } else { - log->Printf("UnwindPlan is invalid -- no CFA register defined in row 0 " - "for UnwindPlan '%s'", - m_source_name.GetCString()); + LLDB_LOGF(log, + "UnwindPlan is invalid -- no CFA register defined in row 0 " + "for UnwindPlan '%s'", + m_source_name.GetCString()); } } return false; |