Re: catch SIGSEGV in the demangler

Pedro Alves
2013-01-18T17:56:53Z

On 01/18/2013 04:08 PM, Tom Tromey wrote:
>
> I'm primarily interested in opinions on whether this is even a good
> idea. I'm on the fence about it myself.

Me too. I'd rather all bugs in the demangler were fixed. :-)

> It's far from clear that it is safe to call throw_exception from a
> signal handler.

Yeah. It's risky. It uses the heap (malloc/free), so
if the wrapped code crashes within malloc or free (e.g.,
corrupted heap), then the handler may e.g., deadlock
(the handler crashing wouldn't be that bad, since we're
already crashing). It also calls clear_sigint_flag,
which with python enabled is probably not very reentrant or
async signal safe either, as it calls into python, which I can
imagine to be a problem is you wrap all SEGVs throughtout
GDB's execution, instead of just over the demangler, which
won't normally call into python.

So dunno either.

--
Pedro Alves