Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is the solution that works for me.</p> <p>Download ( <a href="http://www.gnu.org/software/gdb/download/" rel="noreferrer">http://www.gnu.org/software/gdb/download/</a>) and install latest gdb (i.e. with --prefix $HOME). It supports python scripting.</p> <p>Get python pretty printers by executing</p> <blockquote> svn co svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python </blockquote> <p>in a directory of your choice (i.e. $(HOME)/distribs/gdb_printers). You will get 'python' subdirectory in the checkout directory. </p> <p>Put this in your $(HOME)/.gdbinit file with proper path to pretty printers:</p> <pre><code>python import sys sys.path.insert(0, '/home/YOUR_NAME_HERE/distribs/gdb_printers/python') from libstdcxx.v6.printers import register_libstdcxx_printers register_libstdcxx_printers (None) end </code></pre> <p>This makes pretty printing usable via command-line interface of gdb (<code> >(gdb) p my_std_string</code>). </p> <h2>Next explains usage while debugging in Eclipse.</h2> <p>Download ( <a href="http://download.eclipse.org/eclipse/downloads/" rel="noreferrer">http://download.eclipse.org/eclipse/downloads/</a>) latest Stream Stable Build or Release of Eclipse (>=3.7 version).</p> <p>Download ( <a href="http://download.eclipse.org/tools/cdt/builds/8.0.0/index.html" rel="noreferrer">http://download.eclipse.org/tools/cdt/builds/8.0.0/index.html</a> for Eclipse Indigo or <a href="http://www.eclipse.org/cdt/downloads.php" rel="noreferrer">http://www.eclipse.org/cdt/downloads.php</a> for Eclipse Juno) latest Eclipse C/C++ Development Tooling (Eclipse CDT).</p> <p>Run Eclipse and chose workspace directory where your options will be stored (i.e. $HOME/projects). Click Help->Install New Software... Click Add...->Archive... and choose the CDT build that you've just downloaded. Then you must choose components to install: click CDT Main Features -> C/C++ Development Tools (and possibly other components of your choice). Then proceed with installation and restart Eclipse.</p> <p>Specify proper location of gdb and .gdbinit in Eclipse and make sure the Pretty Printing option is enabled:</p> <pre><code>Window -&gt; preferences -&gt; C/C++ -&gt; Debug -&gt; GDB </code></pre> <p>Now you can see STL containers pretty-printed in Variables view while debugging in Eclipse.</p> <p>Other commands can be used to make gdb output more decent:</p> <pre><code>set print pretty on set print object on set print static-members on set print vtbl on set print demangle on set demangle-style gnu-v3 set print sevenbit-strings off </code></pre> <p>UPDATE: Regarding getting it to work for old projects, see point 4) in rustyx answer below.</p> <p>UPDATE2: ubuntu 12.04 has libstdc++6-4.6-dbg that installs /usr/share/gcc-4.6/python/libstdcxx/ python module for you </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload