c/c++ source code browser comparison, seeking opin

2020-05-19 02:25发布

问题:

Recently our team inherited a huge code base, about 1 gigabyte c/c++ source codes. The core part (which we may actually modify or update from time to time) is about 650MB and 57,000 files. So I got a perfect test case to see which source code browsers are actually as good as they claim. Following are my test results and I would like to see other opinions. I know this topic had been raised several times in stackoverflow, but I am not satisfied with any of their answers (or maybe I missed some, if this is the case please let me know). BTW, by source code browser I mean it can help you find class/function definition easily; show call tree, cross reference, something like that.

  1. visual c++ 2010 express edition (the free one). Too bad, it does not bother to do any analysis work just complains it can't find the head files. BTW, that's why I never like visual c++; it always wants you to do things in its way instead of making things easier for you.

  2. source navigator. I used source navigator couple of years ago. And I found out that it is under development again with the new name source navigaor NG, so I decided to give it a try. Too bad, with 650MB codes adding to project, it just went dead.

  3. Understand C++. I saw someone recommended understand c++ here so I also gave it a try. Not good too. With 1G files added to its project, it went dead too. With 650MB, it can work but not impressed. Since it is a commercial tool I just passed it.

  4. code block. 1G files will make it dead but with 650MB it can work. It can't automacticlly show the function definition when your mouse points to a function (like source insight and slickedit do), but it can find the function defition most of time(the good news) when you right click a function and choose the pop up menu item "go to function definition". The bad news is that when I close the project and open it again it still takes a long time to load.

  5. codelite. codelite looks like code block(after all they both use wxWidget). But I find codelite is better than code block because when I re-open the closed project it loads much quicker than code block(with 650MB files). It can find function definitions too with pop-up menu. So if someone wants to choose a free c/c++ IDE my vote goes for codelite.

  6. cscope. When I worked for motorola GSM department we used cscope and there were million lines of codes. But the problem is that none of my team memebers are good at vim or emacs and we just want an IDE that make our lives easier (I guess these remarks may piss someone off. Sorry for that)

  7. source insight. Of course my test won't miss source insight. And source insight does its work pretty good. But its UI is kind of "ugly" and it does not support unicode. That is too bad.

  8. slick edit. In my test slick edit and source insight are the only 2 tools that can handle 1G files and show function defintion automaticlly when you point to a function and provide function completion when you are typing. In my opinion the UI of slick edit is way much better than source insight. The only problem I have is that none of them provide code folding (while the free one like codelite and codeblock provides). One correction here: slickedit actually does have code folding (with selective display at view menu), it is just not that obvious, you have to set your selective display first!

I do not try the java based IDE like eclispe CDT or netbean because I do not think they can handld 1G files.

So to summarize what I have done I will say if you want a commercial tool, my vote goes for slickedit (This is not a sells pitch. I am not in any way related to slick edit); if you want a free one, codelite definitely.

But I would like hear others opinion.

回答1:

Another possibility (which take time and effort, but for such large code base, it is worth it) is to develop your own GCC plugin or extension to explore your particular code. The recent plugin ability in GCC enables power user to customize the behavior of the GCC compiler for their particular needs.

In particular, you might want to use GCC MELT, which is a high level domain specific language designed for GCC extensions. (MELT is implemented as a GCC plugin, it is free software, GPLv3+ licensed).

Disclaimer, I am the main author of GCC MELT, but I would be delighted to help you.

Basile Starynkevitch



回答2:

We have a similar problem (1GB code base, 15k files) and actually Eclipse CDT works for us, if you give it enough memory. 1GB RAM dedicated for Eclipse seems to be the sweet spot.



回答3:

If your problem is just searching the code, maybe our Source Code Search Engine will help. This tool indexes your code base using the language structure (lexemes), and then provides a facility to search the code base using that index, providing a GUI for composing queries, showing matches to the queries, and showing the actual code matched for any selected query.

It works for many languages, including C++. And it seems to be pretty useful on code bases like Linux, which is sort of the size you seem to have. The search capabilities arguably make it any easy way to "browse" the code.

I'll grant this this suffers identically from my objection to Doxygen (see comment in another answer). But then, it doesn't pretend to do name resolution at all.



回答4:

Try doxygen with call and collaboration diagrams enabled. It should work fine even for large projects.