[PATCH 2/2 v3] Demangler crash handler

Gary Benson gbenson@redhat.com
Wed Jun 4 18:34:00 GMT 2014


Doug Evans wrote:
> Gary Benson <gbenson@redhat.com> writes:
> > +static void
> > +gdb_demangle_signal_handler (int signo)
> > +{
> > +  static int core_dumped = 0;
> > +
> > +  if (!core_dumped)
> > +    {
> > +      if (fork () == 0)
> > +	dump_core ();
> 
> IIUC you're skipping the can_dump_core() check.
> If the user has set ulimit -c 0, I think that needs to be obeyed.
> I realize can_dump_core may call fprintf which we can't do here,
> but you could still IMO call getrlimit.
> IWBN to still call can_dump_core (or whatever) so that the
> implementation of the check is still tucked away in a function.

Ah, I saw can_dump_core but didn't get what it was doing.
I'll refactor it so that the check is performed once, before the
signal handler is installed, and the message is printed outside
the signal handler if a crash is caught.

> > +      if (crash_signal != 0)
> > +	{
> > +	  static int error_reported = 0;
> > +
> > +	  if (!error_reported)
> 
> For myself as a user I'd like the warning for every demangle failure.
> [I'd throttle it by unique symbols though.]

My reasoning here was that any subsequent failures could be caused by
the first, by memory corruption or some leftover state, so they could
be bogus and lead us into wild goose chases.

I can certainly put together a patch with throttled warnings as you
describe if you prefer.  Let me know :)

Thanks,
Gary

-- 
http://gbenson.net/



More information about the Gdb-patches mailing list