Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tim Wiederhake <tim.wiederhake@intel.com>, gdb-patches@sourceware.org
Cc: markus.t.metzger@intel.com, brobecker@adacore.com, qiyaoltc@gmail.com
Subject: Re: [PATCH v2 2/8] Python: Fix exception handling in py-record-btrace.c
Date: Thu, 27 Apr 2017 16:35:00 -0000	[thread overview]
Message-ID: <0ceec05a-2d2c-6bed-ed88-064d3c369e8d@redhat.com> (raw)
In-Reply-To: <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


  parent reply	other threads:[~2017-04-27 16:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-21 10:50 [PATCH v2 0/8] Python bindings for GDB record Tim Wiederhake
2017-04-21 10:50 ` [PATCH v2 1/8] Python: Fix indentation in py-record-btrace.c Tim Wiederhake
2017-04-21 10:50 ` [PATCH v2 4/8] Python: Remove ptid from gdb.Record interface Tim Wiederhake
2017-04-21 12:20   ` Eli Zaretskii
2017-04-21 10:50 ` [PATCH v2 8/8] Python: Introduce gdb.Instruction class Tim Wiederhake
2017-04-21 12:19   ` Eli Zaretskii
2017-04-24  5:34     ` Wiederhake, Tim
2017-04-21 18:10   ` Yao Qi
2017-04-21 10:50 ` [PATCH v2 7/8] Python: Move and rename gdb.BtraceFunction Tim Wiederhake
2017-04-21 12:22   ` Eli Zaretskii
2017-04-21 16:41   ` Yao Qi
2017-04-21 10:50 ` [PATCH v2 2/8] Python: Fix exception handling in py-record-btrace.c Tim Wiederhake
2017-04-21 18:08   ` Yao Qi
2017-04-27 16:35   ` Pedro Alves [this message]
2017-04-21 10:50 ` [PATCH v2 5/8] Python: Introduce gdb.RecordGap class Tim Wiederhake
2017-04-21 12:25   ` Eli Zaretskii
2017-04-21 14:50   ` Yao Qi
2017-04-21 10:50 ` [PATCH v2 6/8] Python: Move and rename gdb.BtraceInstruction Tim Wiederhake
2017-04-21 12:23   ` Eli Zaretskii
2017-04-21 15:21   ` Yao Qi
2017-04-21 10:50 ` [PATCH v2 3/8] Python: Use correct ptid in btrace recording Tim Wiederhake
2017-04-21 14:49   ` Yao Qi

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=0ceec05a-2d2c-6bed-ed88-064d3c369e8d@redhat.com \
    --to=palves@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=markus.t.metzger@intel.com \
    --cc=qiyaoltc@gmail.com \
    --cc=tim.wiederhake@intel.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