Rockets contain accelerometers and gyroscopes to measure changes in velocity and angular rates.
Gyroscopes detect changes of the orientation in space (=attitude). You can integrate these changes to get the cumulative change in attitude and given one knows the initial attitude, the attitude can be estimated. But, gyros do not measure attitude. Bias and noise will accumulate and thus after some time the attitude estimate won't be accurate at all.
If you are not accelerating (i.e. standing on the ground), accelerometers can be used as inclinometers to determine the vector of the gravitational force, or less complicated, the downward direction. Quite often gyros and accelerometers are thus used in combination (via sensor fusion, e.g. complementary filter) to determine attitude.
But: In free fall (e.g. in a rocket after booster burnout), the accelerometer cannot be used to determine the downward direction. The accelerometer would measure an accerleration opposing the drag force. Thus, the accelerometer can't be used to determine absolute attitude in free fall. (More general it can't determine the vector of the gravitational force if the acceleration is not known).
Once in orbit, sun sensors and star trackers are used but I don't think they would work during ascent or descent.
For rockets at launch and landing (think Falcon 9) I suppose it is quite important to estimate attitude. To counter error buildup of gyros some absolute attitude sensor would be needed.
So, my question is: How do NASA or SpaceX or even missiles measure absolute attitude during launch or landing? Which sensors are being used?
I'd be glad about any responses.