tags:

views:

127

answers:

4

Hi,
For dissecting/understanding huge template-heavy code base it would really useful to have a tool that tells me what class/code have made it to the final binary.

For example if there are two class A and B in the code but I only end up instantiating only A then I would somehow like to know filter out B. Are there any tools to achieve the same with template-based code.

Thanks. Sandeep

+1  A: 

run doxygen to generate referral graph and see what class is not been referred

aaa
A: 

You can try using nm:

The nm utility shall display symbolic information appearing in the object file, executable file, or object-file

although using it and wading through its output is not very fun.

As a different approach, is it not possible to start browse/read/understand the caller code first to note down the classes that are used/included?

ArunSaha
many templates will get inlined and wont come up in nm
aaa
@aaa carp Sandeep might want to compile without optimization, then
dublev
+1  A: 

Use some profiler/code coverage tools. Some versions of MS Visual Studio ship with profiler. Then there are several commercial profilers/coverage tools like Intel VTune. On *nix with GCC there is the gcov.

wilx
A: 

See my answer to the question i asked recently on SO.

The idea is to compile your code after having enabled the "showIncludes" compiler option, then deal with output to extract the information you need (either manually or automatically, using a python script, for example).

Doing this, i have been able to extract the exact code files that are used to build our software.

Benoît