【发布时间】:2016-10-11 03:24:02
【问题描述】:
我最近开始使用 DEV C++ 进行编程,遇到了一个问题,在 Googleshere 中搜索尚未证明有帮助。
在以下代码中,GDB 在到达第 5 行时“挂起”std::cout << "Hello" << std::endl;。
#include <iostream>
int main()
{
int tree = 9;
std::cout << "Hello" << std::endl;
tree = 10;
return 0;
}
程序编译和运行都很好,但是单步执行时总是卡在这里,“下一行”或“继续”似乎都不起作用。
以下是 GDB 窗口的一些输出:
Starting program: C:\XXX\XXX\XXX\XXX\breakGDB.exe
[New Thread 7300.0x2028]
->->new-thread
[New Thread 7300.0x2638]
->->new-thread
->->starting
->->breakpoints-invalid
->->frames-invalid
->->breakpoint 1
Breakpoint 1,
->->frame-begin 0 0x40153d
->->frame-function-name
main
->->frame-args
()
->->frame-source-begin
at
->->frame-source-file
hello.cpp
->->frame-source-file-end
:
->->frame-source-line
5
->->frame-source-end
->->source C:\XXX\XXX\XXX\XXX\hello.cpp:5:38:beg:0x40153d
->->frame-end
->->stopped
->->pre-prompt
(gdb)
->->prompt
->->post-prompt
->->frames-invalid
->->starting
->->frame-begin 0 0x44d2f0
->->frame-address
0x000000000044d2f0
->->frame-address-end
in
->->frame-function-name
std::ostream::operator<<(std::ostream& (*)(std::ostream&))
->->frame-args
()
->->frame-end
->->stopped
->->pre-prompt
(gdb)
->->prompt
->->post-prompt
Single stepping until exit from function _ZNSolsEPFRSoS_E,
which has no line number information.
->->frames-invalid
->->starting
->->frame-begin 0 0x46cf10
->->frame-address
0x000000000046cf10
->->frame-address-end
in
->->frame-function-name
std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)
->->frame-args
()
->->frame-end
->->stopped
->->pre-prompt
(gdb)
->->prompt
我对 GDB 很陌生。这是 GDB 的一个特性吗?我是不是设置错了?这是怎么回事?
我已经祈祷了,这不是我的愚蠢错误。
【问题讨论】: