title: Debugging Best Practices for C++ STL/Boost with gdb
body: <p>Debugging with gdb, any c++ code that uses STL/boost is still a nightmare. Anyone who has used gdb with STL knows this. For example, see sample runs of some debugging sessions in code <a href="http://www.yolinux.com/TUTORIALS/GDB-Commands.html#STLDEREF" rel="noreferrer">here</a>. </p>
  
  <p>I am trying to reduce the pain by collecting tips. Can you please comment on the tips I have collected below (particularly which ones you have been using and any changes you would recommend on them) - I have listed the tips is decreasing order of technicality. </p>
  
  <ul>
  <li>Is anyone using <a href="http://www.stanford.edu/~afn/gdb_stl_utils/" rel="noreferrer">"Stanford GDB STL utils"</a> and <a href="http://www.yolinux.com/TUTORIALS/src/dbinit_stl_views-1.01.txt" rel="noreferrer">"UCF GDB utils"</a>? Is there some such utils for boost data structures? The utils above do not seem to be usable recursively, for example for printing vector of a boost::shared_ptr in a legible manner within one command. </li>
  <li>Write your .gdbinit file. Include, for example, C++ related beautifiers, listed at the bottom of UCF GDB utils. </li>
  <li>Use checked/debug STL/Boost library, such as STLport. </li>
  <li>Use logging (for example as described <a href="http://www.ddj.com/cpp/201804215" rel="noreferrer">here</a>) </li>
  </ul>
  
  <p><em>Update</em>: GDB has a <a href="http://sourceware.org/gdb/wiki/ProjectArcher" rel="noreferrer">new C++ branch</a>. </p>