1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Let indexer handle StackOverflowErrors (caught and logged like RuntimeExceptions).

This commit is contained in:
Markus Schorn 2008-05-16 17:10:36 +00:00
parent 213739b2dc
commit a3566fff4f
2 changed files with 28 additions and 19 deletions

View file

@ -585,6 +585,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
return; return;
} }
Throwable th= null;
try { try {
if (fShowActivity) { if (fShowActivity) {
System.out.println("Indexer: parsing " + path.toOSString()); //$NON-NLS-1$ System.out.println("Indexer: parsing " + path.toOSString()); //$NON-NLS-1$
@ -597,15 +598,17 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
if (ast != null) { if (ast != null) {
writeToIndex(linkageID, ast, computeHashCode(scanInfo), pm); writeToIndex(linkageID, ast, computeHashCode(scanInfo), pm);
} }
} catch (CoreException e) {
th= e;
} catch (RuntimeException e) {
th= e;
} catch (PDOMNotImplementedError e) {
th= e;
} catch (StackOverflowError e) {
th= e;
} }
catch (CoreException e) { if (th != null) {
swallowError(path, e); swallowError(path, th);
}
catch (RuntimeException e) {
swallowError(path, e);
}
catch (PDOMNotImplementedError e) {
swallowError(path, e);
} }
} }

View file

@ -192,14 +192,19 @@ abstract public class PDOMWriter {
if (fShowActivity) { if (fShowActivity) {
System.out.println("Indexer: adding " + ifl.getURI()); //$NON-NLS-1$ System.out.println("Indexer: adding " + ifl.getURI()); //$NON-NLS-1$
} }
Throwable th= null;
try { try {
storeFileInIndex(index, ifl, symbolMap, linkageID, configHash, contextIncludes); storeFileInIndex(index, ifl, symbolMap, linkageID, configHash, contextIncludes);
} catch (RuntimeException e) { } catch (RuntimeException e) {
stati.add(CCorePlugin.createStatus( th= e;
NLS.bind(Messages.PDOMWriter_errorWhileParsing, ifl.getURI().getPath()), e));
} catch (PDOMNotImplementedError e) { } catch (PDOMNotImplementedError e) {
th= e;
} catch (StackOverflowError e) {
th= e;
}
if (th != null) {
stati.add(CCorePlugin.createStatus( stati.add(CCorePlugin.createStatus(
NLS.bind(Messages.PDOMWriter_errorWhileParsing, ifl.getURI().getPath()), e)); NLS.bind(Messages.PDOMWriter_errorWhileParsing, ifl.getURI().getPath()), th));
} }
if (i<ifls.length-1) { if (i<ifls.length-1) {
updateFileCount(0, 0, 1); // update header count updateFileCount(0, 0, 1); // update header count
@ -226,6 +231,7 @@ abstract public class PDOMWriter {
final IASTName[] na= j.next(); final IASTName[] na= j.next();
final IASTName name = na[0]; final IASTName name = na[0];
if (name != null) { // should not be null, just be defensive. if (name != null) { // should not be null, just be defensive.
Throwable th= null;
try { try {
final IBinding binding = name.resolveBinding(); final IBinding binding = name.resolveBinding();
if (binding instanceof IProblemBinding) { if (binding instanceof IProblemBinding) {
@ -247,16 +253,16 @@ abstract public class PDOMWriter {
fStatistics.fDeclarationCount++; fStatistics.fDeclarationCount++;
} }
} catch (RuntimeException e) { } catch (RuntimeException e) {
if (!reported) { th= e;
stati.add(CCorePlugin.createStatus(
NLS.bind(Messages.PDOMWriter_errorResolvingName, name.toString(), path.getURI().getPath()), e));
}
reported= true;
j.remove();
} catch (PDOMNotImplementedError e) { } catch (PDOMNotImplementedError e) {
th= e;
} catch (StackOverflowError e) {
th= e;
}
if (th != null) {
if (!reported) { if (!reported) {
stati.add(CCorePlugin.createStatus( stati.add(CCorePlugin.createStatus(
NLS.bind(Messages.PDOMWriter_errorResolvingName, name.toString(), path.getURI().getPath()), e)); NLS.bind(Messages.PDOMWriter_errorResolvingName, name.toString(), path.getURI().getPath()), th));
} }
reported= true; reported= true;
j.remove(); j.remove();