Re: catch SIGSEGV in the demangler

Tom Tromey
2013-01-18T17:34:30Z

>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

Tom> I was thinking of perhaps expanding the scope somewhat.

Tom> One idea I had was to introduce a new RETURN_SEGV to return_reason and
Tom> *not* add this to RETURN_MASK_ALL.

Tom> Then, have a special throw_segv that first looks to see if anything
Tom> expects to catch it, and if not, reset the handler and re-raise the
Tom> signal.

Tom> This way we could let code handle SEGV when appropriate, without tying
Tom> it to the demangler -- but also without catching all SEGVs that occur in
Tom> gdb.

I implemented this and I think it reads a bit better.
Now any code that knows what to do with a SEGV can

TRY_CATCH (except, RETURN_MASK_SEGV) { ... }

... but if nothing on the call stack does this, SEGVs are just allowed
to cause gdb to crash.

Tom