This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 09/10] Return EXT_LANG_BT_ERROR in one more spot in py-framefilter.c
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Tue, 27 Jun 2017 18:31:48 +0100
- Subject: Re: [RFA 09/10] Return EXT_LANG_BT_ERROR in one more spot in py-framefilter.c
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8CB41A4FBB
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8CB41A4FBB
- References: <20170425194113.17862-1-tom@tromey.com> <20170425194113.17862-10-tom@tromey.com>
On 04/25/2017 08:41 PM, Tom Tromey wrote:
> While reading py-framefilter.c, I found one spot where an exception
> could be caught but then not be turned into EXT_LANG_BT_ERROR. This
> patch fixes this spot.
Eek. LGTM.
I wonder whether we could wrap the TRY/CATCHes in something
that would do this exception handling systematically/automatically.
Maybe:
template<typename Func>
enum ext_lang_bt_status success
try_py (Func &&f)
{
TRY
{
f ();
}
CATCH (except, RETURN_MASK_ALL)
{
gdbpy_convert_exception (except);
return EXT_LANG_BT_ERROR;
}
END_CATCH
return EXT_LANG_BT_OK;
}
Used like:
return try_py ([]
{
// old body of TRY goes here.
});
Thanks,
Pedro Alves