我刚完成gdb的安装(在Mac上花了三个多小时),现在我需要调试一个用于uni的项目。似乎我的代码都不起作用(或者我做错了吗?)。我尝试在gdb下运行多个文件,通常会得到
[New Thread 0x2603 of process 964]
[New Thread 0x2303 of process 964]
During startup program terminated with signal SIGTRAP, Trace/breakpoint trap.
或者这个
[New Thread 0x2507 of process 995]
[New Thread 0x1803 of process 995]
During startup program terminated with signal ?, Unknown signal.
事实上,我知道这是一个功能齐全的程序。有任何意见可能是问题所在吗?
我正在使用gcc和-g
标志进行编译。代码是用简单的c ++编写的。
我能想到的最简单的代码仍然拒绝调试。
#include <iostream>
using namespace std;
int main(void)
{
int x, y, sum;
cout << "Enter two integers..seperated by a space: ";
cin >> x >> y;
sum = x + y;
cout << "The sum of the two numbers " << x << " and " << y << " is " << sum;
cout << endl;
return 0;
}
(gdb) start
Temporary breakpoint 1 at 0x100000d49: file HW1.cpp, line 12.
Starting program: /Users/ramindehghan/Desktop/C++ Educational Projects/CSCI 123F/main
[New Thread 0x1903 of process 1148]
[New Thread 0x1c03 of process 1148]
During startup program terminated with signal SIGTRAP, Trace/breakpoint trap.
我希望得到一些变量的值或程序已运行的确认,但这就是我得到的全部。陷阱在哪里?