Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356235

Summary: Indexer refresh and rebuild are not working properly with Symbols from C/C++ CDT Paths and Symbols
Product: [Tools] CDT Reporter: J Gagnon <jgagnon>
Component: cdt-coreAssignee: Project Inbox <cdt-core-inbox>
Status: NEW --- QA Contact: Jonah Graham <jonah>
Severity: normal    
Priority: P3 CC: cdtdoug, malaperle, remy.suen, yevshif
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
This exported symbols file would not import properly when rebuilding my workspace from scratch none

Description J Gagnon CLA 2011-08-30 13:41:39 EDT
The indexer is not processing C code properly: it is not building links correctly that it previously could build. 
This problem has developed in 3 stages: 
1) using Helios, the refresh and rebuild would not reliably update the symbol definitions for the indexer when changing build configurations. This became worse over time.
2) using Helios, the refresh and rebuild would not reliably recognize some defines across files even after deleting .metadata/ and re-importing the project. This became worse over time.
3) after upgrading to Indigo in hopes that the problems would be resolved I discovered that they had gone from frequent problems to constant problems. Deleting .metadata did not help.

Notes:
I am uncertain whether the symptoms progressively worsened or jumped in severity/reliability because I was not confronted with a need for the problematic areas frequently until shortly before I upgraded to Indigo. I am certain that they did work at least sometimes in the past because I had successfully used them before.
I am using the C/C++ CDT. 
The Helios to Indigo upgrade was done in-program (added the indigo link then used Help->check for updates).
I work in embedded systems so I don't have the luxury of using the preferred workflow for Eclipse. All of my projects are generated by importing "existing C/C++ code as a makefile project" and my workstation does not have the ability to build the system. The directory which it reads the code from has all of the build artifacts, however.
I have gone over my indexer settings several times: it is set to use the build configuration used in the project; auto-update and index after save are both selected; heuristic/index source not included/index unused headers are all selected; and indexing is enabled.

This problem has developed over the course of a few months. The Indexer is my primary reason for using Eclipse and without it working it is of no use to me. If this can't be resolved I will wish you well and find another IDE.


-- Configuration Details --
Product: Eclipse 1.4.0.20110609-1120 (org.eclipse.epp.package.cpp.product)
Installed Features:
 org.eclipse.platform 3.7.0.v20110530-9gF7UHNFFt4cwE-pkZDJ7oz-mj4OSEIlu9SEv0f
Comment 1 Remy Suen CLA 2011-08-30 13:46:15 EDT
This seems to be a problem with the C/C++ tooling. These bugs go to CDT, not the Platform.
Comment 2 J Gagnon CLA 2011-08-30 14:06:16 EDT
I have multiple build configurations that primarily differ by the values of several Symbols in the "Symbols and Paths" section. These symbols are used as global switches to include/exclude code blocks.
The indexer does not pick up the change of configuration so it does not index code it should index and does index code it shouldn't. 
I further investigated after my most recent delete and rebuild of .metadata by re-adding only one of the configurations and manually changing the values and auto-rebuilding. This also did not work. I then tried a manual forced rebuild and that did not work.
It is possible that the other issue is a symptom of this first issue since several of my include chains have dependancies upon the globally defined symbols.

Thanks for the recategorization Remy, this is my first bug add for Eclipse and I couldn't find "CDT" or "indexer" in the drop-downs.
Comment 3 J Gagnon CLA 2011-09-02 17:22:29 EDT
I have confirmed that the secondary issue is a result of the first issue.
In other words, the core problem is that the Symbol changes from Paths and Symbols are not being used by the indexer in neither refresh nor rebuild.
Comment 4 Markus Schorn CLA 2011-09-06 08:36:50 EDT
(In reply to comment #3)
> I have confirmed that the secondary issue is a result of the first issue.
> In other words, the core problem is that the Symbol changes from Paths and
> Symbols are not being used by the indexer in neither refresh nor rebuild.

Typically the indexer is bound to a single configuration. This can be configured via the indexer preferences and the indexer project properties.
Please check how your configuration looks like.
Comment 5 J Gagnon CLA 2011-09-08 14:20:59 EDT
(In reply to comment #4)
> (In reply to comment #3)
> > I have confirmed that the secondary issue is a result of the first issue.
> > In other words, the core problem is that the Symbol changes from Paths and
> > Symbols are not being used by the indexer in neither refresh nor rebuild.
> 
> Typically the indexer is bound to a single configuration. This can be
> configured via the indexer preferences and the indexer project properties.
> Please check how your configuration looks like.

Sorry for the slow reply, the email notifying me of your comment/query was filtered. I've ensured that won't happen next time.

As I mentioned in the description, I have verified the contents of the configuration. 

Originally I had a separate configuration for each different set of values. 

When I deleted the .metadata directory for the second time I only entered one configuration as an attempted workaround but it was not successful. Currently, it isn't even recognizing that ANY of the Symbols have been defined (ie failing an #ifdef check) nevermind any of the changes I make to them (ie failing an #if PLATFORM_C6455 == 1 check).
Comment 6 Marc-André Laperle CLA 2011-09-08 18:27:20 EDT
For problem 1) did you try this preference? In project properties, C/C++ General, Indexer, "Build configuration for the indexer" set it to "Use active build configuration".

Could you provide a sample project where this happens? I have never deleted my .metadata files and I use 3 configurations with very different symbols. The worse I had to do is Refresh then rebuild the index (by right-clicking on project, Index, Rebuild).
Comment 7 J Gagnon CLA 2011-09-08 18:51:34 EDT
I have tried both "Use active build configuration" and the other option, neither had any effect.
Also, this option should no longer be relevant now that I have only one configuration.

Unfortunately I can't provide a copy of the project (NDA) but since I have this problem even with a completely new workspace and project from the "import c/c++ as a makefile project" I am dubious that it would be useful.

I did notice that I was unable to import my configurations; I had exported them previously but when I tried to import them the dialog box closed without comment and nothing visible happened.
Comment 8 J Gagnon CLA 2011-09-13 17:43:45 EDT
Created attachment 203309 [details]
This exported symbols file would not import properly when rebuilding my workspace from scratch
Comment 9 J Gagnon CLA 2011-09-13 17:44:31 EDT
I erased the workspace and restarted again but this time I manually reentered the key symbols rather than trying to import them and suddenly the indexer is working again.

This strongly suggests that there was a problem with importing the exported symbols file so I have attached an NDA-safe version of the suspect exported symbols file that I mentioned in the previous comment.
Comment 10 Markus Schorn CLA 2011-09-16 07:16:33 EDT
(In reply to comment #9)
Importing the attached file works for me. Do you see any errors in the log (<workspace>/.metadata/.log)?