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<
gdb 8.2 installed from Homebrew is not compatible with Mac mojave. I have upgrade to 8.2.1. The issue should be resolved.