Code::Blocks

User forums => General (but related to Code::Blocks) => Topic started by: awsdert on April 16, 2014, 01:17:13 pm

Title: Crashing on editor
Post by: awsdert on April 16, 2014, 01:17:13 pm
The attached is my entire CB settings from the Roaming folder in AppData, as soon as I open a file from my project the entire application just hangs :(
The memory usage just keeps going up according to the process manager and I have no idea what is causing it any help restoring normal behavior would be appreciated
Title: Re: Crashing on editor
Post by: awsdert on April 16, 2014, 03:42:52 pm
Gave up waiting, I deleted the folder and restarted my settings from scratch :(
Title: Re: Crashing on editor
Post by: oBFusCATed on April 16, 2014, 06:37:22 pm
Waiting for what?

Just an idea: You can diff you two default.conf file and then you can get a clue what might cause it.
Title: Re: Crashing on editor
Post by: awsdert on April 17, 2014, 02:44:47 pm
Waiting for a reply, I've never actually tried using diff before, could you point me to a guide please?
Title: Re: Crashing on editor
Post by: scarphin on April 17, 2014, 03:14:47 pm
You can use Notepad++ for a visual compare. Just open the 2 files in question and push Alt+D.
Title: Re: Crashing on editor
Post by: awsdert on April 17, 2014, 05:22:52 pm
Is there a way to do all text files in a directory?
Title: Re: Crashing on editor
Post by: scarphin on April 18, 2014, 12:09:24 am
I don't think diff will be reasonable for 3 or more files. I mean diff relative to which file? Just comparing your previous and current 'default.conf' file might give you a clue.
Title: Re: Crashing on editor
Post by: oBFusCATed on April 18, 2014, 12:58:52 am
There are various tools you can use. It depends on the OS you're using. Search the internet you'll find plenty of information.
But you only need to compare the default.conf files.
Title: Re: Crashing on editor
Post by: awsdert on April 18, 2014, 07:38:23 am
Oh ok, never really played with those files before so I didn't realise it was just 1 main file.
I'll check it out tomorrow in the evening, I have stuff going on up until then.
Title: Re: Crashing on editor
Post by: awsdert on April 20, 2014, 09:37:05 am
Okay did a bit of file renaming to keep files in the same directory then used this site (http://i-tools.org/diff) to get the attached result.
I still can't figure out the cause.
Title: Re: Crashing on editor
Post by: awsdert on April 21, 2014, 08:27:25 am
Found the cause, it was the parser. I noticed after opening a project it started a thread for the parser so I tried turning off process complex macros and it stopped freezing.

On another note why are threads doing the job of something that should be passed to an executable?
An executable can write the info to a temporary file that the thread can then read WITHOUT freezing up.
Can just use a simple bool at start of each file to confirm weather it is ready for thread to use, in mean time thread can use old file.
E.g.
parser.exe FILE_PATH~parserINDEX~
where INDEX refers to 0 - 9 (when hit 9 just reset to 0)
parserThread:
Code: [Select]
FILE *useParserFile = oldParserFile;
// oldParserFile will use INDEX - 1 or 9 if INDEX = 0
bool nxtParser = false;
fseek( nxtParserFile, 0, SEEK_SET );
fread( nxtParserFile, &nxtParser, 1, 1 );
if ( nxtParser )
  useParserFile = nxtParserFile;
if ( !useParserFile )
  return;
// Continue as normal
Title: Re: Crashing on editor
Post by: ollydbg on April 21, 2014, 09:41:13 am
Hi, awsdert, thanks for the research. If the parser (thread) get crashed, then the whole C::B process get crashed. So, I think it it better to fix the bug in the parser (thread), especially in handling macro expansion. Because there are a lot of recursive calls when we do the macro expansion when you have “handle complex macros" option enabled.

Can you supply a simple project which can lead the crash? Thanks.


Title: Re: Crashing on editor
Post by: awsdert on April 22, 2014, 08:42:01 am
This is a project I only just recently started and it crashed on that one (let alone my custom framework project), it should be small enough.
Title: Re: Crashing on editor
Post by: ollydbg on April 22, 2014, 09:58:20 am
This is a project I only just recently started and it crashed on that one (let alone my custom framework project), it should be small enough.
It does not crash on my computer. I see that your project use MSVC compiler, but I don't have such compiler in my computer. I guess the parser hangs when it try to parse the header files from your MSVC compiler suite. I'm not sure how to help you further, since I don't have those include files from MSVC.  :-[
Title: Re: Crashing on editor
Post by: awsdert on April 22, 2014, 11:20:55 am
Why not install VS2013, copy the VC folder elsewhere, uninstall VS and use the copied folder?

Edit:  Just retried the complex macro setting and CB didn't freeze, perhaps it had something todo with my global paths? but if so the parser should have recognised that and skipped them. Seems I've lost a step somewhere that caused the parser to freeze the ui, but it is definitely safe to say part of the problem lies in the parser because th ui only ever freezed when I opened a file or click somewhere on a pre-opened file.

Edit: Deliberately broke VC tool chain path and there was no freeze either, dunno what else the missing step could be.
Title: Re: Crashing on editor
Post by: ollydbg on April 22, 2014, 03:35:02 pm
Why not install VS2013, copy the VC folder elsewhere, uninstall VS and use the copied folder?
I won't right now, I don't have such resource.

Quote
Edit:  Just retried the complex macro setting and CB didn't freeze, perhaps it had something todo with my global paths? but if so the parser should have recognised that and skipped them. Seems I've lost a step somewhere that caused the parser to freeze the ui, but it is definitely safe to say part of the problem lies in the parser because th ui only ever freezed when I opened a file or click somewhere on a pre-opened file.

Edit: Deliberately broke VC tool chain path and there was no freeze either, dunno what else the missing step could be.
The parser don't do magic things, all it do is open a file, and parse it. You can even build C::B, then run C::B in a debugger(GDB), then you can halt the C::B to see why it goes to infinity loop.
Title: Re: Crashing on editor
Post by: awsdert on April 29, 2014, 09:11:29 am
Okay, I just added the WIN7 SDK includes to a fresh project that uses Iup (with follow GLOBAL & process complex on) and the GUI just locked up on me when I went back to the file I was working on

Edit: After reloading, disabling parse complex, trying, re-enabling, and trying again the issue has once again vanished, leaves me ???.
As for compiling CB I took one look at the source and guide and decided it was too complex for me to bother (I'm REALLY lazy).
Maybe I'll try after I get everything else I wanna do done first.
Title: Re: Crashing on editor
Post by: ollydbg on May 01, 2014, 06:55:20 am
Okay, I just added the WIN7 SDK includes to a fresh project that uses Iup (with follow GLOBAL & process complex on) and the GUI just locked up on me when I went back to the file I was working on

Edit: After reloading, disabling parse complex, trying, re-enabling, and trying again the issue has once again vanished, leaves me ???.
As for compiling CB I took one look at the source and guide and decided it was too complex for me to bother (I'm REALLY lazy).
Maybe I'll try after I get everything else I wanna do done first.
I don't have Win7 SDK includes, so I don't know how to help. Is there any way I can get a simple SDK headers and your sample projects?
Other wise, you need to debug this issue yourself( build C::B from source, and run it under GDB, and see whether it goes into an infinite loop in the parser)