1

I am trying to get gdb to work on macOS. I followed the instructions here, and now no longer receive an error regarding the Code Signature.

However, when I try to use gdb, I consistently observe the following behavior.

  1. I compile a hello.cpp file with g++ -g -o hello hello.cpp
  2. I run gdb in the directory where I compiled the file.
  3. I enter file hello into the (gdb) prompt.
  4. I enter break main.
  5. I enter run.

GDB now prints out

Starting program: (CWD)/hello
[New Thread 0xXXXXX of process DDDDD]

where

(CWD) is the current working directory (where the executable lives)

XXXXX is some hexadecimal number and

DDDDD is another number.

From here on, all I seem to be able to do is kill the terminal tab. Neither Ctrl-C, Ctrl-D nor anything else I enter seems to have any effect.

Some Details:

  • I installed gdb using home-brew, the installed version is 8.2.1
  • I did echo set startup-with-shell off >> ~/.gdbinit
  • The same happens when using the built-in Terminal or iTerm2
  • lldb works on the same executable

hello.cpp

#include <iostream>

int main()
{
    std::cout << "hello, world" << std::endl;

    return 0;
}
ks1322
  • 33,961
  • 14
  • 109
  • 164
Takayama
  • 43
  • 2
  • 5
  • Possible duplicate of [gdb doesn't work on macos High Sierra 10.13.3](https://stackoverflow.com/questions/49001329/gdb-doesnt-work-on-macos-high-sierra-10-13-3) – jackw11111 Feb 27 '19 at 11:39
  • 2
    There is evidence suggesting the latest builds of gdb don't work on macOS. I believe downgrading to 8.0.1 (by following this https://stackoverflow.com/a/49104154/9238288 answer) will solve your issue. – jackw11111 Feb 27 '19 at 11:43

0 Answers0