Re: [eigen] Displaying an Eigen object during debugging? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Displaying an Eigen object during debugging?
- From: Ricard Marxer <ricardmp@xxxxxxxxx>
- Date: Thu, 6 Dec 2012 19:35:44 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=LxzeLAxZ9kat2elCWrNbm2Tm07ZwqtX0WpjY4ApdHGE=; b=DHcUmQ89A8+N3MXkxJwuqoKoSYPAbECPRHrogMaKU3406iuGuHa1J3CJpzr5GBoV2/ 6mz8aRKQafUPr9v1h2BuWNsSLA+oojYUoRI83HihXAFryeTN7pcPhEy1fht2KUWiYd1D V6adKXU4LV5sqatBEio79bNYBhmsH7D4nzJFVcTgtR1RODTtQkzbKH+EnzLUov7X3K61 ZkdXIa4f07WsIRHOWtXHMIP7x8SrV5t7zvDB+aV/fGtfWWYdY6u6VRVgPSOLidHczASF 8GxMZCejs4VmuvTBx1NZHj9EykMSa7sH2kufbGQ1onCTJcerKYffKaMVxfonHmDjBEXU 55UQ==
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.
Attachment:
eigentypes.py
Description: Binary data