Re: [eigen] Displaying an Eigen object during debugging?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


If you use qtcreator and have gnuplot install you can use the dumper that I attach.

In order to use it do the following:
 - Copy it to some path (e.g. ~/dev/eigen/debug/qtcreator/eigentypes.py)
 - Set qtcreator to load that script when starting up GDB
   + Go to Tools > Options... > Debugger > GDB
   + Add the following line in the Additional Startup Commands field:
          interpreter-exec console "python execfile('/path/to/eigentypes.py')"

Now when you debug:
 - Right click on an Eigen variable in your Locals and Expressions
 - Choose Change local display format... > Gnuplot
 - If the variable is a 1D vector it will be displayed as a curve
 - If the variable is a 2D matrix it will be displayed as a heatmap

Note that due to a limitation in QtCreator (https://bugreports.qt-project.org/browse/QTCREATORBUG-7186) this only works with varibles of Eigen templated types or typedefs named MatrixXf, VectorXf, MatrixR, VectorR,... and some more that I added to the python script.  But it easy to extend to others.

PS: This script is really useful for me when debugging code using Eigen, but it is specific to QtCreator.  If the Eigen devs are interested there is no problem in adding it to the Eigen repo.




On Thu, Dec 6, 2012 at 7:07 PM, Helmut Jarausch <jarausch@xxxxxxxxxxxxxxxxxxx> wrote:
Hi,

what's the best technique to display the data elements of an (Eigen-) Vector or Array
during debugging (e.g. with ddd)

Many thanks for a hint,
Helmut.





--
ricard
http://twitter.com/ricardmp
http://www.ricardmarxer.com
http://www.caligraft.com

Attachment: eigentypes.py
Description: Binary data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/