Re: [eigen] gdb Eigen Pretty printers |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] gdb Eigen Pretty printers
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Tue, 8 Dec 2009 10:17:07 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=hveS9VKmyHQF8J2Aes1/uhNqYM9mJw6/cKUczSBR+nk=; b=HYB6xQb+VS5IGjF8Rou59E7bi0Di8HO3fR2xmzy06DocDm9lwIFoWomfc8rEq88e8m mUNbBqD9EH0ILFZ01uxeYcmV6eX6JlKU9oRAK8cjgTFhnqs6AJRev1HTHDXkzAzavUfz YvBGETdVdKfh6+oEbigw6Bf6xz0ParLoOvMwA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=eQloBkgU9lzRkcTil5KXEnQOiJnpsZUOrnPN+56eLKXB2k0K8a+CFplf2yz3XSvJMP OORBj4gbqXYKr8fNgRMPnNzzZdkWwaoNebt3oyyisHZ0QF+XhVmujhymsfYjyw3+0KNL dr7w64HQGOGeGZB4Xil+d7Td2XX4cb6SdmXsY=
Hi,
2009/12/8 Benjamin Schindler <bschindler@xxxxxxxxxxx>:
> Hi
>
> Finally a real contribution to eigen - it was about time. I just wrote a
> pretty printer for Eigen::Matrix gdb-7.0 and later.
Very nice!
>
> To use it:
>
> * create a directory and put the file as well as an empty __init__.py in
> that directory
> * Create a ~/.gdbinit file, that contains the following:
>
> python
> import sys
> sys.path.insert(0, '/path/to/eigen/printer/directory')
> from printers import register_eigen_printers
> register_eigen_printers (None)
> end
I tried it on the attached file a.cpp,
$ g++ a.cpp -I ../eigen -o a -g3
$ gdb ./a
> start
> step
(then press Enter several times)
But eventually I get this python error message:
(gdb)
main () at a.cpp:13
13 f(m,n);
(gdb)
f (m=Traceback (most recent call last):
File "/home/bjacob/cuisine/printers.py", line 105, in lookup_function
return pretty_printers_dict[function](val)
File "/home/bjacob/cuisine/printers.py", line 80, in <lambda>
pretty_printers_dict[re.compile('^Eigen::Matrix<.*>$')] = lambda
val: EigenMatrixPrinter(val)
File "/home/bjacob/cuisine/printers.py", line 24, in __init__
m = regex.findall(tag)[0][1:-1]
TypeError: expected string or buffer
...., n=Traceback (most recent call last):
File "/home/bjacob/cuisine/printers.py", line 105, in lookup_function
return pretty_printers_dict[function](val)
File "/home/bjacob/cuisine/printers.py", line 80, in <lambda>
pretty_printers_dict[re.compile('^Eigen::Matrix<.*>$')] = lambda
val: EigenMatrixPrinter(val)
File "/home/bjacob/cuisine/printers.py", line 24, in __init__
m = regex.findall(tag)[0][1:-1]
TypeError: expected string or buffer
....) at a.cpp:7
7 m = m * n;
Any idea?
> Notes:
>
> - It currently only supports Eigen::Matrix and no other type (such as
> quaternions etc). Patches welcome :)
> - I wrote it using the stable branch of eigen. I don't know whether it
> works with hg
> - It's still kind of hacky, mostly because of the limitations of the
> gdb.python framework
OK
>
> It seems that the gdb hackers want the pretty printer scripts included
> in the respective patches, so my final goal would be to have it in eigen-hg
I don't understand what you mean by "in the respective patches" ?
I agree that this is worth having in Hg. Maybe we should create a
top-level directory "debug" with a subdirectory "gdb" containing your
stuff. Then Hauke's work would go into another subdirectory "msvc".
Each would have a short README file, so Hauke's documentation on the
wiki could go there, or could be linked to from there. Opinions?
Benoit
#include <Eigen/Eigen>
using namespace Eigen;
void f(Matrix2d& m, Matrix2d& n)
{
m = m * n;
}
int main()
{
Matrix2d m, n;
f(m,n);
}