
Run Time Error Messages
-----------------------


During runtime you will probable get sometimes an error message like the
following one:


 Error within Protected Mode of Swallow...

 General Protection Fault, error code 0500 occurred.
 Register contents:
 eax=00000500 ebx=00000100 ecx=01250002 edx=00360000
 ebp=00001D42 esi=00001F04 edi=00000000
 cs:eip=01F7:00000C95 ss:esp=0287:00001D42 eflags=00010202
 cs=01F7(*10FB<0000343D) ss=0287(*50F3<00001FFF) ds=027F(*10F3<000017C3)
 es=05F7(*00F3<00000024) fs=0000(*xxxx<????????) gs=0000(*xxxx<????????)
 Module name: Editors

 Found callers:      01F7(Editors ):12E7 01F7(Editors ):2A93 01F7(Editors ):25C5
 01F7(Editors ):0D8E 01F7(Editors ):2BC2 01F7(Editors ):3305 01EF(TVEdit  ):0049
 cannot continue...
 Possible hidden caller: 025F(Objects ):0A1E

 Program aborted.



The parts describe:

  General Protection Fault, error code 0500 occurred.
The kind of error occurred, the standard errors are the "General Protection
Fault" and the "Segment not present". The first one is raised by nearby all
kinds of errors, e.g. if the bounds of an array were exceeded or you accessed
a memory block, which you cannot access, like the try to write something into
a code segment, and the second one says definitively, that the program tried
to access a memory block which was freed before. The error code is the
selector the program tried to load, in the example above it was the selector
500h, which was not declared, or zero, if the exact reason of the exception
is unknown. Normally a look at the code is the most easy way to see the
mistake your program has done.


 Register contents:
 eax=00000500 ebx=00000100 ecx=01250002 edx=00360000
 ebp=00001D42 esi=00001F04 edi=00000000
 cs:eip=01F7:00000C95 ss:esp=0287:00001D42 eflags=00010202

Here you can read the values of the registers at the moment of the exception.
Very important is the value of "cs:eip" which shows the address where the
exception was raised.


 cs=01F7(*10FB<0000343D) ss=0287(*50F3<00001FFF) ds=027F(*10F3<000017C3)
 es=05F7(*00F3<00000024) fs=0000(*xxxx<????????) gs=0000(*xxxx<????????)

For each segment register the selector it contains (e.g. 27fh for ds), the
access rights (e.g. 10f3h for ds) and the segment limit (e.g. 17c3h for ds)
are shown. If the selector is invalid or unreachable, e.g. if the exception
was raised by a module of Swallow itself, only xxx and ??? are shown (e.g. at
fs). If your program accesses a memory address this information are very
usuable to find the reason of the exception.


 Module name: Editors

This is the name of the module the exception was raised by.


 Found callers:      01F7(Editors ):12E7 01F7(Editors ):2A93 01F7(Editors ):25C5
 01F7(Editors ):0D8E 01F7(Editors ):2BC2 01F7(Editors ):3305 01EF(TVEdit  ):0049
 cannot continue...
 Possible hidden caller: 025F(Objects ):0A1E

Swallow tries to find the stack chain of the program, in our example the
procedure raised the exception was called by Editors:12e7h, called by
Editors:2a93h and so on. Each entry contains the selector of the calling
segment (e.g. 1f7h), the name of it (e.g. Editors) and the offset of the
instruction after the call instruction. The stack chain is even decoded if
some of your units do not contain debug information. Please take note, that
if a procedure do not build a standard stack frame, its caller cannot be
detected by Swallow. That's why Swallow tries to search a caller hidden in
such a way (e.g. Objects:a1eh in our example), but sometimes Swallow finds
a hidden caller which does not exist, so you can discard it.

An example: a procedure of you ("Caller") calls an other of your functions
("Proc"), which calls a function ("Func") of the unit "System" with invalid
parameters. This function "Func" accesses the invalid parameter and raises
an exception. If "Func" did not create a stack frame, Swallow shows the
address of "Func" as the address the exception was raised at and "Caller" as
the direct caller and skips "Proc" because the missed stack frame. But if you
have luck, "Proc" is shown as the hidden caller.



If you get such an error message you should write it down, press a key and
call your debugger to look at the code the exception raised at and remove the
mistake.


