public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/3] Propagate GDB/C++ exceptions across readline using sj/lj-based TRY/CATCH
Date: Fri, 22 Apr 2016 09:05:00 -0000	[thread overview]
Message-ID: <5719E96B.5050604@redhat.com> (raw)
In-Reply-To: <86mvomhxb7.fsf@gmail.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

  reply	other threads:[~2016-04-22  9:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-21 23:50 [PATCH 0/3] Fix C++ exceptions across readline result in std::terminate() -> SIGABRT Pedro Alves
2016-04-21 23:50 ` [PATCH 3/3] Switch gdb's TRY/CATCH to C++ try/catch Pedro Alves
2016-04-21 23:50 ` [PATCH 2/3] Propagate GDB/C++ exceptions across readline using sj/lj-based TRY/CATCH Pedro Alves
2016-04-22  8:19   ` Yao Qi
2016-04-22  9:05     ` Pedro Alves [this message]
2016-04-22 15:25       ` Pedro Alves
2016-04-21 23:50 ` [PATCH 1/3] Rename rl_callback_read_char_wrapper -> gdb_rl_callback_read_char Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5719E96B.5050604@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).