gdb's TUI mode broke on macOS
Yes, I came with the same problem. 
TUI is useless when debugging with gdb and src layout. It's a bug of iterm2 which can't fully support complicate output. Sometimes, TUI crashes too when using vim and multi-windows setting. 
Apple likely has left gcc and gdb behind. So my suggestion is switching to clang and lldb. Both work fine so far on Mac command line and they are advanced tools. At the mean time, switching wouldn't cost you much time if you could use gdb well. 
Good luck. And by the way, Xcode is a gread tool for your peace of mind.