You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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


Posted on Jul 15, 2021 6:59 PM

Reply

Similar questions

4 replies

GDB Hangs after "New Thread"

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.