I just finished installing gdb (which took me more than three hours on a mac), and now I need to debug a project I have for my uni. It seems that none of my code works (Or am I doing something wrong?). I have tried running multiple files under gdb, and I usually get
[New Thread 0x2603 of process 964]
[New Thread 0x2303 of process 964]
During startup program terminated with signal SIGTRAP, Trace/breakpoint trap.
Or this
[New Thread 0x2507 of process 995]
[New Thread 0x1803 of process 995]
During startup program terminated with signal ?, Unknown signal.
For a fact, I know this is a fully functional program. Any views as what may be the problem?
I'm compiling with gcc and -g
flag. Code is written in simple c++.
The simplest code I could think of which gdb still refuses to debug.
#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.
I expected to get a value for some variable or a confirmation that the program has run, but this is all I get. where is the trap?