This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Adding support for pretty printing of 2D arrays
- From: Morten Olsen Lysgaard <morten at lysgaard dot no>
- To: gdb at sourceware dot org
- Date: Thu, 17 Apr 2014 14:06:54 +0200
- Subject: Adding support for pretty printing of 2D arrays
- Authentication-results: sourceware.org; auth=none
Hi, lately I have been working with the C++ Eigen [1] linear algebra
template library.
Naturally Eigen has data structures for Matrices. Currently when
pretty printing these the content is shown in the following way.
A matrix
M = [1 2
3 4]
would be pretty printed in the following way
[0,0] = 1, [0,1] = 2, [1,0] = 3, [1,1] = 4
which is better than the "array" pretty pretty printing hint which gives just
1 2 3 4
I would like to know if it makes sense to add 2D, and possibly a
n-dimensional, array pretty printing hint and logic?
If so I would like to invest some time to implement this.
The rationale behind such a feature is to simplify debugging numerical
code using data structures of the kind
struct matrix {
int rows;
int cols;
double *data;
};
which, at least in my field, are very normal.
[1] http://eigen.tuxfamily.org/
Have a nice day! - Morten