title: How can I make a C++ function that can pretty print every object, using gdb?
body: <p>In linux, with gdb debugger I can print every object if the program is compiled with <code>-g</code> option. Is it possible to write a function like</p>
  
  <pre><code>template&lt;typename T&gt; ostream&amp; to_stream(ostream&amp; out, const T&amp; obj);
  </code></pre>
  
  <p>that serialize my object with the name and type?</p>
  
  <p>Naturally with help of gdb call or system call or other.</p>