【发布时间】:2019-05-31 19:37:18
【问题描述】:
我正在尝试使用 Eigen 对象上的条件断点来调试 GDB。例如,当我的向量中的任何值非零时,我想中断。我会在 GDB 中这样做:
break cpp/File.cpp:143 if (v != 0).any()
但是,这不起作用。 GDB 给出了这个:
Could not find operator!=
即使这是完全有效的语法。此外,像
这样的条件断点break cpp/File.cpp:143 if v[0] != 0
在 GDB 中给出这个错误:
Error in testing breakpoint condition:
Couldn't get registers: No such process.
An error occurred while in a function called from GDB.
Evaluation of the expression containing the function
(Eigen::DenseCoeffsBase<Eigen::Array<int, 3, 1, 0, 3, 1>, 1>::operator[](long)) will be abandoned.
When the function is done executing, GDB will silently stop.
代码是用-O0 -g -fno-inline 编译的。如何调试 Eigen 对象的内容?
【问题讨论】:
-
谢谢。我正在使用 Eigen 源进行编译,而不是使用库。
-
@JesperJuhl 只是为了澄清:Eigen 仅是标题,即不单独编译。 Eric:你能提供一个minimal reproducible example吗?