Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Indexer get 0 results

Hello again,

I am investigating further and getting more specific questions.
Please help.

During project creation from my Wizard I copy customized language.settings.xml inside the project, this settings is overridden now by following changes:

IndexerPreferences.setScope(fNewProject, IndexerPreferences.SCOPE_PROJECT_SHARED);

ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();

ICProjectDescription prefsprjDescMgr.getProjectDescription(fNewProject, true);

prefs.setConfigurationRelations(ICProjectDescriptionPreferences.CONFIGS_INDEPENDENT);

prjDescMgr.setProjectDescription(fNewProject, prefs);

CCoreInternals.savePreferences(fNewProject, true); 



How can I append also my custom language settings to this ICProjectDescription 


Thank you in advance
Kind Regards
Lidia


On Mon, Oct 8, 2018 at 5:41 PM Lidia Popescu <lidochca@xxxxxxxxx> wrote:
Hello again,

I found how programmatically to 

- to check “Store settings with project’ and to create org.eclipse.cdt.core.prefs file

- to select Use a fixed build configuration


IndexerPreferences.setScope(fNewProject, IndexerPreferences.SCOPE_PROJECT_SHARED);

ICProjectDescriptionManager prjDescMgr= CCorePlugin.getDefault().getProjectDescriptionManager();

ICProjectDescription prefs= prjDescMgr.getProjectDescription(fNewProject, true);

prefs.setConfigurationRelations(ICProjectDescriptionPreferences.CONFIGS_INDEPENDENT);

prjDescMgr.setProjectDescription(fNewProject, prefs);

CCoreInternals.savePreferences(fNewProject, true); 


I have following workflow, when project is created from my custom wizard a team shared index is copied. Seems that CDT indexer log is not printed when the indexer is updated.
Can we change it?
E.g. Based on the code, when PDOMRebuildTask run it adds flag to print the log , but when PDOMUpdateTask run, this flag is missing 
Can we add this flag in the code ? the class PDOMUpdateTask.createDelegate()

if (delegate instanceof PDOMIndexerTask) {

                  final PDOMIndexerTask task = (PDOMIndexerTask) delegate;

                  task.setUpdateFlags(fUpdateOptions);

                  task.setWriteInfoToLog(); 

}


I still have cases other cases when team shared index is not added and the cdt indexer log is still not printed.

Now, with all this changes I am trying to understand why my cdt indexer results are so poor, in comparison to previous version.

>>> PDOMUpdateTask createDelegate()

>>> AbstractIndexerTask.runTask()  indexFilesToRemove.size() 853

>>> AbstractIndexerTask.runTask()  filesForLinkage 374

>>> AbstractIndexerTask.runTask()  filesForLinkage 1

 

!ENTRY org.eclipse.cdt.core 1 0 2018-10-08 17:29:28.013

!MESSAGE Indexed 'MyProject' (0 sources, 375 headers) in 4.01 sec: 912 declarations; 1,205 references; 114 unresolved inclusions; 1 syntax errors; 820 unresolved names (28%)


C/C++ Indexer: Project 'MyProject' (0 sources, 375 headers)

    Options: indexer='PDOMFastIndexer', parseAllFiles=false, unusedHeaders=skip, skipReferences=false, skipImplicitReferences=true, skipTypeReferences=false, skipMacroReferences=false.

    Database: 283062272 bytes

    Timings: 4017 total, 1164 parser, 254 resolution, 594 index update.

    Errors: 0 internal, 114 include, 0 scanner, 1 syntax errors.

    Names: 912 declarations, 1205 references, 820(27.92%) unresolved.

    Cache[128MB]: 3390733 hits, 1848(0.05%) misses.

    

Thank you
Kind Regards
Lidia

















On Mon, Oct 8, 2018 at 2:20 PM Lidia Popescu <lidochca@xxxxxxxxx> wrote:
Hi Nathan, Marc-Andre,all,

Thanks a lot for your suggestions, 
I am using CDT 9.2.1.

I have a custom wizard for project creation and using some api to create CDT properties for the project.
When project is created I have selected "use active build configuration" in cdt properties and indexer seems to get 0 results, indeed.
When I reimport the project, it changes into "Use a fixed build configuration", and indexer is better.

How to set from the beginning" Use a fixed build configuration  " ?
How to programmatically select "Store settings with project?"
I found to use 

IndexerPreferences.setScope(project, IndexerPreferences.SCOPE_PROJECT_SHARED); 

