Debugging a program which makes heavy use of templates has been a
little frustrating. Since then entire definition of a template must be
available to the compiler whenever the template is instantiated (for
GCC anyway), the
template declaration and definition both end up in a header file. For
some reason, gdb can't find the
header files where these templates are defined, even though the .cc
files are in the same directory. When one needs to step through
template code, that is rather annoying.
Fortunately, there is an easy solution. The gdb command 'dir PATH'
where PATH is the path to your source files tells gdb where to find
the header files, and everything works fine after that.
gdb history is not set up by default on Debian. Fortunately, that is easy to fix
too. Add the following to your ~/.gdbinit file:
set history save on
set history expansion on
Merry Christmas and Happy Debugging, er, Holidays.