A tool for determining the origin of a symbol in C

I'm looking for a tool that, given a bit of C, will tell you what symbols (types, precompiler definitions, functions, etc.) are used from a given header file. I'm making a port of a large driver from Solaris to Windows, and figuring out where this is coming from is getting tricky, so it will be a huge help. Any ideas?

Edit: Not an absolute requirement, but tools that run on Windows would be a plus.

Edit # 2: To make it clear what I am trying to do, I have a codebase that I am trying to hook up, which results in a lot of headers. What I would like is a tool that, given foo.c, will tell me what characters it uses from bar.h.

0


source to share


4 answers


I love KScope , which handles very large projects.



KScope http://img110.imageshack.us/img110/4605/99101zd3.png

+1


source


I am using both Linux and Windows: gvim + ctags + cscope .
The same environment will work on Solaris as well, but that of course forces you to use vim as your editor, I'm sure emacs can work with both ctags and cscope. You can try trying vim, it's a little tricky at first, but soon you won't be able to work any other way. Most efficient editor (IMHO).

A comment:

Have a look at the cscope man :

...

Find functions that call this function:
Find functions that call this function:

...

I think this is exactly what you are looking for ... Please clarify if not.

Replay comment 2:



OK, now I understand you. The tools I have suggested can help you understand the code flow and find a specific symbol there, but not what you are looking for.

Not what you are asking for, but as we speak, I have experience with porting and drivers (feel free to ignore)

The compiler seems to be good enough for your task. You just start with the original file and let the compiler find the missing part, it will be a lot of empty stubs and you will get your code compiled.

At least to begin with, I suggest you create a lot of stubs and change the source code as little as possible, and then, once you get it working, you can optimize.

This can be more complicated depending on the type of driver you are porting (the kernel driver, I assume), Windows and Solaris subsystems are not that similar. We have a driver that works with both solarium and windows, but it was developed from the start with multiple platforms.

+1


source


Try doxygen , it can generate graphics and / or HTML and is easy to customize

0


source


emacs

and . etags

And I use make to run the tag indexing for me --- this way I can index a large project with a single command. I've been thinking about creating a master index and individual modules, but haven't implemented it yet ...


@ Ilya : Will a pistol at dawn be acceptable

0


source







All Articles