为什么我不能进入GDB中的C ++ cout标准库函数? [英] Why can't I step into a C++ cout standard library function in GDB?
问题描述
我写了一个简单的 test.cc
如下:
#include< iostream>
使用命名空间std;
int main()
{
cout<< Hello world<<恩德尔
返回0;
}
然后我编译为:
g ++ -g test.cc -o test.o
我运行了 gdb
并在 Hello world
行中设置了一个断点:
$ gdb test.o
(gdb)b 7
(gdb)c
然后 gdb
停在 Hello world
行,但是当我运行时
(gdb)s
它无法进入 cout
函数。所以我的问题是,如何进入 cout
函数?
如果它没有与带有调试信息的标准库版本链接,则它不知道如何进入该库;
请咨询系统文档以了解如何安装。
标准C和C ++库的调试版本。
I wrote a simple test.cc
as follows:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world" << endl;
return 0;
}
And I compiled with:
g++ -g test.cc -o test.o
I ran gdb
and put a breakpoint at the "Hello world"
line:
$ gdb test.o
(gdb) b 7
(gdb) c
Then gdb
stops at the "Hello world"
line, but when I run
(gdb) s
It fails to step into the cout
function. So my question is, how can I step into the cout
function?
If it wasn't linked against a version of the standard library with debugging information, it doesn't know how to step into the library; it can only step over it (that is, run until control returns to the code with the debugging information).
Consult the documentation for your system to find out how to install the debug version of the standard C and C++ libraries.
这篇关于为什么我不能进入GDB中的C ++ cout标准库函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!