Here is a simple program that divides by zero and produces the following machine dump, if it is built with /Tx+:
#include <stdio.h>
#include <float.h>
int main(void){ /* Print 1/x for x = 8, 7, ... */
double x;
_control87(0, em_zerodivide)
for (x= 8.0; x>-1.0; x -= 1.0) {
printf("%f %f\n", x, 1/x);
}
/* the program never gets here */
return 0;
}
Below is the output produced when this program runs. The messages in any dump are similar to those in the dump below, but the values may be different. The number in brackets are links between the lines that make up a dump and explanations, and do not appear in actual output.
In general, a dump always includes items (1), (2), and (3). Items (4) to (7) appear only if the NPX was in use at the time of the exception. Item (8) may or may not appear, depending on the circumstances of each exception.
| 1 | The first line always states the nature of the exception and the place and thread where the exception occurred. If you do not build with option dump(yes), this is the only message that is generated. |
| 2 | Introduces the register dump |
| 3 | Gives the values contained by each register at the time the exception occurred. For information on the purpose of each register, see the documentation for your processor chip. |
| 4 | Introduces the state of the numeric processor extension (NPX) at the time of the exception. |
| 5 | Gives the values of the elements in the NPX environment. |
| 6 | Introduces the state of the NPX stack at the time of the exception. |
| 7 | One copy of this message appears for each valid stack entry in the NPX and gives the values for each. In this example, because there is only one stack entry, the message appears only once. If there are no valid stack entries, a different message is issued in place of this message, to state that fact. |
| 8 | Confirms that the process is terminating. It is one of several informational messages that may accompany the initial exception message and register dump. |