Reading the documentation reveals that
gdb has a dedicated, standard command to catch exceptions.
catch throw will break when an exception is thrown just before the stack is unwound (there are other commands for breaking after unwinding too, but those are less useful). It works just fine, except the debugger plugin doesn't find a source line number, since the exception doesn't have one.
info frame shows
__cxa_throw as the first entry, and the containing function, address
and line number where the
throw statement can be found in the second entry. It works surprisingly well. Ok, actually, since the entire exception handling is built on top of that, that's not surprising at all, duh
So, to make breaking on exceptions really work (including setting the little yellow wedge on the source line), the debugger plugin would have to:
1. send
catch throw at startup
2. do everything as usual when waking up, but if frame[0] has no line number and is called
__cxa_throw (or maybe match against something more permissive, such as
/__.*throw/ ), use the line number of frame[1] instead.