为什么我不能在gdb中使用函数? [英] Why can't I step into a function in gdb?
问题描述
我写了一个简单的 test.cc
,如下所示:
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
我运行了 gdb
,并在Hello world
行放置了一个断点:
I ran gdb
and put a breakpoint at the "Hello world"
line:
$ gdb test.o
(gdb) b 7
(gdb) c
然后 gdb
停在Hello world
line,但是当我运行时
Then gdb
stops at the "Hello world"
line, but when I run
(gdb) s
无法进入 cout
函数。所以我的问题是,我该如何进入 cout
函数?
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).
请参阅系统的文档以了解如何安装标准C和C ++库的调试版本。
Consult the documentation for your system to find out how to install the debug version of the standard C and C++ libraries.
这篇关于为什么我不能在gdb中使用函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!