Hacker News new | ask | show | jobs
by mark_undoio 1517 days ago
> > (for example, the demangler is crash-prone so GDB installs a SEGV handler when invoking it)

> Yikes.

I originally believed GDB must have quite a sophisticated SIGSEGV handler because when it exploded it was telling me that the crash was in the libiberty demangler.

I was disappointed to discover that this is entirely a special case - the handler is literally installed before the relevant calls into libiberty and then removed afterwards (though this behaviour can be turned off). Of course, this is a pragmatic solution when you know one component is more vulnerable.

This does mean there's a phenomenal number of `sigaction()` calls involved in GDB's debugging of C++. When investigating GDB with a time travel debugger (I was using UDB but I presume rr would have a similar experience unless they've optimised this case further) a large proportion of the history logged was just those syscalls.