How to use gdb on c++ header files?

What I've found is that is that the file names are sometimes shortened. Using info sources I was able to find the shortened name that GCC used. When I set the breakpoint using the shortened file name, GDB correctly set the breakpoint.

For example the file CommonLibrary\headers\Endian.h was changed to COM~2\headers\Endian.h

This on Windows 10, running mingw-64.


As suggested by https://stackoverflow.com/users/760746/nobody, one way to make sure the header to be in the sources is to veryfy it by checking

info sources

After ensuring the header itself be in the sources(in my case, the problem is that the case of a letter in the header name was mixed up, and somehow it went through the compiling on my mac book), inserting breakpoint in lines of a header file works just fine.


Try to use break with your class/method name like this:

break  class::method