I am trying to see the contents of an Eigen vector in the Locals and Expressions window of the QtCreator:
I see that it is a vector with 10 components:
but when I click it open I get:
I tried to use this script to do the trick. I saved it along with an empty __init__.py file into folder ~/Scripts/Eigen and created the .gdbinit file:
python
import sys
sys.path.insert(0, '/home/martin/Scripts/Eigen')
from printers import register_eigen_printers
register_eigen_printers (None)
end
I restarted QtCreator and nothing changed. I have checked the "read .gdbinit at startup" option in QtCreator settings and still nothing.
What is worrying me is that I know that in the past the viewing of Eigen objects worked without me meddling with some scripts.
Please, what am I doing wrong?
I am using:
gcc version 4.8.1
Ubuntu 13.10
gdb 7.6.1-ubuntu
Qt Creator 3.0.0
Based on Qt 5.2.0
and I am compiling using these flags:
g++ -c -pipe -gdwarf-4 -fvar-tracking-assignments -g
-Wall -W -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG
EDIT:
as @ggael suggested, I tried to run the gdb directly:
(gdb) run
Starting program: /home/martin/Projects/TestGrounds/test
Traceback (most recent call last):
File "/usr/lib/debug/usr/lib/i386-linux-gnu/libstdc++.so.6.0.18-gdb.py", line 59, in <module>
from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named 'libstdcxx'
Traceback (most recent call last):
File "/usr/lib/debug/usr/lib/i386-linux-gnu/libstdc++.so.6.0.18-gdb.py", line 59, in <module>
from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named 'libstdcxx'
And then:
(gdb) print vec
Python Exception <class 'TypeError'> 'map' object is not subscriptable:
Python Exception <class 'TypeError'> 'map' object is not subscriptable:
$1 = {<Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >> = {<Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >> = {<Eigen::DenseBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >> = {<Eigen::internal::special_scalar_op_base<Eigen::Matrix<double, -1, 1, 0, -1, 1>, double, double, false>> = {<Eigen::DenseCoeffsBase<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 3>> = {<Eigen::DenseCoeffsBase<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 1>> = {<Eigen::DenseCoeffsBase<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0>> = {<Eigen::EigenBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>},
m_storage = {m_data = 0x804e020, m_rows = 10}}, <No data fields>}
Please, could you explain what does this mean? What is libstdcxx?
.gdbinit
must be in your home (/home/martin/.gdbinit
). – Tote.gdbinit
in the path you suggest. – Atlantean