Description of problem: I get many exceptions like this with the autotools plugin (the index varies): java.lang.StringIndexOutOfBoundsException: String index out of range: -110 at java.lang.String.substring(String.java:1938) at com.redhat.eclipse.cdt.autotools.AutotoolsScannerInfo.getDefinedSymbols(AutotoolsScannerInfo.java:321) at org.eclipse.cdt.internal.core.pdom.indexer.PDOMIndexerTask.computeHashCode(PDOMIndexerTask.java:570) at org.eclipse.cdt.internal.core.pdom.indexer.PDOMIndexerTask.parseTU(PDOMIndexerTask.java:323) at org.eclipse.cdt.internal.core.pdom.indexer.PDOMIndexerTask.internalParseTUs(PDOMIndexerTask.java:219) at org.eclipse.cdt.internal.core.pdom.indexer.PDOMIndexerTask.parseTUs(PDOMIndexerTask.java:192) at org.eclipse.cdt.internal.core.pdom.indexer.fast.PDOMFastIndexerTask.run(PDOMFastIndexerTask.java:102) at org.eclipse.cdt.internal.core.pdom.indexer.PDOMUpdateTask.run(PDOMUpdateTask.java:73) at org.eclipse.cdt.internal.core.pdom.PDOMIndexerJob.run(PDOMIndexerJob.java:90) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Version-Release number of selected component (if applicable): Autotools 0.9.5 and CDT 4.0.1 and Eclipse 3.4M2. How reproducible: It happens with many projects in freedesktop.org, such as the glitz source. Steps to Reproduce: See the attached build log for the build commands. Additional notes: This bug renders the CDT indexer and code navigation features completely useless. I looked into the faulty line in the current CVS but didn't saw anything obvious.
Created attachment 220071 [details] build.log
Ok, I ran through the debugger and found out the problem. The shortest test case is: -DINDENTIFIER -fmessage-length=0 That is, you have an identifier without '=' but you have an '=' after the first space. That means that endIndex < eqSignIndex causing the x.substring(eqSignIndex+1, endIndex) expression to fail. The fix should not be too hard, but all that complex logic is prone to bugs and all those calls to IndexOf won't be much fast either, so IMHO sticking to just regular expressions on getDefinedSymbols would be the right fix here.
Created attachment 221011 [details] Patch that fixes the problem I attached a patch that implements the definition extraction with regular expressions. The regular expression is a bit ugly due to the double escaping for Java string literals, however it's much easier to grasp. Please apply.
Thanks Jose for catching this and for the patch. Patch has been applied to F7 and F8 (devel) and will appear in the next releases.