You'd be surprised what they plan for, with such an expensive mission.
There's a famous story about Apollo 11 for this, which you can extrapolate to the shuttle. To save mass and complexity, Apollo spacecraft had a 3 axis gyro. Unlike their more advanced 4 axis cousins, 3 axis gyros can suffer from what is called "gimbal lock." This occurs in a particular orientation where 2 of the axes of the gyros get lined up. When this happens, you lose information about what direction you're pointing in (because you have 3 mechanical axes and 3 dimensions, but one of those mechanical axes just got doubled up, leaving 1 dimension unmeasured).
NASA had a solution, of course, they had a device which was designed to "kick" one of the gimbal axes out of the way before you get to that point. Without getting into the math, this is kind of like looking at an object from two points of view -- it works.
Or at least it usually works. In the case of Apollo 11, there was a computer glitch (a divide by 0), which took the computer that was responsible for this adjustment offline. Once that happened, Apollo 11 was fully capable of entering gimbal lock. If that happened, it would not be able to control which direction its thrusters pushed in.
They had a solution. NASA had calculated out the path. The astronauts could take sightings out of a few particular windows to the stars, and use that to align their gyros. The result was vastly inferior to the orientation information they would have gotten from having the gyros working the whole time. They wouldn't have been able to land on the moon after doing such an emergency realignment, but they would have enough control to get back home.
Now fast forward to the shuttle. The shuttle is more complex. There's many more systems that can break down. But the Apollo missions were crafted to deal with a gimbal lock destroying the single most important bit of information they needed -- their orientation. You can make guesses as to what sort of solutions the Shuttle has.
Apollo 11 managed to fly with the computer down without reaching any of the dangerous orientations which would cause gimbal lock. They landed on the moon successfully, as we all know.
After the Lunar Module had landed, Mike Collins aboard the Command Module joked "How about sending me a fourth gimbal for Christmas?"