tehrengruber / LLDB-Eigen-Data-Formatter

LLDB Data Formatter for dense matrices and vectors of the Eigen library
GNU General Public License v3.0
42 stars 9 forks source link

adding support for dynamic data types #2

Closed randi120 closed 6 years ago

randi120 commented 7 years ago

@tehrengruber nice script. I needed dynamic size support (#1). I tested it with basic types:

    Matrix<double, 1, 2> t; t.fill(1);
    Matrix<uint, 2, 2> t2; t2.fill(2);
    MatrixXd t3;  t3.setOnes(3,3);
    Vector3f t4; t4.fill(4);
    Vector3i t5; t5.fill(5);
    VectorXd t6(6); t6.fill(6);

Should be working. (lines 56-58 should have some check for validity)

tehrengruber commented 7 years ago

First of all thanks for sharing this. I'm too busy right now to review this in detail, but one thing I (might) have spotted was that your check whether the given Eigen type is of fixed size or dynamic is not very robust. You might get an expression template that has a different memory layout than that of simple matrices/vectors. In that case we should fall back to the LLDB's default printer. I didn't check this but I assume that since expressions like auto a = Eigen::VectorXd::Ones(10).dot(Eigen::VectorXd::Ones(10)) are not supported currently (stay tuned for https://github.com/tehrengruber/Defrustrator which will support this) your code will fail and should as such fall back correctly to the default printer.

tehrengruber commented 6 years ago

Since all ways to determine what type of Eigen object we have (e.g. an expression template) I can come up with are not really maintainable I'll accept your pull request. Thanks for your work.