This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 254044 - [newcodemodel] java.lang.AssertionError: 1 vs. 462
Summary: [newcodemodel] java.lang.AssertionError: 1 vs. 462
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.1
Hardware: All All
: P2 normal (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-31 20:40 UTC by Vladimir Voskresensky
Modified: 2015-08-28 08:16 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
further messages (213.45 KB, text/x-log)
2015-08-01 01:49 UTC, tbrunhoff
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Voskresensky 2015-07-31 20:40:15 UTC
java.lang.Exception: ERROR /home/toddb/src/srcapp/omneon/codecs/generic/mc-codec.cc
	at org.clang.tools.services.impl.PreprocessorSupport.preprocess(PreprocessorSupport.java:160)
	at org.clang.tools.services.ClankPreprocessorServices.preprocess(ClankPreprocessorServices.java:67)
	at org.netbeans.modules.cnd.apt.impl.support.clank.ClankDriverImpl.preprocessImpl(ClankDriverImpl.java:153)
	at org.netbeans.modules.cnd.apt.support.ClankDriver.preprocess(ClankDriver.java:101)
	at org.netbeans.modules.cnd.modelimpl.parser.clank.ClankTokenStreamProducer.getTokenStream(ClankTokenStreamProducer.java:156)
	at org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl.doParse(FileImpl.java:1448)
	at org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl._reparse(FileImpl.java:955)
	at org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl.ensureParsedImpl(FileImpl.java:742)
	at org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl.ensureParsed(FileImpl.java:624)
	at org.netbeans.modules.cnd.modelimpl.csm.core.ParserThread._run(ParserThread.java:148)
	at org.netbeans.modules.cnd.modelimpl.csm.core.ParserThread.run(ParserThread.java:74)
	at org.netbeans.modules.cnd.modelimpl.csm.core.ParserThreadManager$Wrapper.run(ParserThreadManager.java:92)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
Caused by: java.lang.AssertionError: 1 vs. 462
	at org.clang.tools.services.support.SkippedRangeBuilder.handleEndif(SkippedRangeBuilder.java:218)
	at org.clang.tools.services.support.FileInfo.onEndif(FileInfo.java:441)
	at org.clang.tools.services.support.FileInfoCallback.Endif(FileInfoCallback.java:565)
	at org.clang.lex.Preprocessor.SkipExcludedConditionalBlock(Preprocessor.java:5480)
	at org.clang.lex.Preprocessor.SkipExcludedConditionalBlock(Preprocessor.java:5329)
	at org.clang.lex.Preprocessor.HandleIfdefDirective(Preprocessor.java:8432)
	at org.clang.lex.Preprocessor.HandleDirective(Preprocessor.java:4222)
	at org.clang.lex.Lexer.LexTokenInternal(Lexer.java:2635)
	at org.clang.lex.Lexer.Lex(Lexer.java:377)
	at org.clang.lex.Preprocessor.Lex(Preprocessor.java:2344)
	at org.clang.tools.services.impl.PreprocessorSupport.ConsumePreprocessedInput(PreprocessorSupport.java:342)
	at org.clang.tools.services.impl.PreprocessorSupport.dumpPreprocessedEntry(PreprocessorSupport.java:222)
	at org.clang.tools.services.impl.PreprocessorSupport.preprocess(PreprocessorSupport.java:147)
	... 15 more
 null token stream for Start Entry: from file=/home/toddb/src/srcapp/omneon/codecs/generic/mc-codec.cc
Comment 1 Vladimir Voskresensky 2015-07-31 20:49:23 UTC
Todd,I see the name of problem file
/home/toddb/src/srcapp/omneon/codecs/generic/mc-codec.cc

Could you try to localize the preprocessor blocks
#ifdef
#elif
#end
which cause the exception in the log

I.e. run IDE from command line with printing messages in command line:
netbeans -J-Dnetbeans.logger.console=true
Then open file mc-codec.cc and try to reduce it to localize the problematic constructions.

Thanks!
Vladimir.
Comment 2 Vladimir Voskresensky 2015-07-31 20:54:28 UTC
extracted from log in https://netbeans.org/bugzilla/show_bug.cgi?id=254040
Comment 3 tbrunhoff 2015-07-31 22:58:44 UTC
So far I cannot see any issue. I have tried exiting, removing ~/.cache/netbeans/dev/cnd/model/, restarting and then opening the file.  I've tried closing all projects, exiting, removing the cache, reopening the one project, and then opening the file.  I've tried reparsing.

I did see two errors regarding this file when the project was closed, but I cannot reproduce them. The first error is:
 null token stream for Start Entry: from file=/home/toddb/src/srcapp/omneon/codecs/generic/mc-codec.cc
of project=ProjectKey /home/toddb/src/srcapp/omneon/codecs/generic/mc-codec.cc/N/%n while parsing file /home/toddb/src/srcapp/omneon/codecs/generic/mc-codec.cc%n of project /home/toddb/src/srcapp/omneon/codecs/generic/mc-codec.cc org.netbeans.modules.cnd.modelimpl.csm.core.ProjectImpl @352798309:352798309

The second error was this:
INFO [org.netbeans.modules.cnd.api.project.NativeProjectRegistry]: Close native project generic.nb (srcapp) /home/toddb/src/srcapp/omneon/codecs/generic/generic.nb
SEVERE [org.netbeans.modules.cnd.modelimpl]: Can't create compound statement: can't create token stream for file /home/toddb/src/srcapp/omneon/codecs/generic/mc-codec.cc at 1,406:1

If 1406 refers to the line, the code there is the open curly brace in this dtor:
McAvcEncoder::~McAvcEncoder()
{
    close();
}

Identifying the code is easy. The only ifdef, plus the only code affected by the ifdef, is below.  I use a construct like this to keep ifdefs out of methods because, as you know, ifdefs are not part of the language.

I should note that I am at home on a *similar* machine with the same os and the same version of NB. I can try it on the work machine on Monday. Is there something else I can do to cause the exception, or is the code snippet below enough for you?

--------------------------------------------------------------------
#ifdef MQX
const bool useMediaLayer = false;
#else
const bool useMediaLayer = false;
#endif

void McAvcDecoder::prime()
{
    PanasonicAvc::SType sType;
    if (true)
        sType = PanasonicAvc::sType100_1080p_2997;
    else if (true)
        sType = PanasonicAvc::sType50_1080p_2997;
    else if (true)
        sType = PanasonicAvc::sType100_1080i_2997;
    else
        sType = PanasonicAvc::sType50_720p_5994;
    simpleSglList_t sgList(2);
    sgList.sgl[0] = PanasonicAvc::getSpsPps(sType);

    if (useMediaLayer) {
        OpResult result;
        AutoRefPtr<MediaObj> obj(MediaObj::openObj(mediaFileTypeAvc, result));
        if (obj.get() == 0)
            return;

        MediaClipParam param = AvciParam::get(sType);
        MediaTrackDesc* track = obj->createTrack(param, result);
        if (track == 0)
            return;
        MediaClipDesc* clip = track->createClip(param, result);
        if (clip == 0)
            return;
        MediaSampleBuf buf(*clip);
        if (! clip->fillBlack(buf, 0, param.ticksPerSample, false))
            return;

        sgList.sgl[1].start = buf.getMem();
        sgList.sgl[1].size = buf.getNumSampleBytes();
    } else {
        sgList.sgl[1] = PanasonicAvc::getBlackFrame(sType);
    }

    if (sgList.sgl[1].start != 0) {
        mPriming = priming;
        uint nTokens = mNTokens;
        debugMsg("%s: priming w/ %s...\n", getName(), PanasonicAvc::getName(sType));
        decode(DecodeTag(), sgList);
        opFlush(1);
        if (mPriming == priming) {
            debugMsg("%s: priming failed; %d tokens parsed\n",
                     getName(), mNTokens - nTokens);
        } else {
            debugMsg("%s: priming ok\n", getName());
        }
    } else {
        debugMsg("%s: priming failed; avic sType=%d\n",
                     getName(), sType);
    }
}
Comment 4 tbrunhoff 2015-08-01 01:49:55 UTC
Created attachment 155106 [details]
further messages

There are a number of exceptions in my log as I watch.  Possibly related? Things like

java.lang.Exception: end < start for /home/toddb/src/srcapp/mc_sdk_src/streamlib/src/TSSection14496.cpp:[934-0]
SEVERE [org.netbeans.modules.cnd.modelimpl]: Can't create compound statement: can't create token stream for file /home/toddb/src/srcapp/omneon/codecs/generic/dgraph.cc at 26:1
SEVERE [org.netbeans.modules.cnd.modelimpl]: Can't create compound statement: can't create token stream for file /home/toddb/src/srcapp/omneon/codecs/generic/dgraph.cc at 35:1
SEVERE [org.netbeans.modules.cnd.modelimpl]: Can't create compound statement: can't create token stream for file /home/toddb/src/srcapp/omneon/codecs/generic/dgraph.cc at 197:1
SEVERE [org.netbeans.modules.cnd.modelimpl]: Can't create compound statement: can't create token stream for file /home/toddb/src/srcapp/omneon/codecs/generic/dgraph.cc at 206:1
SEVERE [org.netbeans.modules.cnd.modelimpl]: Can't create compound statement: can't create token stream for file /home/toddb/src/srcapp/omneon/codecs/generic/dgraph.cc at 217:1
SEVERE [org.netbeans.modules.cnd.modelimpl]: Can't create compound statement: can't create token stream for file /home/toddb/src/srcapp/omneon/codecs/generic/dgraph.cc at 239:1