Author Topic: crash in code::blocks svn5844 apparently in code completion  (Read 6406 times)

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
crash in code::blocks svn5844 apparently in code completion
« on: October 06, 2009, 12:41:43 am »
Hello everybody,

c::b just crash five times doing five times the same thing:

procedure: typing just "voi" in a header file in order to declare a function returning void.

effect: just having typed "voi" the editor freezes and the cpu usage goes up to 100% immediately (top). the editor only shows the input "vo" without the "i". code completion is configured as default to kick in after third charkter. codeblocks remains absolutely frozen and is terminated by the OS after about one minute one my machine.
code completion pop-up does not show.

using SuSE 11.1 x86_64 on a amd athlon x2 +4200 machine. c::b in version svn5844 self compiled as usual.

searching in the /tmp folder there appears to be no crash report generated for the above crashes. Only file that matches date and time is a file named CODEBLOCKS.socket .Typing "int" correctly pops upp the code completion pop-up with all correct suggestions.

regards and greetings from asturias

nausea
« Last Edit: October 06, 2009, 12:46:08 am by nausea »
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5302
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: crash in code::blocks svn5844 apparently in code completion
« Reply #1 on: October 06, 2009, 03:01:09 am »
HI!

But I can't reproduce this on svn5840 in Windows XP. :(

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: crash in code::blocks svn5844 apparently in code completion
« Reply #2 on: October 06, 2009, 04:26:03 am »
The same to ollydbg.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: crash in code::blocks svn5844 apparently in code completion
« Reply #3 on: October 06, 2009, 06:49:14 am »
I just tried it on debian (also 64-bit) and it works as expected.

Does this always happen, or do you "need" special headers to make it appear (like boost etc.).

If it does not always hang, it would be nice if you could create a simple test-project where this error occurs and attach it.

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
Re: crash in code::blocks svn5844 apparently in code completion
« Reply #4 on: October 06, 2009, 11:20:39 am »
Hi,

I stripped the project of all unnecessary ballast and tested it. Doesn't use any special includes, the project is a working wxWidgets 2.8.8 wxGtk project with a minimal frame. The behavior is unchanged as I described.

The attached .zip contains hopefully everything to run the thing. Always could be simply that my local configuration, compilation, etc ... of c::b is goofed up ... wouldn't be the first time neither ...

Thanks for the interest

nausea

[attachment deleted by admin]
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
Re: crash in code::blocks svn5844 apparently in code completion
« Reply #5 on: October 06, 2009, 12:21:07 pm »
Did some more testing.

Tested the c++ keywords (not all):

do not crash: int, bool, long, class, struct, signed, unsigned, template, typedef, explicit, const

crash: void, double

crash always happens on typing third character (meaning, if typedef works, typename also works). Settings: kick in after three characters, maximum hits is 20.

setting up the limit of kick-in to four the behavior is the same, only crash now happening after typing forth character.

Regards

nausea
« Last Edit: October 06, 2009, 12:44:33 pm by nausea »
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
Re: crash in code::blocks svn5844 apparently in code completion
« Reply #6 on: October 06, 2009, 12:51:52 pm »
Did a check-out of the svn. There have been changes in code completion yesterday, I think, by Morten McFly.

the files that changed:
nativeparser.cpp             5840     to      5845
nativeparser.h                5826              5845
codecompletion.cpp        5834              5845
parserthread.cpp            5838              5845
parserthread.h               5833              5845
parser                          5838              5845
codecompletion              5840              5846

I will try out the new svn and see what happens....
« Last Edit: October 06, 2009, 12:54:26 pm by nausea »
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
Re: crash in code::blocks svn5844 apparently in code completion
« Reply #7 on: October 06, 2009, 12:57:55 pm »
well, same result, void did work and I saw a pop up saying "parser is still working", but no pop-up with suggestions, at least it did not crash.

CORRECTION: typing "voi" did crash after second try, the first positive result I can not explain, now it crashes in this case too, always ...

"double" crashed after typing "dou" with symptoms as before. c::b is 5846      (svn build rev 5846 (2009-10-06T08:52:59.937028Z) gcc 4.3.2 Linux/unicode)

Regards

nausea

