How to correctly rebuild a C++ project as a Debug using CMake for further profiling with Valgrind?

47 Views Asked by At

I have a C++ project that I previously built using CMake. Now I need to rebuild it as Debug so that I can profile it with Valgrind to find code bottlenecks. However, I have a problem with the rebuild.

I go to the root directory with the project: cd MyProj Later I start the process of building and installing the project:

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/home/user/Desktop ..
make -j4 install

After that I rebuild the project as a Вebug in the following way:

cd ..
mkdir Debug
cd Debug
cmake -DCMAKE_BUILD_TYPE=Debug ..
make

After rebuilding, I run the project for profiling with Valgrind: valgrind --tool=callgrind ./MyProg But in the resulting file there are no functions of my project, i.e. Valgrind does not see them (see screenshot). I suspect that this is because I rebuilt the project incorrectly as a Debug. Please help me with rebuilding the project as a Debug for further profiling, as I have just started doing this and need some help. Valgrind does not see my project functions

0

There are 0 best solutions below