Drake: debugging visualizers for eigen matrices?

Created on 3 Oct 2016  ·  10Comments  ·  Source: RobotLocomotion/drake

The discussion about matlab vs c++ brought up this idea: can we find a better way to visualize Eigen matrices in the c++ IDE debuggers? The ability to quickly inspect the contents of a matrix-valued variable is one major advantage of working in the matlab debugger (changing those values with the interactive shell is another, and is possible but only to an extent in the c++ debuggers).

A quick search turned up this capability for MSVC:
http://eigen.tuxfamily.org/index.php?title=Developer%27s_Corner#Debugging_under_Visual_Studio

Can we achieve something similar for our linux/mac tools? Selfishly I’d like one for CLion.

Found a page where someone asked about custom debug visualizers for CLion, and the response was “Because CLion uses GDB as a debugger now, you can provide a custom GDB extension and set it in gdbinit.”. CLion uses LLDB by default, I think, but can use GDB also. @tkoolen gave mex debugging instructions for LLDB in the CLion docs. I’d be inclined to stick with it.

It looks like this is possible in LLDB as well. http://lldb.llvm.org/varformats.html

low dynamics feature request

Most helpful comment

I did indeed. You can give this a try:

https://github.com/SeanCurtis-TRI/drake_gdb

If you encounter problems or feel there are missing features, let me know.

All 10 comments

Thanks for looking into this, I never figured this out and it will be very useful.

Related CLion issue: https://youtrack.jetbrains.com/issue/CPP-1798 (please vote for CLion issues if you want them to prioritize something). Probably not 100% necessary given the installation instructions above, but would still be very nice to have for other, non-Eigen types. I believe they did just add (predefined, not custom) pretty printing of STL containers.

CLion uses lldb by default on OSX, and gdb by default on linux. You have the option to use either debugger on either platform, but lldb on linux is currently experimental I believe.

Mathworks actually broke the mex file debugging as described in those instructions in ~2014b. I opened an issue with them, but they didn't take any action to fix it. We should probably just get rid of those instructions; I'll open an issue.

Funny- we were independently looking for a solution in CLion for this problem this morning. I think the simplest answer is a CLion plugin for Eigen inspection. I could invest some time in this if folks have not already moved on.

That would be great if it's not too much work!

i'm on mac, so was definitely going to try the LLDB viewer, but have not done it yet. by all means, beat me to it.

Ok, will work on it this week.

@SeanCurtis-TRI -- didn't you contribute some know-how, and perhaps even code, along these lines? (but i couldn't find it on slack nor github on a quick search)

I did indeed. You can give this a try:

https://github.com/SeanCurtis-TRI/drake_gdb

If you encounter problems or feel there are missing features, let me know.

I just wrote a LLDB pretty printer for Eigen
https://github.com/fantaosha/LLDB-Eigen-Pretty-Printer

It has all features as the GDB-Eigen-Pretty-Printer https://github.com/RLovelett/eigen/tree/master/debug/gdb

I think the solutions posted here are as much as we'll have for now. Thanks! Closing this one.

Was this page helpful?
0 / 5 - 0 ratings