### Example of an OS/2 Machine State Dump

Here is a program generates a floating point exception and produces the following machine dump, if it is built with the /Tx compiler option.

    #include <stddef.h>

    int *p=NULL;

    int main(void) {
    	*p=1;
    	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 numbers in brackets are links to explanations, and do not appear in actual output.

    Floating Point Invalid Operation exception occurred at
    EIP = 00050000 on thread 0001.(1)
    Register Dump at point of exception: (2)
    EAX = 00000001 EBX = 00000000 ECX = 000B0010 EDX = 00140010
    EBP = 00000000 EDI = 00000000 ESI = 00061FCC ESP = 00061FA8 (3)
    CS = 005B CSLIM = 1BFFFFFF DS = 0053 DSLIM = 1BFFFFFF
    ES = 0053 ESLIM = 1BFFFFFF FS = 150B FSLIM = 00000030
    GS = 0000 GSLIM = 00000000 SS = 0053 SSLIM = 1BFFFFFF
    NPX Environment: (4)
    CW = 0362 TW = 3FFF IP = 005B:0001002B (5)
    SW = B881 OPCODE = 0545 OP = 0053:00023414
    NPX Stack: (6)
    ST(7): exponent = 0000 significand = + 00000000 00000000 (7)
    Process terminating.(8)

In general, a dump always includes items (1), (2), and (4). 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 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