Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Stack overflow on parsing CPP file

I'm afraid I can't do this right now due to the copyrighted file. Let
me try to dig into problem.

First, I would like to understand the following code:
CPPVisitor.getContainingScopeOrNull(IASTName), line 912-919
				if (i > 0) {
					IBinding binding = names[i-1].resolveBinding();
					while (binding instanceof ITypedef) {
						IType t = ((ITypedef)binding).getType();
						if (t instanceof IBinding)
							binding = (IBinding) t;
						else break;

Also, instead of real names I will use dummy class like this
class Dummy { int dummyMethod(); int dummyMethod2();  };

As you can see, line 913 is in the stack.
With the break at StackOverflowError I can see, that the name that is
passed to this method is CPPASTName for a C++ method ('dummyMethod').
Its parent is ICPPASTQualifiedName ('Dummy::dummyMethod').

getContainingScopeOrNull tries to find the name 'dummyMethod' in the
array of { 'Dummy', 'dummyMethod'}. After that, 'i' is equal to 1
(name was found at line 899)

The code at line 912 then tries to resolve the name of the class
('Dummy') once again. I can see that the name 'Dummy' (the member of
CPPASTQualifiedName) already have RecursionResolvingBinding as a
binding (i.e. it is not null. Perhaps it was assigned at
CPPASTName.resolveBinding() line: 75 when the number of attemps has
been exhaused).

Is it intended behaviour to resolve this name again?

2008/10/2 Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx>:
> Could you please file a bug for this. Is the problem reproducible with the
> same file moved to a separate project containing just that file? If not, you
> can try to run the file through the preprocessor and check if the problem is
> reproducible with the preprocessed file.
> -sergey
> On Thu, Oct 2, 2008 at 9:06 AM, Dmitry Smirnov <divis1969@xxxxxxxxx> wrote:
>> Hi,
>> While creating IASTTranslationUnit for some file I've encontered a
>> Stack overflow (see attachment).
>> I'm trying to understand whether this a bug or the file is so complex
>> for the parser.
>> Unfortunately, I cannot share the file. At the same time I cannot yet
>> create some simpler example because I do not understand what happens
>> here.
>> It looks like the problem is some kind of unstable issue: few
>> different files can cause such error but sometimes parsing of a file
>> goes ok.
>> I tried to lookup what was the name at lines
>> ASTInternal.addName(IScope, IASTName) line: 83
>> In all the cases these names are <Class Name>:<Method Name>
>> And what is interesting here is that one and the same name appears
>> exactly 5 times (in 5 consequetive frame records for this
>> ASTInternal.addName ). 6th frame starts a sequence for another method.
>> Do you have any ideas how to figure out the reason for that behavour?
>> Dmitry
>> _______________________________________________
>> cdt-dev mailing list
>> cdt-dev@xxxxxxxxxxx
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx

Back to the top