This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [Patch] x % 0 hangs
From: Ian Lance Taylor <ian@wasabisystems.com>
Date: 27 Jun 2004 11:06:19 -0400
Andrew Cagney <cagney@gnu.org> writes:
> > The only approach that's somewhat
> > portable is longjmp-ing out of the signal handler, and even that seems
> > to have its problems on some platforms.
>
> I'm curious, which platforms?
Over the years I've seen quite a few bug-reports about this failing to
work, but I can't remember exectly which platforms were affected. It
may be related to what I say in the next paragraph though.
Anyway, if/when we start longjmp-ing out of signal handlers we have to
realize the we must restore the proper signal mask (not all
sigjmp/longjmp implementations do that) and perhaps re-install the
SIGFPE signal handler.
I would think that it would be safe enough to longjmp on SIGFPE into
the gdb catch_errors stack. You would obviously be in trouble if the
SIGFPE came from any libc stdio routine, but I would expect that to be
impossible with a working library.
The worst case is that we'll crash, which still is an improvement over
just hanging like we do now on some platforms :-).
Mark