在gdb中打印流值-C ++ [英] Print stream value in gdb - C++
本文介绍了在gdb中打印流值-C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试查看流的值(ifstream,但它应该适用于我猜想的所有流). 示例代码可能如下所示:
I'm trying to see the value of stream (ifstream, but it should work for all kind of streams I guess). The example code could look like this:
stringstream in("One Two Three Four Five");
while(in)
cout << in;
我正尝试通过以下方式进行操作,但似乎都没有效果:
I was trying to do it in following ways but none of them seems to work:
(gdb) print in
(gdb) call cout << in
(gdb) call in.getline()
...等等.
有什么办法可以看到流的价值吗?
Is there any way, to see the value of the stream?
推荐答案
您必须确保您拥有带有libstdc++
库且已通过调试标志编译的软件包.
You have to make sure that you have the package with the libstdc++
library compiled with the debugging flags.
我已经安装了libstdc++6-8-dbg
软件包,现在我可以在gdb
中查看所有流对象数据.
I have the libstdc++6-8-dbg
package installed and now I can view all the stream object data in gdb
.
这篇关于在gdb中打印流值-C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文