Author Topic: Some annoying symbols-browser issues  (Read 28166 times)

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Some annoying symbols-browser issues
« on: August 01, 2011, 10:20:29 pm »
One issue I get on windows xp and on my debian system (gcc 4.5 on windows amd 4.6 on linux) is, that neither the PARSER_START not the PARSER_END event is caught by the appropriate event-handlers.
Refreshing the symbols-browser tree manually works, switching between the View (e.g. Everything and workspace) works also.
The event is sent correctly if I debug C::B, but as I wrote it is never caught.

Another thing, is that switching between workspace- and project-view does not show all symbols. In both views I only get the symbols from the project, that was active when opening the workspace (two projects, one parser per project or one parser per workspace).

As third: I always see some boost-defines and most likely some of the other high-priority headers (former up-front) in the symbols-browser, even if I do not include these headers any of my projects.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Some annoying symbols-browser issues
« Reply #1 on: August 02, 2011, 04:08:13 am »
One issue I get on windows xp and on my debian system (gcc 4.5 on windows amd 4.6 on linux) is, that neither the PARSER_START not the PARSER_END event is caught by the appropriate event-handlers.
I'm testing this issue on Windows XP and rev 7289.
It seems all the PARSER_START and PARSER_END works fine.
The flow is something like:(when a project is loaded)
1, send PARSER_START
2, NativeParser::OnParserStart() been called
3, CodeCompletion::OnParserStart() been called
4, send PARSER_END
5, NativeParser::OnParserEnd() been called
6, CodeCompletion::OnParserEnd() been called.

As third: I always see some boost-defines and most likely some of the other high-priority headers (former up-front) in the symbols-browser, even if I do not include these headers any of my projects.
The high-priority headers were predefined by Codecompletion plugin, and they were searched and parsed before parsing any actual files in your projects. This behavior is used to handle some predefined macro definition in those high-priority headers. So, even you did not include those files in your projects, they were still be parsed, thus this issue you complain happens.
I think you can simply change these high-priority headers in Codecompletions options dialog. :D
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 Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Some annoying symbols-browser issues
« Reply #2 on: August 02, 2011, 06:53:13 am »
As third: I always see some boost-defines and most likely some of the other high-priority headers (former up-front) in the symbols-browser, even if I do not include these headers any of my projects.
The high-priority headers were predefined by Codecompletion plugin, and they were searched and parsed before parsing any actual files in your projects. This behavior is used to handle some predefined macro definition in those high-priority headers. So, even you did not include those files in your projects, they were still be parsed, thus this issue you complain happens.
I think you can simply change these high-priority headers in Codecompletions options dialog. :D
Maybe we can put it into "Project > Properties > C/C++ Parser options".
So that each project can be set to different high-priority headers.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re: Some annoying symbols-browser issues
« Reply #3 on: August 02, 2011, 07:15:50 am »
Maybe we can put it into "Project > Properties > C/C++ Parser options".
So that each project can be set to different high-priority headers.
But then, people won't do it and effectively loose this feature. I think it' OK to have them in one place and maybe spoil the symbol table with a little useless information. In the end it doesn't consume too much memory.

BTW: Jens, I cannot reproduce on Windows XP. Could you provide simple steps / a project to reproduce? Do you see in the debug log the message "NativeParser received parser end event" and "CodeCompletion received parser end event"? I see them whatever parsr configuration I use...?!
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Some annoying symbols-browser issues
« Reply #4 on: August 02, 2011, 02:45:50 pm »
@ollydbg:
I know how the event-handling should work, and the appropriate calls to PostParserEvent are made, but the events are never caught.
Here is the debug-log after creating a new console-project with the wizard, before creating I cleaned the log:
Code
4 user templates loaded
Project's base path: /tmp/test/
Project's common toplevel path: /tmp/test/
Caching GCC dir: /usr/include/c++/4.6
Caching GCC dir: /usr/include/c++/4.6/x86_64-linux-gnu
Caching GCC dir: /usr/include/c++/4.6/backward
Caching GCC dir: /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/include
Caching GCC dir: /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/include-fixed
Caching GCC dir: /usr/include/x86_64-linux-gnu
Caching GCC dir: /usr/include
Passing list of files to batch-parser.
Header to parse with priority: '/usr/include/c++/4.6/cstddef'
Header to parse with priority: '/usr/include/boost/config.hpp'
Header to parse with priority: '/usr/include/boost/filesystem/config.hpp'
Add 3 priority parsing file(s) for project 'test'...
Added 1 file(s) for project 'test' to batch-parser...
Create new parser for project 'test'

