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.
- I compile a
hello.cpp
file withg++ -g -o hello hello.cpp
- I run
gdb
in the directory where I compiled the file. - I enter
file hello
into the(gdb)
prompt. - I enter
break main
. - 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;
}