This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/3] Propagate GDB/C++ exceptions across readline using sj/lj-based TRY/CATCH


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]