This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 2/8] Python: Fix exception handling in py-record-btrace.c
- From: Pedro Alves <palves at redhat dot com>
- To: Tim Wiederhake <tim dot wiederhake at intel dot com>, gdb-patches at sourceware dot org
- Cc: markus dot t dot metzger at intel dot com, brobecker at adacore dot com, qiyaoltc at gmail dot com
- Date: Thu, 27 Apr 2017 17:35:27 +0100
- Subject: Re: [PATCH v2 2/8] Python: Fix exception handling in py-record-btrace.c
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx01.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 021DA8E3EA
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 021DA8E3EA
- References: <1492771786-26372-1-git-send-email-tim.wiederhake@intel.com> <1492771786-26372-3-git-send-email-tim.wiederhake@intel.com>
On 04/21/2017 11:49 AM, Tim Wiederhake wrote:
> GDB_PY_HANDLE_EXCEPTION does not handle all exceptions. Replace with call to
> gdbpy_convert_exception.
This makes no sense to me. Here's the definition:
/* Use this after a TRY_EXCEPT to throw the appropriate Python
exception. */
#define GDB_PY_HANDLE_EXCEPTION(Exception) \
do { \
if (Exception.reason < 0) \
{ \
gdbpy_convert_exception (Exception); \
return NULL; \
} \
} while (0)
That definitely handles all exceptions. "reason" is never
positive.
I could see
> @@ -891,14 +898,17 @@ recpy_bt_goto (PyObject *self, PyObject *args)
> target_goto_record_end ();
> else
> target_goto_record (obj->number);
> +
> + Py_INCREF (Py_None);
> + ret = Py_None;
> }
> CATCH (except, RETURN_MASK_ALL)
> {
> - GDB_PY_HANDLE_EXCEPTION (except);
> + gdbpy_convert_exception (except);
> }
> END_CATCH
>
> - Py_RETURN_NONE;
> + return ret;
> }
this particular change making sense, but for a completely
different reason -- GDB_PY_HANDLE_EXCEPTION returns NULL
and here you seem to want to return a Py_None with a
reference. But that should be split to its own patch
with its own rationale.
Thanks,
Pedro Alves