Re: Exception Handling...
nobody_at_noplace.not
Date: 06/26/04
- Next message: Martin: "Delphi or Windows Bug? Systsem Errors when using remote desktop"
- Previous message: Maarten Wiltink: "Re: Simple threading question"
- In reply to: VBDis: "Re: Exception Handling..."
- Next in thread: Bruce Roberts: "Re: Exception Handling..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 26 Jun 2004 14:33:57 -0400
On 26 Jun 2004 14:11:25 GMT, vbdis@aol.com (VBDis) wrote:
>Im Artikel <69MCc.63427$sj4.34027@news-server.bigpond.net.au>, "David Reeve"
><dree4456@big-pond.net.au> schreibt:
>
>>The OS then unwinds the stack frame of the
>>thread which executed the errant code, procedure call by procedure call as
>>it looks for what??........
>
>Isn't the FS segment register used for exception handling? I vaguely remember
>its use in Microsoft compilers...
I found an article on this, it's a bit old, but it does clarify a lot.
As I now understand it... FS points to the beginning of a Stack Frame
belonging to the current block of code being executed.
At FS:[0] the executing code can register an exception handler by providing
it's entry address and at FS:[4] it must list the address of the previous
exception handler, creating a linked list of "exception registrations"
When an exception occurs Windows jumps into an exception handling routine
that assumes the last handler in the chain is the current handler and does
a controlled jump to the address at FS:[0]
The jump is to a callback, an external entry point where the exception is
dealt with and the return value from the callback tells windows how to
proceed... whether the error is handled or not.
If the error is handled, an "unwind" is initiated in which a second visit to
each callback is made, allowing for whatever post-error cleanup is required.
When a block of code exits, the stack frame is dismantled resulting in the
exception handler's address being removed from the end of the list, leaving
the registration of all previous handlers in place. Thus Windows always has
the most current handler available to it.
I'm not 100% certain yet but it strikes me this pretty much corresponds to
Try/Except/Finally/ as in...
Try // register exception callback @Except block
DoThisCode;
Except // callback: handle exception and signal windows it's done
FixThisProblem;
Finally // unwinding: clean up after ourselves (i.e. do anyway)
CleanupAfterThisProblem;
end; // exception registration is destroyed with stack frame.
Of course this isn't exactly how DP works... But I'm guessing that's what
the OS gurus hand in mind.
-----
Laura
- Next message: Martin: "Delphi or Windows Bug? Systsem Errors when using remote desktop"
- Previous message: Maarten Wiltink: "Re: Simple threading question"
- In reply to: VBDis: "Re: Exception Handling..."
- Next in thread: Bruce Roberts: "Re: Exception Handling..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|