Of course nothing happens in the symbols-browser, but after refreshing the tree, evrything is there.

@MortenMacFly:
I can not test on XP at the moment, not at work until next week (holidays  :D ), but will test it on win7 later.

About littering the symbols-browser with boost- (and other) defines:
it's a minor issue, but I would prefer to see only stuff, that is in the scope of my application.
Is there no information about the reachable header-files to filter these defines ?

By the way the autocompletion does not work for any defines after an #ifdef, but on a blank line.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Some annoying symbols-browser issues
« Reply #5 on: August 02, 2011, 04:03:13 pm »
@ollydbg:
I know how the event-handling should work, and the appropriate calls to PostParserEvent are made, but the events are never caught.
Here is the debug-log after creating a new console-project with the wizard, before creating I cleaned the log:
Code
4 user templates loaded
Project's base path: /tmp/test/
Project's common toplevel path: /tmp/test/
Caching GCC dir: /usr/include/c++/4.6
Caching GCC dir: /usr/include/c++/4.6/x86_64-linux-gnu
Caching GCC dir: /usr/include/c++/4.6/backward
Caching GCC dir: /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/include
Caching GCC dir: /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/include-fixed
Caching GCC dir: /usr/include/x86_64-linux-gnu
Caching GCC dir: /usr/include
Passing list of files to batch-parser.
Header to parse with priority: '/usr/include/c++/4.6/cstddef'
Header to parse with priority: '/usr/include/boost/config.hpp'
Header to parse with priority: '/usr/include/boost/filesystem/config.hpp'
Add 3 priority parsing file(s) for project 'test'...
Added 1 file(s) for project 'test' to batch-parser...
Create new parser for project 'test'
I have the similar message under WinXP, but I just setting breakpoints on the event-handers, and every event-handler function will be reached.

BTW: Jens, I cannot reproduce on Windows XP. Could you provide simple steps / a project to reproduce? Do you see in the debug log the message "NativeParser received parser end event" and "CodeCompletion received parser end event"? I see them whatever parsr configuration I use...?!
@morten:
the strange thing is,  my log was quite similar with jens', and there is NO such log like:

Code
CodeCompletion received parser end event

But looking at the source code, it should be there( I can even reaching the breakpoint in that function body)
Code
oid CodeCompletion::OnParserEnd(wxCommandEvent& event)
{
    if (!Manager::IsAppShuttingDown())
        Manager::Get()->GetLogManager()->DebugLog(_("CodeCompletion received parser end event."));

    ParsingType type = static_cast<ParsingType>(event.GetInt());
    if (type == ptCreateParser)
    {
        if (   !m_SystemHeadersThread.empty()
            && !m_SystemHeadersThread.front()->IsRunning()
            && m_NativeParser.Done() )
        {
            m_SystemHeadersThread.front()->Run();
        }
    }

    cbEditor* editor = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
    if (editor)
        ParseFunctionsAndFillToolbar(true);

    event.Skip();
}
Does it means the "DebugLog" function does not works correctly? or some messages were slip away???



« Last Edit: August 02, 2011, 04:43:16 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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Some annoying symbols-browser issues
« Reply #6 on: August 02, 2011, 04:27:25 pm »
Does it means the "DebugLog" function does not works correctly? or some messages were slip away???
I guess if it is called from a non-main-gui thread, a race condition is possible (wxGTK is almost single threaded lib) and skipped messages, too.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Some annoying symbols-browser issues
« Reply #7 on: August 02, 2011, 04:37:48 pm »
@all. sorry, I think I was making a mistake.

I'm seeing the debug-log from an very old nighty build rev 7075.

