gcc and gdb are part of the "Xcode Tools" suite, which is badly named. If you install Xcode Tools, you can run gcc and gdb as you would on any other platform (Darwin oddnesses aside), and build projects using makefiles, configure scripts and so on. Xcode is just a convenience GUI IDE that you can use if you so desire.
You can also build cross-compilers from the official FSF gcc tarballs and stuff.