Sourceware Bugzilla – Bug 9599
catch catch and catch throw restore control of the inferior inside libstd exception handler and throw code.
Last modified: 2013-02-22 16:05:57 UTC
[Converted from Gnats 2494]
catch catch - when the inferior enters an exception handler (in C++) "catch catch" returns control inside the __cxa_begin_catch code in libstdc++ library.
catch throw - when the inferior throws an exception (in C++) "catch throw" returns control inside the __cxa_throw code in libstdc++ library.
Both of these occur as the "catch catch" and "catch throw" operate by placing a breakpoint in __cxa_begin_catch and __cxa_throw libstdc++ functions respectively. While this is technically within "the code", it would be a better user experience to return control of the inferior at the line of the catch or throw, before it has executed the catch of throw.
I don't think there is a very good way to do this directly,
but it could be faked by installing a frame filter that
notices that the newest frame is __cxa_begin_catch and that
the PC is where "catch catch" placed it.
Then, the filter can simply elide the first frame.
However, this would yield somewhat strange results.
First, it isn't clear whether a frame filter can actually
elide the first frame.
Second, this would yield a situation where "bt" would report
the selected frame as the user's code, but where the
actual selected frame would be in libstdc++; so things
like "info locals" would fail.
I think that fixing this requires the next step of frame filters, namely
integration with frame selection.