CORRECTION: the pop-up saying "parser is still working" always shows once, trying to type either "double" or "void" and the program does not crash after third character, but does not show pop-up with suggestion either. At second intent the program crashes as above. This happens either by typing a new line and there "dou" or "voi" or by erasing the previous typed letters, such as leaving only a "d" or "v" and trying to complete this word to "double" or "void" respectively. crash as above described.

PS: would be nice, please, if anyone could post any reaction whatsoever. I'm beginning to feel a bit strange, like that cartoon figure running over the edge and still moving it's legs ;)
« Last Edit: October 06, 2009, 01:28:00 pm by nausea »
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: crash in code::blocks svn5844 apparently in code completion
« Reply #8 on: October 06, 2009, 01:09:59 pm »
I can confirm this issue with your test-project on debian 64-bit.
Will look into it.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: crash in code::blocks svn5844 apparently in code completion
« Reply #9 on: October 06, 2009, 02:25:26 pm »
It's an endless-loop in FindAIMatches in nativeparser.cpp.
If I comment out the if-block starting with if (local_result.size() == 1) (lines 1720 - 1747) it works again, but most likely break other stuff.

The block was added in svn r5770 (merge with old cc-branch) and originally added in svn 5685 to cc-refactoring-branch.

To reproduce the crash (or better the endless-loop) on windows, you can do the following:

  • find the definition of VOID (it is in winnt.h in my MinGW-install),
  • comment it out
  • add typedef void VOID; in a simple hello-world console-project
  • save it
  • and after typing vo it hangs (if cc kicks in after three characters)
.

This "works" at least for me.


Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9612
Re: crash in code::blocks svn5844 apparently in code completion
« Reply #10 on: October 06, 2009, 02:34:23 pm »
I can confirm this issue with your test-project on debian 64-bit.
I can't reproduce, still (on Windows 32bit). :-(
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: crash in code::blocks svn5844 apparently in code completion
« Reply #11 on: October 06, 2009, 02:51:47 pm »
C::B reliable bails out even on windows (if I use my fantastically step-by-step instruction).

It seems there must be exactly one typdef that starts with the same characters (case does not matter) than a (builtin ?) type and no other tokens, that make cc kick in at this time.

The same happens for double on linux if mathdef.h gets parsed (contains typedef double double_t;) and no other tokens start with dou.

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: crash in code::blocks svn5844 apparently in code completion
« Reply #12 on: October 06, 2009, 03:04:39 pm »
It's an endless-loop in FindAIMatches in nativeparser.cpp.
If I comment out the if-block starting with if (local_result.size() == 1) (lines 1720 - 1747) it works again, but most likely break other stuff.

The block was added in svn r5770 (merge with old cc-branch) and originally added in svn 5685 to cc-refactoring-branch.

To reproduce the crash (or better the endless-loop) on windows, you can do the following:

  • find the definition of VOID (it is in winnt.h in my MinGW-install),
  • comment it out
  • add typedef void VOID; in a simple hello-world console-project
  • save it
  • and after typing vo it hangs (if cc kicks in after three characters)
.

This "works" at least for me.


Another simple way to solve this
Code: [Select]
Token* tdef = DoAddToken(tkClass, components.front(), lineNr, 0, 0, args);In this thread,http://forums.codeblocks.org/index.php/topic,11187.msg76830.html#msg76830
maybe this is the reason why the suggestion list flashed.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9612
Re: crash in code::blocks svn5844 apparently in code completion
« Reply #13 on: October 06, 2009, 03:43:49 pm »
The block was added in svn r5770 (merge with old cc-branch) and originally added in svn 5685 to cc-refactoring-branch.
if (local_result.size() == 1) (lines 1720 - 1747)
Harhar! Now I know why it works for me: I have experimentally commented out that whole section as we were discussing about that. To be honest: I don't believe this section is necessary anymore. So far everything concerning typedefs (what this block was fort) works just fine here. I'll probably commit later. For now: Just remove that section in your local copy (all of you affected).
« Last Edit: October 06, 2009, 03:49:27 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
Re: crash in code::blocks svn5844 apparently in code completion
« Reply #14 on: October 06, 2009, 04:43:19 pm »
Confirmed, commenting out those lines solves the issue here...

Many thanks, greetings from Asturias

nausea  :D
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100