What is a good tool to aid in browsing/following C

2019-02-01 17:40发布

I sometimes need to modify OSS code or other peoples' code (usually C-based, but sometimes C++/Java) and find myself "grep"ing headers for types, function declarations etc. as I follow code flow and try to understand the system. Is there a good tool that exists to aid in code browsing. I'd love to be able to click on a type and be taken to the declaration or click on a function name and be taken to it's implementation. I'm on a linux box, so replies like "just use Visual Studio" won't necessarily work for me. Thanks!

27条回答
Bombasti
2楼-- · 2019-02-01 18:22

I've heard amazing things about OpenGrok. I know another team at my place of employ uses it and they find it very handly. From its web site:

OpenGrok is a fast and usable source code search and cross reference engine. It helps you search, cross-reference and navigate your source tree. It can understand various program file formats and version control histories like Mercurial, Git, SCCS, RCS, CVS, Subversion, Teamware, ClearCase, Perforce and Bazaar. In other words it lets you grok (profoundly understand) the open source, hence the name OpenGrok. It is written in Java.

查看更多
狗以群分
3楼-- · 2019-02-01 18:22

cscope has always been my favorite. There is also cbrowser, but I have not tried it. ctags is also used a lot.

查看更多
该账号已被封号
4楼-- · 2019-02-01 18:22

I use and like the free software tool GNU global.

查看更多
霸刀☆藐视天下
5楼-- · 2019-02-01 18:23

I do a bit in the kernel space, and keep coming back the scope.

For example:

$ cd /usr/src/redhat/BUILD/kernel-version

$ cscope -R -p4

   Find this C symbol:
   Find this function definition:
   Find functions called by this function:
   Find functions calling this function:
   Find this text string:
   Change this text string:
   Find this egrep pattern:
   Find this file:
   Find files #including this file:

I usually "live" in c-scope when working on someone elses project. I use this to open files with "gvim" (my IDE), edit things, then quit "back" to c-scope, It helps me keep task focused.

I believe that cscope can be configured to work with vim and emacs, although I've seen people use other editors also.

Best of luck to you.

查看更多
Evening l夕情丶
6楼-- · 2019-02-01 18:29

The Eclipse IDE is capable of working with C/C++ in addition to Java. There is a write-up on how to configure Eclipse for C/C++ development on IBM's Developer Works site.

edit: Why has this been voted down? It is a valid answer. Eclipse with the C/C++ addon will allow the question author to do what he is wanting to do. I am not the only one to have suggested, yet the others have not been voted down. So why has this one been voted down?

查看更多
在下西门庆
7楼-- · 2019-02-01 18:30

You can't get anything better than SourceInsight.

查看更多
登录 后发表回答