1

I just spent the last couple hours trying to figure out how to get gdb to work on MacOS. I finally got it and have the ability to run files within the shell, but even the simplest files cannot run properly. I am just trying to run a "hello world" file called hello.cpp. I know that the file runs fine outside of gdb.

#include<iostream>
using namespace std;
int main()
{
    cout << "hello world" << endl;
    return 0;
}

To compile the program I run $ g++ hello.cpp -o hello -g. To run the shell, I have to give sudo permission $ sudo gdb. Once in the shell I try to use the 'start' command (gdb) start. I always get one of three results from running this series of commands.

(gdb) start
Temporary breakpoint 1 at 0x100001056: file hello.cpp, line 5.
Starting program: /Users/mllax8/Desktop/Embedded/Embedded_Labs/lab0/hello 
[New Thread 0x1103 of process 1639]
[New Thread 0xe03 of process 1639]
During startup program terminated with signal ?, Unknown signal.

or

(gdb) start
Temporary breakpoint 1 at 0x100001056: file hello.cpp, line 5.
Starting program: /Users/mllax8/Desktop/Embedded/Embedded_Labs/lab0/hello 
[New Thread 0x1003 of process 1625]
[New Thread 0xe03 of process 1625]
During startup program terminated with signal SIGTRAP, Trace/breakpoint trap.

or It just gets stuck after the [New Thread… line and must be manually aborted

The same 3 errors seem to occur when I use run as well. What could this be?

ks1322
  • 33,961
  • 14
  • 109
  • 164

0 Answers0