and the log message was added in rev 7273 by morten
Quote
mortenmacfly  2011-7-3 19:46:20             
* CC: show some more information to the user to hunt CC bugs
- CC: remove long-time obsolete functions to save a CC cache

So, That's my mistake, sorry for the noise.

And I have tested
1, loading a cbp project
2, using wizard to create a simple console project.

Both of them will show such "CodeCompletion received parser end event." kind message. :D

@jens:
did you use an old revision before rev 7273????? :D
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 Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Some annoying symbols-browser issues
« Reply #8 on: August 02, 2011, 05:00:02 pm »
Jens, are you using Debian Testing?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Some annoying symbols-browser issues
« Reply #9 on: August 02, 2011, 05:06:21 pm »
Jens, are you using Debian Testing?
Unstable/experimental (with some libs of testing of course), with libgtk2.0 2.24.5-4, libgtk3.0 3.0.12-1 and libwxgtk 2.8.10-3.1.

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Some annoying symbols-browser issues
« Reply #10 on: August 02, 2011, 05:14:04 pm »
Works well in here.
Quote
Project's base path: /home/loaden/DengYC/Projects/baby/
Project's common toplevel path: /home/loaden/DengYC/Projects/baby/
Caching GCC dir: /usr/include/c++/4.5
Caching GCC dir: /usr/include/c++/4.5/x86_64-linux-gnu
Caching GCC dir: /usr/include/c++/4.5/backward
Caching GCC dir: /usr/local/include
Caching GCC dir: /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/include
Caching GCC dir: /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/include-fixed
Caching GCC dir: /usr/include/x86_64-linux-gnu
Caching GCC dir: /usr/include
Passing list of files to batch-parser.
Header to parse with priority: '/usr/include/c++/4.5/cstddef'
Add 1 priority parsing file(s) for project 'baby'...
Added 1 file(s) for project 'baby' to batch-parser...
Create new parser for project 'baby'
Starting batch parsing for project 'baby'...
NativeParser received parser end event.
Project 'baby' parsing stage done!
Project 'baby' parsing stage done (94 total parsed files, 4181 tokens in 0 minute(s), 0.279 seconds).
Updating class browser...
Class browser updated.
CodeCompletion received parser end event.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Some annoying symbols-browser issues
« Reply #11 on: August 02, 2011, 06:11:58 pm »
it also works fine with the build from my repo, but still fails if build C::B on my working system.
I just recompiled C::B with gcc 4.5 instead of 4.6, but the not-catch-the-parser-events-issue remains.

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Some annoying symbols-browser issues
« Reply #12 on: August 02, 2011, 06:47:25 pm »
it also works fine with the build from my repo, but still fails if build C::B on my working system.
I just recompiled C::B with gcc 4.5 instead of 4.6, but the not-catch-the-parser-events-issue remains.
Try to remove the default.conf

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Some annoying symbols-browser issues
« Reply #13 on: August 02, 2011, 09:45:56 pm »
it also works fine with the build from my repo, but still fails if build C::B on my working system.
I just recompiled C::B with gcc 4.5 instead of 4.6, but the not-catch-the-parser-events-issue remains.
Try to remove the default.conf
It does not change anything, but I don't know what the default.conf should have to do with event handling.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Some annoying symbols-browser issues
« Reply #14 on: August 02, 2011, 11:09:33 pm »
The attached patch seems to fix the event-handler issue and should not break anything other.

Can you please test it ?

It does not fix the incorrect parsing of multiple projects in one workspace.

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Some annoying symbols-browser issues
« Reply #15 on: August 03, 2011, 03:43:06 am »
The attached patch seems to fix the event-handler issue and should not break anything other.
Can you please test it ?
It's works. But why? It's wxWidgets's bug?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Some annoying symbols-browser issues
« Reply #16 on: August 03, 2011, 05:39:56 am »
The attached patch seems to fix the event-handler issue and should not break anything other.
Can you please test it ?
It's works. But why? It's wxWidgets's bug?
I have the same question hare, the patches seems only convert the event-handler map from static macro definition to dynamically linked style, are there much difference on propagate messages? I guess it is a bug in Linux version of wxWidgets. :D
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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re: Some annoying symbols-browser issues
« Reply #17 on: August 03, 2011, 07:04:01 am »
It's works. But why? It's wxWidgets's bug?

