A routine within a program that is entered as a result of some error condition having been detected, and serves to analyse the cause of that error or to provide information that is subsequently used for such analysis. A typical diagnostic routine might attempt to isolate the cause of the error to a particular hardware or software subsystem, or simply record the values of the major data objects at the time that the error occurred.