Thread overview | |||||
---|---|---|---|---|---|
|
April 24, 2003 Fault handler | ||||
---|---|---|---|---|
| ||||
Programming with X32VM and DMC 8.33 I install an exception handler using _x32_fault_intercept(). Then in my handler I longjmp() out to a main exception handler (in case the stack was screwed up before my handler got called). Before I call _exit(), I print the registers and call only critical exit handlers. Q: Is it safe to use longjmp()? --gv |
April 24, 2003 Re: Fault handler | ||||
---|---|---|---|---|
| ||||
Posted in reply to Gisle Vanem | In article <b87cpd$r9l$1@digitaldaemon.com>, Gisle Vanem (gvanem@eunet.no) says... > Programming with X32VM and DMC 8.33 I install an exception > handler using _x32_fault_intercept(). > > Then in my handler I longjmp() out to a main exception handler > (in case the stack was screwed up before my handler got called). > Before I call _exit(), I print the registers and call only critical exit > handlers. > > Q: Is it safe to use longjmp()? Once memory has been corrupted by stray writes thru bad pointers, (such as would "screw up" the stack), then longjump's data structure may also have been hit and the longjump() may fail. However, understanding that any stack unwinding (dtor calls) will be bypassed by a longjump(), it is among the safer things you can do other than just terminating the process. If it was crucial, you could add some redundancy to the longjump struct and validate it before the longjump(). -- -Larry Brasfield (address munged, s/sn/h/ to reply) |
April 24, 2003 Re: Fault handler | ||||
---|---|---|---|---|
| ||||
Posted in reply to Larry Brasfield | "Larry Brasfield" <larry_brasfield@snotmail.com> wrote:
> Once memory has been corrupted by
> stray writes thru bad pointers, (such
> as would "screw up" the stack), then
> longjump's data structure may also
> have been hit and the longjump() may
> fail. However, understanding that any
> stack unwinding (dtor calls) will be
> bypassed by a longjump(), it is among
> the safer things you can do other than
> just terminating the process.
Thanks for the info. I was a bit uncertain if
_x32_fault_intercept() required the handler to
return to do some internal house-keeping.
But some test convinced m it's not needed.
--gv
|
Copyright © 1999-2021 by the D Language Foundation