Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313562 - [indexer] NullPointerException kills indexer
Summary: [indexer] NullPointerException kills indexer
Status: CLOSED DUPLICATE of bug 292174
Alias: None
Product: CDT
Classification: Tools
Component: cdt-indexer (show other bugs)
Version: 7.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-19 12:00 EDT by Andrew Stubbs CLA
Modified: 2010-05-20 09:58 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Stubbs CLA 2010-05-19 12:00:03 EDT
Build Identifier: I20090611-1540

The indexer fails with NullPointerException, and never completes the index.

The file that causes it contains invalid C++ code (this is deliberate - it's a compiler testcase), but is really very simple:

// PR c++/34912

void foo()
{
  struct A
  {
    friend void bar();		// { dg-error "without prior declaration" }
  };
  bar();			// { dg-error "not declared" }
}


There's no error dialogue - the index process just appears to have completed, but the 'Error Log' shows:

Error: Error while parsing /scratch/ams/uclinux-fsf/workspace/test/friend12.C.


org.eclipse.core.runtime.CoreException: Error while parsing /scratch/ams/uclinux-fsf/workspace/test/friend12.C.
	at org.eclipse.cdt.internal.core.pdom.PDOMWriter.addSymbols(PDOMWriter.java:179)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.writeToIndex(AbstractIndexerTask.java:719)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.parseFile(AbstractIndexerTask.java:677)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.parseLinkage(AbstractIndexerTask.java:563)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.runTask(AbstractIndexerTask.java:314)
	at org.eclipse.cdt.internal.core.pdom.indexer.PDOMIndexerTask.run(PDOMIndexerTask.java:122)
	at org.eclipse.cdt.internal.core.pdom.indexer.PDOMRebuildTask.run(PDOMRebuildTask.java:84)
	at org.eclipse.cdt.internal.core.pdom.PDOMIndexerJob.run(PDOMIndexerJob.java:137)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.NullPointerException
	at org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPLinkage.onCreateName(PDOMCPPLinkage.java:919)
	at org.eclipse.cdt.internal.core.pdom.dom.PDOMFile.createPDOMName(PDOMFile.java:309)
	at org.eclipse.cdt.internal.core.pdom.dom.PDOMFile.addNames(PDOMFile.java:273)
	at org.eclipse.cdt.internal.core.pdom.WritablePDOM.addFileContent(WritablePDOM.java:67)
	at org.eclipse.cdt.internal.core.index.WritableCIndex.setFileContent(WritableCIndex.java:75)
	at org.eclipse.cdt.internal.core.pdom.PDOMWriter.storeFileInIndex(PDOMWriter.java:477)
	at org.eclipse.cdt.internal.core.pdom.PDOMWriter.storeSymbolsInIndex(PDOMWriter.java:206)
	at org.eclipse.cdt.internal.core.pdom.PDOMWriter.addSymbols(PDOMWriter.java:162)
	... 8 more

Session data:

eclipse.buildId=unknown
java.version=1.5.0_09
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Framework arguments:  -product com.codesourcery.ide.ide -Xmx256m
Command-line arguments:  -os linux -ws gtk -arch x86 -product com.codesourcery.ide.ide -clean -Xmx256m


Reproducible: Always

Steps to Reproduce:
1. Create a new C project. C++ probably works too, but my project was primarily C.

2. Add a file friend12.C:

------8<-------------->8-------
// PR c++/34912

void foo()
{
  struct A
  {
    friend void bar();		// { dg-error "without prior declaration" }
  };
  bar();			// { dg-error "not declared" }
}
------8<-------------->8-------

3. Rebuild the index.

4. Check the 'Error Log' view.
Comment 1 Markus Schorn CLA 2010-05-20 04:24:36 EDT
When running into this issue, the indexer does not stop, it simply skips the current file.

*** This bug has been marked as a duplicate of bug 292174 ***
Comment 2 Andrew Stubbs CLA 2010-05-20 04:45:48 EDT
(In reply to comment #1)
> When running into this issue, the indexer does not stop, it simply skips the
> current file.

Ok, well, in that case try indexing the entire GCC source tree from current SVN and see if it completes the index. With the build I specified, at least, it bombs out with only half the sources indexed.

If I exclude the gcc/testsuite directory from the build, it indexes everything else fine, and it no longer tells me that it can't find the symbols I search for.
Comment 3 Markus Schorn CLA 2010-05-20 09:58:13 EDT
(In reply to comment #2)
> Ok, well, in that case try indexing the entire GCC source tree from current SVN
> and see if it completes the index. With the build I specified, at least, it
> bombs out with only half the sources indexed.
> 
> If I exclude the gcc/testsuite directory from the build, it indexes everything
> else fine, and it no longer tells me that it can't find the symbols I search
> for.

Hmm, there is a limit of 500 errors after which the indexer would stop. In that case you should have many more errors in the log, the last of which would say that the indexer is giving up on the project.

--> There may be another issue that stops the indexer. It'd be interesting to look at the end of the log after the indexer has stopped.