### Example of a Windows Machine State Dump

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.

    General Protection Fault exception occurred at EIP = 004100C1
    on thread 0088. (1)
    Register Dump at point of exception: (2)
    EAX = 00000000 EBX = 7FFDF000 ECX = 0047001C EDX = 0000BE70
    EBP = 0012FF9C EDI = 77FA4510 ESI = 77F6C1A2 ESP = 0012FF8C (3)
    CS = 001B CSLIM = FFFFFFFF DS = 0023 DSLIM = FFFFFFFF
    ES = 0023 ESLIM = FFFFFFFF FS = 0038 FSLIM = 00000FFF
    GS = 0000 GSLIM = 00000000 SS = 0023 SSLIM = FFFFFFFF
    NPX Environment: (4)
    CW = 0362 TW = 3FFF IP = 00C1:0475001B (5)
    SW = B884 OPCODE = 0475 OP = FF94:FFFF0023
    NPX Stack: (6)
    ST(0): exponent = 3FFF significand = + 800000000 00000000 (7)
    Process terminating. (8)

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.

Notes on the Example
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.

Signals and Exceptions

Get a Machine-State Dump