[review] Allow not saving the signal state in SIGSETJMP

Christian Biesinger (Code Review)
2019-10-16T16:10:47Z

Christian Biesinger has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/124
......................................................................

Patch Set 2:

> Patch Set 2:
>
> > Patch Set 2:
> >
> > Thank you for doing this.
> >
> > It seems reasonable to me. My only question is: how do we know it works?
> >
> > I guess one way would be to find a mangled string that causes a crash
> > (there may be some in bugzilla), then demangle it twice (using "demangle"
> > should be enough) -- the second time should still report the error.
>
> I went the easy way:
> + Â  Â *(int*)0=0;
>
> And got this output:
> ../../gdb/cp-support.c:1589: demangler-warning: unable to demangle '__progname' (demangler failed with signal 11)
> Unable to dump core, use `ulimit -c unlimited' before executing GDB next time.
> ../../gdb/cp-support.c:1603: demangler-warning: unable to demangle '__progname' (demangler failed with signal 11)
> A problem internal to GDB has been detected,
> further debugging may prove unreliable.
> Quit this debugging session? (y or n) n
> then:
> (gdb) demangle __progname
> Can't demangle "__progname"
>
>
> The same as without this patch applied.
>
> Although I am confused because I don't see where error_reported gets reset.

In fact, with a printf in the signal handler, I get lots of output, so this does work.

Conversely, if I remove the sigprocmask call but keep the rest of the patch, I do get a segfault from gdb.

So this should be good!