GDB 无法显示 Boost uBLAS 矩阵?
我有一个使用 Boost 的 uBLAS 矩阵实现成功编译的程序。唉,使用 gdb 进行调试被证明是有问题的,因为我在调试时找不到办法查看矩阵的内容。当我尝试查看矩阵 V 的元素(它确实存在并且充满数据)时,我得到:
(gdb) print V(1,1)
Invalid data type for function to be called.
有没有办法解决这个问题?
谢谢!
I have a successfully compiled program using Boost's implementation of uBLAS matricies. Alas, debugging with gdb is proving problematic as I could find no way to see the contents of my matrices while debugging. When I try to see an element of a matrix V (which does exist and is full of data), I get:
(gdb) print V(1,1)
Invalid data type for function to be called.
Is there a way around this?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
可以
在gdb中调用
One can call
in gdb
这是因为 GDB 不支持调用重载的
operator()
。它试图将V
作为函数调用,但它不是函数。您可以编写一个独立的函数,将矩阵传递给它并调用运算符:并且 GDB 应该能够调用该函数
您还可以尝试手动检查
V
的表示,以便手动提取你想要的价值。不过,对于使用大量模板或元编程的类型来说,这可能会很困难。如果您碰巧在 LLDB 支持的平台上工作,它支持调用运算符重载。
This is because GDB doesn't support calling the overloaded
operator()
. It's trying to just callV
as a function, and it's not a function. You can write a freestanding function that you pass the matrix to and calls the operator:and GDB should be able to call that
You can also try to manually examine the representation of
V
in order to manually pull out the value you want. That's probably going to be hard with types that use a lot of templates or meta-programming though.If you happen to be working on a platform that is supported by LLDB, it supports calling operator overloads.
我在寻找这个问题的解决方案时发现了这个线程。建议的解决方案效果很好。但是,您也可以使用 ublas 矩阵的
at_element
方法。I found this thread when looking for a solution for this problem. The proposed solution works fine. However, you could also use the
at_element
method of ublas matrices.