This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/3] Propagate GDB/C++ exceptions across readline using sj/lj-based TRY/CATCH
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 22 Apr 2016 10:05:47 +0100
- Subject: Re: [PATCH 2/3] Propagate GDB/C++ exceptions across readline using sj/lj-based TRY/CATCH
- Authentication-results: sourceware.org; auth=none
- References: <1461282640-30425-1-git-send-email-palves at redhat dot com> <1461282640-30425-3-git-send-email-palves at redhat dot com> <86mvomhxb7 dot fsf at gmail dot com>
On 04/22/2016 09:17 AM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
>
> Hi Pedro,
> this series is fine with me. I tested them on arm/fedora19, and the
> exception can be correctly handled.
Great, thanks.
>> This turns out to be a much better looking fix than my bespoke API
>> attempt, even. We'll probably be able to simplify TRY_SJLJ/CATCH_SJLJ
>> when we finally get rid of TRY/CATCH all over the tree, but until
>
> I don't see anything we can simplify in TRY_SJLJ/CATCH_SJLJ. Can you
> elaborate please?
When we get to the point when we longer need TRY/CATCH for regular
exception handling it means we'll no longer need TRY/CATCH to
manage and run cleanups, as all cleaning up will be done by
RAII / destructors.
So the bits in TRY_SLJLJ/CATCH_SJLJ that manage the cleanup chain and
the bit in throw_exception_sjlj that runs cleanups can all disappear.
Also, since we always want RETURN_MASK_ALL, the second parameter
of CATCH_SJLJ can be eliminated, along with all the return_mask
support code. E.g., since CATCH_SJLJ will always catch all
exceptions, exceptions_state_mc_catch becomes simply
something like:
void
exceptions_state_mc_catch (struct gdb_exception *exception)
{
*exception = current_catcher->exception;
catcher_pop ();
}
... which may itself expose further possible simplifications,
like e.g., moving catch_pop to the caller directly.
Thanks,
Pedro Alves