Author Topic: CC upper limits ? BUT for sure BUGs  (Read 42920 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6024
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: CC upper limits ? BUT for sure BUGs
« Reply #30 on: January 31, 2014, 03:36:06 pm »
Maybe i can help. Is there a test project? What patch/branch should I look at.
Hi, thanks, the test workspace is in this post Re: CC upper limits ? BUT for sure BUGs (supplied by killerbot)

the patch is in this post: Re: CC upper limits ? BUT for sure BUGs, it is against the CB trunk code, but I'm using GIT clone, so patch is in git format. ;D

You need to open the workspace, and see the logs in both "Codeblocks log" and "Codeblocks debug log"(start C::B with debug-log options) panel.
Also, the CC option should be set to "one parser for the whole workspace" mode, it can be done by opening the CodeCompletion plugin option, and in the bottom of the c/c++ parser page, once changed, you should restart C::B(I guess it is a must step).

In the patch file, I have generally wrote the logic of how CC add files to the parser, it add projects one by one, there are three projects:
Code
Dummy
NamingService
Dummy2
When finish parsing the Dummy project, all the files in the NamingService were parsed too. This means the files of NamingService were all belong to the Dummy project, so NamingService doesn't need to add files to the "thread task pool" to run the parsing tasks, also, under Linux, the "fetch of the GCC predefined macros" is always failed (you can see jens' reply before, I don't know why), as an conclusion, NamingService doesn't make the "thread task pool" to run, so all the later parsing jobs were canceled, because the start parsing of the next project only happens we receive a "thread task pool done" event.

My patch try to detect the condition that if both "file need to parse" and "fetched GCC predefined macros" are empty, we try to parse the next project, in killerbot's sample, it is the third project "Dummy2".

I'm not sure you understand my explanation, I don't have this issue under Windows. Thanks.

« Last Edit: January 31, 2014, 03:38:38 pm by ollydbg »
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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6024
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: CC upper limits ? BUT for sure BUGs
« Reply #31 on: January 31, 2014, 03:43:14 pm »
Hi, dmoore, after writing my previous post, I have a new idea, see below:

I think I don't need a Linux system to reproduce the result of killerbot in this post Re: CC upper limits ? BUT for sure BUGs. After disable the compiler plugin, I can get the same log result under Windows, I will try to dig it now, thanks.

 ;)
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 killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5513
Re: CC upper limits ? BUT for sure BUGs
« Reply #32 on: January 31, 2014, 03:47:55 pm »
this is from the debug log (had to start CB with option -d to have that log) :

Code
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/include/c++/4.7
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/include/c++/4.7/x86_64-suse-linux
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/include/c++/4.7/backward
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/lib64/gcc/x86_64-suse-linux/4.7/include
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/local/include
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/lib64/gcc/x86_64-suse-linux/4.7/include-fixed
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/x86_64-suse-linux/include
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/include
NativeParser::DoFullParsing(): AddCompilerPredefinedMacros failed!
NativeParser::DoFullParsing(): Adding three kind of files to batch-parser
NativeParser::DoFullParsing(): Add priority header file: '/usr/include/c++/4.7/cstddef'
NativeParser::DoFullParsing(): Add priority header file: '/home/killerbot/Projects/newtec/duck/trunk/toolchain/powerpc-e500v2-linux-gnuspe/powerpc-e500v2-linux-gnuspe/powerpc-e500v2-linux-gnuspe/include/c++/4.7.0/cstddef'
NativeParser::DoFullParsing(): Add priority header file: '/usr/local/include/c++/v1/cstddef'
NativeParser::DoFullParsing(): Add priority header file: '/usr/local/include/boost/config.hpp'
NativeParser::DoFullParsing(): Add priority header file: '/usr/include/boost/config.hpp'
NativeParser::DoFullParsing(): Add priority header file: '/usr/local/include/boost/filesystem/config.hpp'
NativeParser::DoFullParsing(): Add priority header file: '/usr/include/boost/filesystem/config.hpp'
NativeParser::DoFullParsing(): Add 7 priority file(s) for project 'Dummy'...
NativeParser::DoFullParsing(): Added 2 header&source file(s) for project 'Dummy' to batch-parser...
NativeParser::CreateParser(): Finish creating a new parser for project 'Dummy'
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.
NativeParser::OnParserStart(): Starting batch parsing for project 'Dummy'...
ReadClsNames() : Unexpected token '((__aligned__))' for 'struct80___pthread_unwind_buf_t', file '/usr/include/pthread.h', line 515.
NativeParser::OnParserEnd(): Project 'Dummy' parsing stage done!
Project 'Dummy' parsing stage done (78 total parsed files, 2440 tokens in 0 minute(s), 0.955 seconds).
SystemHeadersThread: /home/killerbot/Projects/CC-bug/libraries/common/NamingService/export/ , 1
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.
NativeParser::AddProjectToParser(): Add project (NamingService) to parser
NativeParser::AddProjectToParser(): AddCompilerPredefinedMacros failed!
NativeParser::AddProjectToParser(): Done adding 0 files of project (NamingService) to parser.
NativeParser::OnParsingOneByOneTimer(): Add additional (next) project to parser.

so it doesn't do dummy2 anymore

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6024
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: CC upper limits ? BUT for sure BUGs
« Reply #33 on: January 31, 2014, 04:05:10 pm »
Hi, killerbot, thanks.

Here is the new patch, I think it is correct now(fix some logic error of previous patch), so I have tested it under either compiler plugin is enabled or disabled. Both cases are OK, please apply and give me the logs. Hope this is the finally patch. ;)

Thanks for the further testing.
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 killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5513
Re: CC upper limits ? BUT for sure BUGs
« Reply #34 on: January 31, 2014, 04:17:14 pm »
tested new patch.
from the logs, it seems ok

Code
NativeParser::CreateParser(): Finish creating a new parser for project 'Dummy'
NativeParser::OnParserEnd(): Project 'Dummy' parsing stage done!
NativeParser::AddProjectToParser(): Add project (NamingService) to parser
NativeParser::OnParsingOneByOneTimer(): nothing need to parse in this project, try next project.
NativeParser::AddProjectToParser(): Add project (Dummy2) to parser
NativeParser::OnParserEnd(): Project 'Dummy2' parsing stage done!

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6024
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: CC upper limits ? BUT for sure BUGs
« Reply #35 on: January 31, 2014, 04:24:34 pm »
tested new patch.
from the logs, it seems ok

Code
NativeParser::CreateParser(): Finish creating a new parser for project 'Dummy'
NativeParser::OnParserEnd(): Project 'Dummy' parsing stage done!
NativeParser::AddProjectToParser(): Add project (NamingService) to parser
NativeParser::OnParsingOneByOneTimer(): nothing need to parse in this project, try next project.
NativeParser::AddProjectToParser(): Add project (Dummy2) to parser
NativeParser::OnParserEnd(): Project 'Dummy2' parsing stage done!
Ok, that's fast, commit as r9616 now.  :)

Also one issue still remains: why fetch gcc predefine macro failed under Linux (success under Windows). I don't know, maybe, some guys can help to debug the function: bool NativeParser::AddCompilerPredefinedMacros(cbProject* project, ParserBase* parser) under Linux, thanks.


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.