Domanda

We have a project with a lot of code, part of it is legacy. As part of the work flow, every once in a while, all the functionality of the product is checked. I wonder if there is a way to use this fact to dynamically check which parts of the code were never used? (The difficult part is the C++ code, the .Net and Java are more under control and have less legacy).

Also - are there dynamic dead code elimination tools are there that can work with lots of code and complex projects (i.e. ~1M lines)?

All the similar questions I found talked about static analysis which we all ready do.

Thank you!

È stato utile?

Soluzione

You might want to look at the code coverage tools that are used in testing. The idea of these tools is that they instrument the code and after running the set of tests you know what lines of code were executed at least once and what lines were never executed. After that you can improve tests.

The same thing can be used to identify dead code in case if you have diverse enough execution environment.

Altri suggerimenti

I don't know what platform you are on but we have used Gcov with success if you're compiling with the gnu toolchain:

http://gcc.gnu.org/onlinedocs/gcc/Gcov.html

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top