Search code examples
debugginggdbcmakemidori

not able to get correct source path in gdb


I have a project checked out from midori repository. I want to debug the project using gdb after build but when I tried to put breakpoint on a source file, gdb doesn't identify that.

This is my Cmakelist.txt file https://github.com/shashwat001/midori-modified/blob/master/CMakeLists.txt.

As instructed here http://midori-browser.org/contribute/#build_the_code . I created _build folder and from inside that I run cmake and then make. Then the executable to run midori was _build/midori/midori.

From source folder, I run

gdb _build/midori/midori

Then put breakpoint to file midori/midori-panel.c

break midori/midori-panel.c:350

Then following error was shown: No source file midori-panel.c

Do I need to make any change to Cmake file to enable that or I need some other syntax.


Solution

  • You need to build your binary in debug mode. See example 1 and example 2.

    cd build/your_project/debug;
    cmake path_to_project_srcs -DCMAKE_BUILD_TYPE=DEBUG