I have the same question hare, the patches seems only convert the event-handler map from static macro definition to dynamically linked style, are there much difference on propagate messages?

It's not a bug, but a matter of ordering the event handling. In fact, the wx guys really encourage to use this method (see here: http://wxwidgets.blogspot.com/2007/01/in-praise-of-connect.html). I am using it all the time in my personal projects and once you get used to it it's really quite handy. Especially the ability to switch the event propagation temporarily off for certain reasons is nice.


So I think we can safely apply Jens' patch.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Some annoying symbols-browser issues
« Reply #18 on: August 03, 2011, 07:13:57 am »
It's works. But why? It's wxWidgets's bug?

I have the same question hare, the patches seems only convert the event-handler map from static macro definition to dynamically linked style, are there much difference on propagate messages?

It's not a bug, but a matter of ordering the event handling. In fact, the wx guys really encourage to use this method (see here: http://wxwidgets.blogspot.com/2007/01/in-praise-of-connect.html). I am using it all the time in my personal projects and once you get used to it it's really quite handy. Especially the ability to switch the event propagation temporarily off for certain reasons is nice.


So I think we can safely apply Jens' patch.
Jens' patch indeed solve the problem, but I still believe its a bug in wx, because there is no reason that the event_table way does not work. (although wx guys use/suggest dynamical way, but the static event_table way should always work), and looking at c::b's source, there are many event_table usages. :D
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 Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Some annoying symbols-browser issues
« Reply #19 on: August 03, 2011, 07:18:03 am »
Jens' patch indeed solve the problem, but I still believe its a bug in wx, because there is no reason that the event_table way does not work. (although wx guys use/suggest dynamical way, but the static event_table way should always work), and looking at c::b's source, there are many event_table usages. :D
I have the same point!

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re: Some annoying symbols-browser issues
« Reply #20 on: August 03, 2011, 07:20:13 am »
I have the same point!
That might be true, but in fact you are doing 2 different things here. But I guess the wx guys can explain better - why not asking in the wx forums?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Some annoying symbols-browser issues
« Reply #21 on: August 03, 2011, 07:24:36 am »
I have the same point!
That might be true, but in fact you are doing 2 different things here. But I guess the wx guys can explain better - why not asking in the wx forums?
I think I can't. Because my poor English. I can't explain this clear.
 :D

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re: Some annoying symbols-browser issues
« Reply #22 on: August 03, 2011, 07:26:17 am »
I think I can't. Because my poor English. I can't explain this clear.
And I just realised that for some obscure reason the wx shadownet forum seems gone?! Have they moved to a new place and I didn't get it? :shock:

EDIT: And what the hell is this:
http://forum.wxwidgets.org/
???
« Last Edit: August 03, 2011, 07:32:55 am by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Some annoying symbols-browser issues
« Reply #23 on: August 03, 2011, 07:41:34 am »
I think I can't. Because my poor English. I can't explain this clear.
And I just realised that for some obscure reason the wx shadownet forum seems gone?! Have they moved to a new place and I didn't get it? :shock:

EDIT: And what the hell is this:
http://forum.wxwidgets.org/
???
The movement takes several days ago. :D, and the old domain name was expired, at that time, the wx forum has encountered a crash and recovery. (I'm subscribed to the wx-maillist under my thunderbird).
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 danselmi

  • Developer
  • Almost regular
  • *****
  • Posts: 205
Re: Some annoying symbols-browser issues
« Reply #24 on: August 03, 2011, 07:51:47 am »
I think I can't. Because my poor English. I can't explain this clear.
And I just realised that for some obscure reason the wx shadownet forum seems gone?! Have they moved to a new place and I didn't get it? :shock:

EDIT: And what the hell is this:
http://forum.wxwidgets.org/
???
that's the wrong link. The right one is http://forums.wxwidgets.org.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re: Some annoying symbols-browser issues
« Reply #25 on: August 03, 2011, 08:08:48 am »
that's the wrong link. The right one is http://forums.wxwidgets.org.
Darn! The missing "s" leads to this strange page...?! WTF?! :?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