GDB Hangs after "New Thread"
I have built GDB from source on macOS 12.0 (the same issue occurred in Big Sur, too) and codesigned it. However, every time I try to debug a program, I get this:
(gdb) b main
Breakpoint 1 at 0x10000324f: file main.cpp, line 50.
(gdb) run
Starting program: /Users/fluzzlesnuff/Documents/C++/a.out
[New Thread 0x2a03 of process 2389]
and then GDB hangs. I have been compiling C++ programs with g++. Here are some things I have tried:
- Compile with -g option.
- Compile with -ggdb option.
- Compile with -ggdb3 option.
- Run with sudo
- Kill and re-run gdb repeatedly.
- Try different binaries.
- Disable SIP
- Add more breakpoints.
- "set startup-with-shell off" in .gdbinit
I do *not* get taskgated / Mach Port errors; only the New Thread message.
For reference, here are my versions:
$ g++ --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin21.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ gdb --version
GNU gdb (GDB) 10.2