Search code examples
c++debugginggdbvalgrindkcachegrind

Difference between two c++ programs


I have one C++ program with two versions, one version the feature is working but in other isn't. Is there a way to debug the difference between this two versions? Specifically, I'm using Linux and g++. Is there a way to use something like KCachegrind to view the difference Call graph? Or is something in gdb to view these function calls difference in a faster way?

Updating... The program is to big to view all the differences. Firstly i would like to know the path between function calls difference to after that i will have an option to do a diff command just in this functions.


Solution

  • Have you considered using gprof? Once you have it installed (I believe most majors distros have it by default) compile your code with the '-pg' option. When you run your executable, it will generate a gmon.out file that contains profiling information including a call graph.

    Have a look at this tutorial to get a better idea of how it works.