当前位置: 首页 > 工具软件 > ccls > 使用案例 >

ccls运行报错,clang assert错误

訾俊名
2023-12-01

When i use ccls as code complete server and complete an item with pointer, this crash happends. I’ve seen the similar problem in https://github.com/Andersbakken/rtags/issues/586 , but don’t know why this happens.

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `ccls --log-file=/tmp/ccls.log'.
Program terminated with signal 6, Aborted.
#0  0x00007fa6d21241f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56        return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
Missing separate debuginfos, use: debuginfo-install ncurses-libs-5.9-13.20130511.el7.x86_64 zlib-1.2.7-15.el7.x86_64
(gdb) bt
#0  0x00007fa6d21241f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007fa6d2125a28 in __GI_abort () at abort.c:119
#2  0x00007fa6d211d266 in __assert_fail_base (fmt=0x7fa6d226fe88 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x18c7d86 "FromClassification.isLValue()", 
    file=file@entry=0x18c4eed "/home/username/llvm-7.0.0.src/tools/clang/lib/Sema/SemaOverload.cpp", line=line@entry=5059, 
    function=function@entry=0x18c7da4 "clang::ImplicitConversionSequence TryObjectArgumentInitialization(clang::Sema &, clang::SourceLocation, clang::QualType, Expr::Classification, clang::CXXMethodDecl *, clang::CXXRecordDecl *)") at assert.c:92
#3  0x00007fa6d211d312 in __GI___assert_fail (assertion=0x18c7d86 "FromClassification.isLValue()", file=0x18c4eed "/home/username/llvm-7.0.0.src/tools/clang/lib/Sema/SemaOverload.cpp", line=5059, 
    function=0x18c7da4 "clang::ImplicitConversionSequence TryObjectArgumentInitialization(clang::Sema &, clang::SourceLocation, clang::QualType, Expr::Classification, clang::CXXMethodDecl *, clang::CXXRecordDecl *)") at assert.c:101
#4  0x0000000000dca0fe in TryObjectArgumentInitialization(clang::Sema&, clang::SourceLocation, clang::QualType, clang::Expr::Classification, clang::CXXMethodDecl*, clang::CXXRecordDecl*) ()
#5  0x0000000000dcecde in clang::Sema::AddMethodCandidate(clang::CXXMethodDecl*, clang::DeclAccessPair, clang::CXXRecordDecl*, clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, llvm::MutableArrayRef<clang::ImplicitConversionSequence>) ()
#6  0x0000000000dd1e43 in clang::Sema::AddFunctionCandidates(clang::UnresolvedSetImpl const&, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, clang::TemplateArgumentListInfo*, bool, bool, bool) ()
#7  0x00000000009c81d9 in clang::Sema::CodeCompleteCall(clang::Scope*, clang::Expr*, llvm::ArrayRef<clang::Expr*>) ()
#8  0x00000000007159b2 in clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) ()
#9  0x0000000000718296 in clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState, bool) ()
#10 0x0000000000713832 in clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) ()
#11 0x0000000000713779 in clang::Parser::ParseExpression(clang::Parser::TypeCastState) ()
#12 0x000000000075f5b3 in clang::Parser::ParseExprStatement() ()
#13 0x000000000075e094 in clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) ()
#14 0x000000000075db59 in clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*) ()
#15 0x0000000000765491 in clang::Parser::ParseCompoundStatementBody(bool) ()
#16 0x0000000000765da2 in clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) ()
#17 0x00000000006d0b16 in clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) ()
#18 0x00000000006ea1f6 in clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) ()
#19 0x00000000006cfd09 in clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) ()
#20 0x00000000006cf873 in clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) ()
#21 0x00000000006cdb0f in clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) ()
#22 0x00000000006ccf2b in clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) ()
#23 0x00000000006c8217 in clang::ParseAST(clang::Sema&, bool, bool) ()
#24 0x000000000063e0c5 in clang::FrontendAction::Execute() ()
#25 0x000000000048f4b0 in ccls::(anonymous namespace)::CompletionMain(void*) ()
#26 0x00007fa6d2c9ae25 in start_thread (arg=0x7fa6cbfff700) at pthread_create.c:308
#27 0x00007fa6d21e735d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

There is another similar issue crash_problem and i’ll try clang10.
找到类似的文章,是libclang中assert报错导致的服务重启。但是改用Release模式还是不行。
https://github.com/Andersbakken/rtags/issues/586

  1. 另外一个已知的BUG在 indexupdate中报错
0x00007f273bb441f7 in raise () from /lib64/libc.so.6
#1  0x00007f273bb45a28 in abort () from /lib64/libc.so.6
#2  0x00007f273bb3d266 in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007f273bb3d312 in __assert_fail () from /lib64/libc.so.6
#4  0x000000000060a204 in ccls::DB::applyIndexUpdate(ccls::IndexUpdate*)::$_1::operator()(std::__1::unordered_map<int, int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, int> > >&, unsigned long, ccls::Kind, ccls::DeclRef&, int) const (this=0x7ffdd7798f58, lid2fid=..., usr=16818923095785284134, kind=ccls::Type, dr=..., delta=-1)
    at /home/lenajin/rpmbuild/cclsmodify/src/query.cc:302
#5  0x00000000006071aa in ccls::DB::applyIndexUpdate (this=0x7ffdd779bac0, u=0x7ffdd779b660) at /home/lenajin/rpmbuild/cclsmodify/src/query.cc:383
#6  0x00000000005470ce in ccls::pipeline::main_OnIndexed (db=0x7ffdd779bac0, wfiles=0x7ffdd779c038, update=0x7ffdd779b660) at /home/lenajin/rpmbuild/cclsmodify/src/pipeline.cc:503
#7  0x0000000000549840 in ccls::pipeline::mainLoop () at /home/lenajin/rpmbuild/cclsmodify/src/pipeline.cc:688
#8  0x0000000000423dda in main (argc=2, argv=0x7ffdd779d6a8) at /home/lenajin/rpmbuild/cclsmodify/src/main.cc:164

https://github.com/MaskRay/ccls/issues/197

 类似资料: