[Lldb-commits] [clang] [lldb] [Serialization] Support loading template specializations lazily (PR #119333)

Michael Jabbour via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 24 07:47:51 PDT 2025


michael-jabbour-sonarsource wrote:

Hello,

We have encountered crashes after this patch, with stack traces that look like this:

```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
  ...
 #0 0x0000740f12c266f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) 
 #1 0x0000740f12c23de5 llvm::sys::RunSignalHandlers()
 #2 0x0000740f12c274b1 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x0000740f12242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000740f10a04134 clang::Redeclarable<clang::TagDecl>::DeclLink::getPrevious(clang::TagDecl const*) const APValue.cpp:0:0
 #5 0x0000740f10a99531 clang::CXXRecordDecl::getMostRecentNonInjectedDecl() ASTDumper.cpp:0:0
 #6 0x0000740f10d71be7 clang::RecursiveASTVisitor<clang::ParentMapContext::ParentMap::ASTVisitor>::TraverseTemplateInstantiations(clang::ClassTemplateDecl*)
 #7 0x0000740f10d4cb37 clang::RecursiveASTVisitor<clang::ParentMapContext::ParentMap::ASTVisitor>::TraverseClassTemplateDecl(clang::ClassTemplateDecl*)
 #8 0x0000740f10d46926 clang::RecursiveASTVisitor<clang::ParentMapContext::ParentMap::ASTVisitor>::TraverseDecl(clang::Decl*)
 #9 0x0000740f10d6ac21 clang::RecursiveASTVisitor<clang::ParentMapContext::ParentMap::ASTVisitor>::TraverseDeclContextHelper(clang::DeclContext*)
#10 0x0000740f10d4d0c4 clang::RecursiveASTVisitor<clang::ParentMapContext::ParentMap::ASTVisitor>::TraverseNamespaceDecl(clang::NamespaceDecl*)
#11 0x0000740f10d46b9c clang::RecursiveASTVisitor<clang::ParentMapContext::ParentMap::ASTVisitor>::TraverseDecl(clang::Decl*)
#12 0x0000740f10d6ac21 clang::RecursiveASTVisitor<clang::ParentMapContext::ParentMap::ASTVisitor>::TraverseDeclContextHelper(clang::DeclContext*)
#13 0x0000740f10d46f87 clang::RecursiveASTVisitor<clang::ParentMapContext::ParentMap::ASTVisitor>::TraverseTranslationUnitDecl(clang::TranslationUnitDecl*)
#14 0x0000740f10d468a0 clang::RecursiveASTVisitor<clang::ParentMapContext::ParentMap::ASTVisitor>::TraverseDecl(clang::Decl*)
#15 0x0000740f10d45d38 clang::ParentMapContext::ParentMap::ASTVisitor::TraverseDecl(clang::Decl*) ParentMapContext.cpp:0:0
#16 0x0000740f10d42801 clang::ParentMapContext::ParentMap::ParentMap(clang::ASTContext&)
#17 0x0000740f10d42876 clang::ParentMapContext::getParents(clang::DynTypedNode const&)
#18 0x0000740f1750739b (anonymous namespace)::ScalarExprEmitter::EmitScalarPrePostIncDec(clang::UnaryOperator const*, clang::CodeGen::LValue, bool, bool) CGExprScalar.cpp:0:0
#19 0x0000740f175132be (anonymous namespace)::ScalarExprEmitter::VisitUnaryPostDec(clang::UnaryOperator const*) CGExprScalar.cpp:0:0
#20 0x0000740f175051eb (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#21 0x0000740f17521bdd (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) CGExprScalar.cpp:0:0
#22 0x0000740f175050dd clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
#23 0x0000740f1748fe28 clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(clang::Expr const*)
#24 0x0000740f176722d3 clang::CodeGen::CodeGenFunction::EmitWhileStmt(clang::WhileStmt const&, llvm::ArrayRef<clang::Attr const*>)
#25 0x0000740f17670edf clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>)
#26 0x0000740f1767ed60 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot)
#27 0x0000740f176f765e clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) 
#28 0x0000740f17721d6e clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*)
#29 0x0000740f1771950e clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) 
#30 0x0000740f1771e832 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) 
#31 0x0000740f17718011 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) 
#32 0x0000740f177eb7bc (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#33 0x0000740f176e2726 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) 
#34 0x0000740f11af6f8a clang::ParseAST(clang::Sema&, bool, bool) 
#35 0x0000740f155ee356 clang::FrontendAction::Execute() 
#36 0x0000740f1555060d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) 
#37 0x0000740f18a75ae7 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) 
#38 0x000063e90df5329f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) 
#39 0x000063e90df4f62d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#40 0x000063e90df4e669 clang_main(int, char**, llvm::ToolContext const&) 
#41 0x000063e90df601a7 main 
#42 0x0000740f12229d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#43 0x0000740f12229e40 call_init ./csu/../csu/libc-start.c:128:20
#44 0x0000740f12229e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#45 0x000063e90df4d0c5 _start 
```
I have created a fix and a test case in #150430. Any feedback is appreciated.

https://github.com/llvm/llvm-project/pull/119333


More information about the lldb-commits mailing list