Mac only: There are a lot of ways to troubleshoot your Mac, but if your problem is so serious that you can't load the GUI (or if you don't have your installation disc), AppleJack can troubleshoot it right from the command line.
From the AppleJack main menu, you can repair disks, repair permissions, clean up cache files, validate preference files and remove swap files. Oftentimes one or more of these operations can fix whatever problems you're having, but if you can't get into Disk Utility to run them, AppleJack can do it for you outside of a standard OS X session. You can even run them sequentially by putting AppleJack on autopilot, if you're not sure which one will fix your particular problem. AppleJack also comes with the option to install Memtest, from which you can test your memory if you suspect it's causing a problem as well.
To run AppleJack, you just need to start up your computer in Single User Mode by holding down command and s at startup, then typing applejack. Do not, whatever you do, run AppleJack in a standard Terminal window, as you may lose some of your data. Once it finishes starting up, just type in applejack at the prompt and follow the menu to (hopefully) get your computer running healthy again. Hit the link to install it now, in preparation for that fateful day when your GUI won't start.
AppleJack is a free download, Mac OS X only.