Re: [eigen] plea for a new feature to help debugging

[ Thread Index | Date Index | More Archives ]

I was going to be the same: this is the way that our asserts are meant
to be used.

Like this:

g++ myprogram.cpp -g3 -I eigen -o myprogram

$ gdb ./myprogram
> run
Program received SIGABRT, "oops ! you did an out-of-range coeff access!"
> backtrace
there goes your whole backtrace, will all the local variables and
debug info you could ask for :)


2011/2/4 Matthieu Brucher <matthieu.brucher@xxxxxxxxx>:
> Hi,
> This is correct, as macro expension occurs before the code is compiled and
> this before the function is inlined.
> Current debuggers can stop when an exception is raised/..., and in this
> case, you would have a complete traceback of what actually happened. So I
> suggest you try those tools, because there are far better than logs.
> Matthieu
> 2011/2/4 Helmut Jarausch <jarausch@xxxxxxxxxxxxxxxxxxx>
>> Hi,
>> I know all developers of Eigen are busy due to bug fixing for Eigen3.
>> Still I want to start a discussion about a new feature for Eigen.
>> If an index to a matrix is out-of-range, one doesn't get any
>> information where this occurred. This is a restriction of C++
>> since it seems impossible to get the value of the __LINE__ macro at the
>> line where an inline function is expanded.
>> But it would be helpful to know the name of the matrix whose index was
>> out-of-range. To do this one needs an additional constructor parameter
>> 'Name' which is defaulted to say 'NoName'. The matrix class would have
>> an additional string variable 'ID' which can be used for the error
>> message given to the exception object.
>> Of course, this additional variable ID would be present in the
>> DEBUG case (i.e. EIGEN_NO_DEBUG is undefined), only.
>> Usage:
>> VectorXi  T(5,"T");  // second parameter is ignored if EIGEN_NO_DEBUG
>> This would be very help, esp. for beginners.
>> Helmut.
> --
> Information System Engineer, Ph.D.
> Blog:
> LinkedIn:

Mail converted by MHonArc 2.6.19+