I have my complete source code in c++ on Windows. Is there any utility which can tell about each function- In which file it has has been defined/declared and what are start and end line number for that function?
-
Doxygen would give you the file and the starting line number. Does that help? – ToniBig Sep 12 '13 at 17:15
-
Could you explain when you want this information, is it for a runtime exception report or for a code analysis on the actual source code? – miltonb Sep 12 '13 at 19:46
1 Answers
I don't know any utility from top of my head (although I have a feeling that windbg or some debugger could list symbols in a fashion you want, see x ntdll!*
and .lines
command http://windbg.info/doc/1-common-cmds.html), which would do that out of the box, but maybe it's a piece of cake to write one which is closer to your requirements. Since you are in C++ land, maybe you are not faint-hearted to such thing. I assume, that you would compile a debug version of your source code, in which case the pdb should contain rich enough info, including precise line numbers.
Given that pdb file, you could extract information form it using DIA SDK. You want to enumerate symbols, and look at the functions.
More on the topic:
- Getting a List of Symbols Used by My VC++ Code
- How do I get the line number and path of a method from a pdb using .Net?
I don't know how tricky is to get the end line number, but in worst case you can estimate that from the closest start line number to the function.

- 1
- 1

- 10,021
- 5
- 75
- 121