Bug 248934 - Parser fails to get AST when eclipse lauched with vmarg -ea
Summary: Parser fails to get AST when eclipse lauched with vmarg -ea
Status: RESOLVED INVALID
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 5.0   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2008-09-29 08:41 EDT by Jagadisha Gangulli CLA
Modified: 2008-09-30 09:51 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jagadisha Gangulli CLA 2008-09-29 08:41:59 EDT
Build ID: I20080617-2000   version 3.4.0

Steps To Reproduce:
when we are using the eclipse with vmarg -ea 

if the soruce file [ ie cpp file ] has a method signature or static member declaration 
then getASTTranslationUnit fails to return the AST. It fails during the parsing. 
The same works fine when eclipse is lauched without this vmarg. 

please find the details where it fails.


package org.eclipse.cdt.core.dom.parser;
Class AbstractCLikeLanguage---- GPPLanguage 



final ISourceCodeParser parser= createParser(scanner, log, index, false, options);

fails when you try to get the AST  through the parse call
IASTTranslationUnit ast= parser.parse();




More information:
Comment 1 Markus Schorn CLA 2008-09-30 08:18:59 EDT
I assume that an assertion fails, which should cause an entry in the error log.
Please provide the relevant entry (<workspace>/.metadata/.log)
Comment 2 Keith W. Campbell CLA 2008-09-30 09:24:01 EDT
This occurs with org.eclipse.cdt.core_5.0.1.200809120802

The line of code says:
    assert fLocked;
which I interpret as the assumption that the database is locked presumably to prevent concurrent access. A failure here may signal data corruption.

--------------------------------
Database.getChunk(int) line: 242
BTree.accept(int, IBTreeVisitor) line: 551
BTree.accept(IBTreeVisitor) line: 535
PDOMFile.findFile(PDOM, BTree, IIndexFileLocation, int, IIndexLocationConverter) line: 507
WritablePDOM(PDOM).getFile(int, IIndexFileLocation) line: 300
WritablePDOM(PDOM).getFile(int, IIndexFileLocation) line: 1
CIndex.getFile(int, IIndexFileLocation) line: 208
IndexBasedCodeReaderFactory.getContentForInclusion(String) line: 132
CPreprocessor$1.checkFile(String, String) line: 96
CPreprocessor$1.checkFile(String, String) line: 1
CPreprocessor.findInclusion(String, boolean, boolean, File, IIncludeFileTester<T>) line: 783
CPreprocessor.findInclusion(String, boolean, boolean, File) line: 769
CPreprocessor.executeInclude(Lexer, int, boolean, boolean) line: 1059
CPreprocessor.executeDirective(Lexer, int) line: 899
CPreprocessor.internalFetchToken(boolean, boolean, boolean, boolean, ScannerContext) line: 603
CPreprocessor.fetchToken() line: 431
CPreprocessor.nextToken() line: 489
GNUCPPSourceParser(AbstractGNUSourceCodeParser).fetchToken() line: 331
GNUCPPSourceParser(AbstractGNUSourceCodeParser).LA(int) line: 196
GNUCPPSourceParser(AbstractGNUSourceCodeParser).LAcatchEOF(int) line: 211
GNUCPPSourceParser(AbstractGNUSourceCodeParser).parseTranslationUnit() line: 898
GNUCPPSourceParser(AbstractGNUSourceCodeParser).translationUnit() line: 890
GNUCPPSourceParser(AbstractGNUSourceCodeParser).parse() line: 476
GPPLanguage(AbstractCLikeLanguage).getASTTranslationUnit(CodeReader, IScannerInfo, ICodeReaderFactory, IIndex, int, IParserLogService) line: 139
TranslationUnit.getAST(IIndex, int, IProgressMonitor) line: 831
TranslationUnit.getAST(IIndex, int) line: 796
...
Comment 3 Markus Schorn CLA 2008-09-30 09:32:32 EDT
You need to obtain a lock on the index, see documentation of IIndex.acquireReadLock()
Comment 4 Keith W. Campbell CLA 2008-09-30 09:51:15 EDT
That was easy. Thanks, Markus.