public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/3] Fix latent bug in Python breakpoint creation
Date: Thu, 12 Jan 2023 12:44:47 -0500	[thread overview]
Message-ID: <a66855cb-8322-097c-7d90-1957a388c2c9@simark.ca> (raw)
In-Reply-To: <20221208191804.3819129-3-tromey@adacore.com>



On 12/8/22 14:18, Tom Tromey via Gdb-patches wrote:
> While working on the previous patch, I noticed that Python breakpoint
> creation does:
> 
> -	  = (qualified != NULL && PyObject_IsTrue (qualified)
> 
> PyObject_IsTrue can fail, so this is missing an error check.  This
> patch adds the missing check.
> 
> Note that this could probably be improved by using the "p" format in
> the call to gdb_PyArg_ParseTupleAndKeywords, but that was added in
> Python 3.3, and I think gdb still supports 3.2.
> ---
>  gdb/python/py-breakpoint.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
> index 917fd367d06..39d9bd5dff6 100644
> --- a/gdb/python/py-breakpoint.c
> +++ b/gdb/python/py-breakpoint.c
> @@ -818,7 +818,7 @@ bppy_init_validate_args (const char *spec, char *source,
>  static void
>  bppy_create_breakpoint (enum bptype type, int access_type, int temporary_bp,
>  			int internal_bp, const char *spec,
> -			PyObject *qualified, const char *source,
> +			int qualified, const char *source,

You might as well make this parameter "bool".

Otherwise, LGTM.

Simon

  reply	other threads:[~2023-01-12 17:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08 19:18 [PATCH 0/3] Add "announce" flag to " Tom Tromey
2022-12-08 19:18 ` [PATCH 1/3] Refactor body of bppy_init Tom Tromey
2022-12-08 19:18 ` [PATCH 2/3] Fix latent bug in Python breakpoint creation Tom Tromey
2023-01-12 17:44   ` Simon Marchi [this message]
2022-12-08 19:18 ` [PATCH 3/3] Let Python breakpoints be created silently Tom Tromey
2023-01-11 17:31   ` Tom Tromey
2023-01-12  9:42     ` Eli Zaretskii
2023-01-12 17:49   ` Simon Marchi
2023-01-13 18:55     ` Tom Tromey
2023-01-13 12:59   ` Pedro Alves
2023-01-13 18:56     ` Tom Tromey

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=a66855cb-8322-097c-7d90-1957a388c2c9@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.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).