but it is API restricted, it make possible to check the option, but the file org.eclipse.cdt.core.prefs is not created.

Some samples of logs from cdt + my logs, I will try to provide more concrete details later:
I restarted eclipse, indexer kicked off for existing project with some good results. Then I think I changed nothing in CDT properties, just press ok, and indexer restarted and provided zero results immediately:
Usually I can reproduce it if I change anything from cdt indexer properties.

Indexer: Imported shared index for project MyProject

INDEXER START

>>> AbstractIndexerTask.indexFilesToRemove.size() 33  

>>> filesForLinkage 1746

>>> filesForLinkage 630

>>> fTaskCompleted fUrgentTasks.isEmpty()

PDOMIndexerTask fWriteInfoToLog= false

PDOMIndexerTask index= org.eclipse.cdt.internal.core.index.WritableCIndex@725e6aee

C/C++ Indexer: Project 'MyProject' (1995 sources, 4662 headers)

    Options: indexer='PDOMFastIndexer', parseAllFiles=false, unusedHeaders=skip, skipReferences=false, skipImplicitReferences=true, skipTypeReferences=false, skipMacroReferences=false.

    Database: 298389504 bytes

    Timings: 267909 total, 139177 parser, 60847 resolution, 53262 index update.

    Errors: 0 internal, 9608 include, 3 scanner, 3167 syntax errors.

    Names: 498168 declarations, 4447382 references, 543736(9.91%) unresolved.

    Cache[128MB]: 928305724 hits, 71160(0.01%) misses.

INDEXER END => Seconds 268.0

INDEXER START

>>> indexFilesToRemove.size() 0

>>> fTaskCompleted fUrgentTasks.isEmpty()

PDOMIndexerTask fWriteInfoToLog= false

PDOMIndexerTask index= org.eclipse.cdt.internal.core.index.WritableCIndex@4cc132cb

C/C++ Indexer: Project 'MyProject' (0 sources, 0 headers)

    Options: indexer='PDOMFastIndexer', parseAllFiles=false, unusedHeaders=skip, skipReferences=false, skipImplicitReferences=true, skipTypeReferences=false, skipMacroReferences=false.

    Database: 298389504 bytes

    Timings: 36 total, 0 parser, 0 resolution, 0 index update.

    Errors: 0 internal, 0 include, 0 scanner, 0 syntax errors.

    Names: 0 declarations, 0 references, 0(0.00%) unresolved.

    Cache[128MB]: 204 hits, 0(0.00%) misses.

INDEXER END => Milliseconds 37; Seconds 0.0


Thank you
Kind Regards
Lidia

On Sat, Oct 6, 2018 at 8:03 AM Marc-Andre Laperle <malaperle@xxxxxxxxx> wrote:


On Oct 5, 2018, at 7:22 AM, Lidia Popescu <lidochca@xxxxxxxxx> wrote:

Hello cdt developers, 

I am debugging cdt code and trying to understand how indexing works as I am having different issues with it.

1. Why cdt indexer returns sometimes 0 results?
e.g. Project is created indexer is kicked off, getting good results,  going to project preferences, change a configuration and getting new indexer log with 0 results:

What do you mean exactly by changing a configuration? Can you give an example? Or do you mean changing the active configuration (Debug, Release, etc)?


2. Why sometimes indexer results are not printed in .log/"Error logs". I have to add extra option (org.eclipse.cdt.core/debug/indexer=true) to be able to see indexer report in debug.
C/C++ Indexer: Project 'MyProject' (0 sources, 0 headers)
    Options: indexer='PDOMFastIndexer', parseAllFiles=false, unusedHeaders=skip, skipReferences=false, skipImplicitReferences=true, skipTypeReferences=false, skipMacroReferences=false.
    Database: 8192 bytes
    Timings: 2214 total, 0 parser, 0 resolution, 0 index update.
    Errors: 0 internal, 0 include, 0 scanner, 0 syntax errors.
    Names: 0 declarations, 0 references, 0(0.00%) unresolved.
    Cache[128MB]: 52 hits, 0(0.00%) misses.

3. Also, other issue I have is when indexer is not kicked off at all in some cases.

Which version of CDT are you using? I remember fixing a race when changing the active configuration. I might have broken something. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=375226
If you are using a version >= 8.1.0, I would try reverting that to see if it changes anything. This is just a first guess, we would still need to figure out the details.

Marc-André
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev

Back to the top