I get gdb by brew install gdb.
brew install gdb
The source file content is:
#include int main(){ int a = 10; for(int i = 0; i<
I got past this issue on Mojave by thinning the app. GDB does not understand universal binaries. So if file myapp tells you myapp is a universal binary, try this:
file myapp
lipo -thin x86_64 -output myapp-x86_64 myapp
And then
gdb myapp-x86_64