Bug 538264 - CDT Indexer hangs with llvm+clang sources
Summary: CDT Indexer hangs with llvm+clang sources
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 9.5.2   Edit
Hardware: PC Linux
: P3 blocker (vote)
Target Milestone: ---   Edit
Assignee: CDT Codan Inbox CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 514035
  Show dependency tree
 
Reported: 2018-08-24 21:24 EDT by Open Address CLA
Modified: 2018-09-14 03:34 EDT (History)
4 users (show)

See Also:


Attachments
jstack when indexer hangs (20.84 KB, text/x-log)
2018-08-24 21:24 EDT, Open Address CLA
no flags Details
Another jstack snapshot (20.33 KB, text/x-log)
2018-08-24 21:35 EDT, Open Address CLA
no flags Details
.project (1.42 MB, application/octet-stream)
2018-09-14 02:33 EDT, Open Address CLA
no flags Details
.cproject (1.42 MB, application/octet-stream)
2018-09-14 02:33 EDT, Open Address CLA
no flags Details
.project (1.49 MB, application/octet-stream)
2018-09-14 02:40 EDT, Open Address CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Open Address CLA 2018-08-24 21:24:11 EDT
Created attachment 275533 [details]
jstack when indexer hangs

I am using Eclipse - Photon, CDT 9.5.2.201807181141.

Trying to index llvm+clang sources using Eclipse project generated by cmake. "Enabled Project specific settings" of project indexer.

Indexer gets stuck on https://github.com/llvm-mirror/clang/blob/master/test/Modules/merge-template-specializations.cpp which is cloned as <llvm-repo>/tools/clang/test/Modules/merge-template-specializations.cpp.

Letting it run overnight bricks the machine.

Attached jstack trace when indexer is hung.
Comment 1 Open Address CLA 2018-08-24 21:35:29 EDT
Created attachment 275534 [details]
Another jstack snapshot

Appears to be looping in the method org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExecDeclarator.createDefaultInitializedCompositeValue(ExecDeclarato
r.java:137.
Comment 2 Nathan Ridge CLA 2018-08-24 21:50:50 EDT
Thanks for the report. Please see bug 514035 comment 0.
Comment 3 Open Address CLA 2018-09-09 14:04:59 EDT
I created a resource filter to "Exclude All" "Name matches tools/clang/test" with an expectation that all the subdirectories would be excluded from build and hence from the indexer.

However, the indexer still gets stuck at the above referenced file.

I enabled "C/C++ General -> Code Analysis -> Indexer -> Enable project specific settings".

Can someone please let me know what else I need to do get the indexer to completely ignore the directory tools/clang/test?

Thanks!
Comment 4 Marc-André Laperle CLA 2018-09-09 14:25:20 EDT
(In reply to Open Address from comment #3)
> I created a resource filter to "Exclude All" "Name matches tools/clang/test"
> with an expectation that all the subdirectories would be excluded from build
> and hence from the indexer.
> 
> However, the indexer still gets stuck at the above referenced file.
> 
> I enabled "C/C++ General -> Code Analysis -> Indexer -> Enable project
> specific settings".
> 
> Can someone please let me know what else I need to do get the indexer to
> completely ignore the directory tools/clang/test?
> 
> Thanks!

I don't know if resource filters work for this but normally I do it like this:
- Right-click on the test folder in Project Explorer > Resource Configurations > Exclude from Build. Select the configuration, OK.
- Right-click on the project > Properties > C/C++ General > Indexer. Tick "Enable Project specific settings". Untick "Index source files not included in build" and you might want at the same time to untick "Index unused headers..." (You can also set all this in the global preferences instead).

Another tip is to exclude all but one target in llvm/lib/Target, I only keep X86.

Hope this helps!
Comment 5 Open Address CLA 2018-09-10 08:56:05 EDT
Thanks for the suggestion.

However, I see that the options "Exclude from Build..." and "Reset to Default..." in Project Explorer > Resource Configurations are greyed out.
Comment 6 Open Address CLA 2018-09-13 14:09:35 EDT
Looks like I have reached a dead-end :-(

No matter what I try, I am unable to exclude the indexer from parsing the files in tools/clang/test directory.

Would really appreciate if any kind soul can nudge me in the right direction and getting hung while parsing the above referenced file.

Thanks in advance.
Comment 7 Nathan Ridge CLA 2018-09-13 19:30:01 EDT
I'm afraid I don't have any insights to offer beyond noting that the approach described by Marc-André in comment 4 is what I typically do as well, and I haven't come across a situation where the option was greyed out.
Comment 8 Marc-André Laperle CLA 2018-09-13 19:38:38 EDT
Maybe you created the project the new "core build" type which I don't know about. Maybe Doug could comment if/how exclusion work? How did you create the project? Could you attach your .project and .cproject?
Comment 9 Open Address CLA 2018-09-14 02:31:08 EDT
(In reply to Marc-André Laperle from comment #8)
> Maybe you created the project the new "core build" type which I don't know
> about. Maybe Doug could comment if/how exclusion work? How did you create
> the project? Could you attach your .project and .cproject?

I created the Eclipse config of unmodified llvm+clang repo using the following cmake command:

cmake -G "Eclipse CDT4 - Ninja" -DCMAKE_INSTALL_PREFIX=/home/username/github/install/llvm -DCMAKE_ECLIPSE_VERSION=4.8 /home/username/github/src/llvm.

Please find .project and .cproject attached.

Thanks for your responses and willingness to help.
Comment 10 Open Address CLA 2018-09-14 02:33:12 EDT
Created attachment 275809 [details]
.project
Comment 11 Open Address CLA 2018-09-14 02:33:39 EDT
Created attachment 275810 [details]
.cproject
Comment 12 Open Address CLA 2018-09-14 02:39:41 EDT
Comment on attachment 275809 [details]
.project

Ignore this.
Comment 13 Open Address CLA 2018-09-14 02:40:15 EDT
Created attachment 275811 [details]
.project
Comment 14 Nathan Ridge CLA 2018-09-14 02:58:51 EDT
(In reply to Open Address from comment #9)
> cmake -G "Eclipse CDT4 - Ninja"

I think that's your problem. The project files generated by CMake's CDT project generator are no longer compatible with recent CDT versions (see e.g. [1]).

Users have reported success using the cmake4eclipse plugin instead, perhaps you could try that.

[1] https://dev.eclipse.org/mhonarc/lists/cdt-dev/msg33110.html
Comment 15 Open Address CLA 2018-09-14 03:34:28 EDT
(In reply to Nathan Ridge from comment #14)
> (In reply to Open Address from comment #9)
> > cmake -G "Eclipse CDT4 - Ninja"
> 
> I think that's your problem. The project files generated by CMake's CDT
> project generator are no longer compatible with recent CDT versions (see
> e.g. [1]).
> 
> Users have reported success using the cmake4eclipse plugin instead, perhaps
> you could try that.
> 
> [1] https://dev.eclipse.org/mhonarc/lists/cdt-dev/msg33110.html

Oh, I see. Did not know that.

Will look at cmake4eclipse.

Thank you very much!