Why can#39;t I step into a C++ cout standard library function in GDB?(为什么我不能进入 GDB 中的 C++ cout 标准库函数?)
问题描述
我写了一个简单的test.cc
如下:
I wrote a simple test.cc
as follows:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world" << endl;
return 0;
}
我编译了:
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"
行,但是当我运行时
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 中的 C++ cout 标准库函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么我不能进入 GDB 中的 C++ cout 标准库函数?


基础教程推荐
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- CString 到 char* 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 如果我为无符号变量分配负值会发生什么? 2022-01-01