r260760 - [libclang] Separate the underlying indexing functionality of libclang and introduce it into the clangIndex library.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 29 17:43:24 PST 2016


> How are you configuring

cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_ASSERTIONS=On
-DLLVM_ENABLE_SPHINX=true -DSPHINX_OUTPUT_MAN=true ../llvm

>  and what compiler and version are you using ?

$ clang --version
Ubuntu clang version 3.5.0-4ubuntu2~trusty2 (tags/RELEASE_350/final)
(based on LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

I do not see the stack overflow or segfault in debug builds.  I do see
it regardless of whether or not I enable assertions.  I also do not
see the stack overflow in a release build if I reduce the amount of
nesting in the test to about 2/3 of its present value.

On Mon, Feb 29, 2016 at 5:38 PM, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
> I don’t quite understand how it gets that stack trace, dataTraverseNode() was introduced to avoid exactly this.
> How are you configuring and what compiler and version are you using ?
>
>> On Feb 29, 2016, at 3:14 PM, Justin Lebar <jlebar at google.com> wrote:
>>
>>> Is this still an issue after r260785 ?
>>
>> I just sync'ed to r262268 and was able to reproduce the segfault.
>>
>>> Could you provide a stack trace ?
>>
>> $ gdb --args release/bin/c-index-test -index-file
>> /usr/local/google/home/jlebar/code/llvm/src/tools/clang/test/Index/index-many-call-ops.cpp
>> (gdb) run
>> Program received signal SIGSEGV, Segmentation fault.
>> [Switching to Thread 0x7ffff2ca2700 (LWP 3936)]
>> 0x00007ffff4f264be in
>> clang::DeclarationName::print(llvm::raw_ostream&,
>> clang::PrintingPolicy const&) ()
>>   from /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> (gdb) bt
>> #0  0x00007ffff4f264be in
>> clang::DeclarationName::print(llvm::raw_ostream&,
>> clang::PrintingPolicy const&) ()
>>   from /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #1  0x00007ffff4f26c9e in clang::operator<<(llvm::raw_ostream&,
>> clang::DeclarationName) ()
>>   from /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #2  0x00007ffff4ebcb91 in
>> clang::cxindex::CXIndexDataConsumer::getEntityInfo(clang::NamedDecl
>> const*, clang::cxindex::EntityInfo&, clang::cxindex::ScratchAlloc&) ()
>> from /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #3  0x00007ffff4ebc206 in
>> clang::cxindex::CXIndexDataConsumer::handleReference(clang::NamedDecl
>> const*, clang::SourceLocation, CXCursor, clang::NamedDecl const*,
>> clang::DeclContext const*, clang::Expr const*, CXIdxEntityRefKind) ()
>>   from /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #4  0x00007ffff4ebbae2 in
>> clang::cxindex::CXIndexDataConsumer::handleDeclOccurence(clang::Decl
>> const*, unsigned int, llvm::ArrayRef<clang::index::SymbolRelation>,
>> clang::FileID, unsigned int,
>> clang::index::IndexDataConsumer::ASTNodeInfo) ()
>>   from /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #5  0x00007ffff51a05c5 in
>> clang::index::IndexingContext::handleDeclOccurrence(clang::Decl
>> const*, clang::SourceLocation, bool, clang::Decl const*, unsigned int,
>> llvm::ArrayRef<clang::index::SymbolRelation>, clang::Expr const*,
>> clang::Decl const*, clang::DeclContext const*) ()
>>   from /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #6  0x00007ffff51a092a in
>> clang::index::IndexingContext::handleReference(clang::NamedDecl
>> const*, clang::SourceLocation, clang::NamedDecl const*,
>> clang::DeclContext const*, unsigned int,
>> llvm::ArrayRef<clang::index::SymbolRelation>, clang::Expr const*,
>> clang::Decl const*) ()
>>   from /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #7  0x00007ffff51a9256 in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::dataTraverseNode(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #8  0x00007ffff51a60dd in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::TraverseStmt(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #9  0x00007ffff51a880e in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::dataTraverseNode(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #10 0x00007ffff51a60dd in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::TraverseStmt(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #11 0x00007ffff51a880e in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::dataTraverseNode(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #12 0x00007ffff51a60dd in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::TraverseStmt(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #13 0x00007ffff51a880e in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::dataTraverseNode(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #14 0x00007ffff51a60dd in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::TraverseStmt(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #15 0x00007ffff51a880e in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::dataTraverseNode(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #16 0x00007ffff51a60dd in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::TraverseStmt(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #17 0x00007ffff51a880e in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::dataTraverseNode(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #18 0x00007ffff51a60dd in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::TraverseStmt(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #19 0x00007ffff51a880e in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::dataTraverseNode(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #20 0x00007ffff51a60dd in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::TraverseStmt(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #21 0x00007ffff51a880e in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::dataTraverseNode(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> #22 0x00007ffff51a60dd in clang::RecursiveASTVisitor<(anonymous
>> namespace)::BodyIndexer>::TraverseStmt(clang::Stmt*,
>> llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
>> llvm::PointerLikeTypeTraits<clang::Stmt*>,
>> llvm::PointerIntPairInfo<clang::Stmt*, 1u,
>> llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) () from
>> /usr/local/google/home/jlebar/code/llvm-complete/release/bin/../lib/libclang.so.3.9
>> ---Type <return> to continue, or q <return> to quit---
>>
>> On Mon, Feb 29, 2016 at 3:03 PM, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
>>> Is this still an issue after r260785 ?
>>> Could you provide a stack trace ?
>>>
>>>> On Feb 29, 2016, at 2:27 PM, Justin Lebar <jlebar at google.com> wrote:
>>>>
>>>> Hi, I think this broke clang/test/Index/index-many-call-ops.cpp.  I
>>>> get a segfault due to recursive stack overflow in release builds on my
>>>> linux x86-64 box when running that test -- it seems the purpose of
>>>> that test is to check that we *don't* segfault.
>>>>
>>>> This has been broken for a while, and people don't seem to be
>>>> complaining -- I'm not sure if there's something specific about my
>>>> config or if I'm just the first person to bother bisecting this...
>>>> Maybe the test just needs to be pared down some?
>>>>
>>>> Please advise.
>>>>
>>>> Regards,
>>>> -Justin
>>>>
>>>> On Sat, Feb 13, 2016 at 12:47 PM, Argyrios Kyrtzidis via cfe-commits
>>>> <cfe-commits at lists.llvm.org> wrote:
>>>>> I guess refreshing the build directory fixed the bots now.
>>>>> You may want to look into ccache as possibly the issue here.
>>>>>
>>>>>> On Feb 13, 2016, at 12:08 PM, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
>>>>>>
>>>>>> clangIndex library is not part of that command so I don’t understand how my changes affect linking the clang binary, clangIndex is only used for libclang.
>>>>>>
>>>>>>> On Feb 13, 2016, at 11:55 AM, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
>>>>>>>
>>>>>>> Sorry, I looked at it but it wasn’t clear to me what the problem is:
>>>>>>>
>>>>>>> FAILED: : <lond command>
>>>>>>> /home/linaro/buildbot/clang-cmake-armv7-a15/stage1/tools/clang/clang.order: file not recognized: File truncated
>>>>>>>
>>>>>>> I thought it was some build SNAFU, do you have some hint on what I need to do to fix this ?
>>>>>>>
>>>>>>>> On Feb 13, 2016, at 7:48 AM, Renato Golin <renato.golin at linaro.org> wrote:
>>>>>>>>
>>>>>>>> On 12 February 2016 at 23:11, Argyrios Kyrtzidis via cfe-commits
>>>>>>>> <cfe-commits at lists.llvm.org> wrote:
>>>>>>>>> Author: akirtzidis
>>>>>>>>> Date: Fri Feb 12 17:10:59 2016
>>>>>>>>> New Revision: 260760
>>>>>>>>>
>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=260760&view=rev
>>>>>>>>> Log:
>>>>>>>>> [libclang] Separate the underlying indexing functionality of libclang and introduce it into the clangIndex library.
>>>>>>>>>
>>>>>>>>> It is a general goodness for libclang itself to mostly be a wrapper of functionality provided by the libraries.
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> This broke both ARM builds:
>>>>>>>>
>>>>>>>> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/9853
>>>>>>>>
>>>>>>>> http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/9806
>>>>>>>>
>>>>>>>> And it's still broken. I'm going to refresh the build directory, but
>>>>>>>> please keep an eye or revert if that doesn't work.
>>>>>>>>
>>>>>>>> cheers,
>>>>>>>> --renato
>>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> cfe-commits mailing list
>>>>> cfe-commits at lists.llvm.org
>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>


More information about the cfe-commits mailing list