Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: pmuldoon@redhat.com
Cc: gdb-patches@sourceware.org
Subject: Re: [python] [patch] PR python/12656 (API for special blocks)
Date: Fri, 07 Oct 2011 20:41:00 -0000	[thread overview]
Message-ID: <m3liswcz63.fsf@fleche.redhat.com> (raw)
In-Reply-To: <m339f4envs.fsf@redhat.com> (Phil Muldoon's message of "Fri, 07	Oct 2011 18:02:15 +0100")

>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:

Phil> This patch addresses PR python/12656.  It allows the user to determine if
Phil> a given gdb.Block is the static block, or the global block.
Phil> Additionally I added two new APIs to actually get the global/static
Phil> blocks on behalf of the user.

Thanks.

Phil> I also, because the global/static GDB fetch methods use const struct
Phil> *block, changed the Python code to use consts.  This required some minor
Phil> refactoring both inside and outside the Python API code.

Nice.  Looks pretty good.

Phil> +@defun Block.is_global ()
Phil> +@defun Block.is_static ()

Why are these methods rather than attributes?

Phil> diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c
Phil> index 08d4455..5ef7d2e 100644
Phil> --- a/gdb/python/py-block.c
Phil> +++ b/gdb/python/py-block.c
Phil> @@ -28,7 +28,7 @@
Phil>  typedef struct blpy_block_object {
Phil>    PyObject_HEAD
Phil>    /* The GDB block structure that represents a frame's code block.  */
Phil> -  struct block *block;
Phil> +  const struct block *block;
Phil>    /* The backing object file.  There is no direct relationship in GDB
Phil>       between a block and an object file.  When a block is created also
Phil>       store a pointer to the object file for later use.  */
Phil> @@ -50,7 +50,7 @@ typedef struct {
Phil>    /* Pointer back to the original source block object.  Needed to
Phil>       check if the block is still valid, and has not been invalidated
Phil>       when an object file has been freed.  */
Phil> -  struct blpy_block_object *source;
Phil> +  const struct blpy_block_object *source;

Why make this one const?
It seems wrong given that we have to decref it when the iterator is
destroyed.

Phil> +      Py_INCREF (Py_None);
Phil> +      return Py_None;

I think it is more normal to use Py_RETURN_NONE here.

Phil>  gdb_test "python print block_iter.is_valid()" "False" \
Phil>           "Check block validity"
Phil> +

Gratuitous newline addition.

Phil> -extern struct value *value_of_variable (struct symbol *var, struct block *b);
Phil> +extern struct value *value_of_variable (struct symbol *var, const struct block *b);

This should probably wrap after the ",".

Tom


  reply	other threads:[~2011-10-07 20:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-07 17:02 Phil Muldoon
2011-10-07 20:41 ` Tom Tromey [this message]
2011-10-10  9:34   ` Phil Muldoon
2011-10-10 18:27     ` Tom Tromey
2011-10-11 16:00       ` Phil Muldoon
     [not found]         ` <09787EF419216C41A903FD14EE5506DD030BEC56DF@AUSX7MCPC103.AMER.DELL.COM>
2011-10-11 16:06           ` Paul Koning
2011-10-11 18:32             ` Phil Muldoon
2011-10-11 17:30         ` Tom Tromey
2011-10-17 10:59           ` Phil Muldoon
2011-10-17 11:57             ` Eli Zaretskii
2011-10-17 12:49               ` Phil Muldoon
2011-10-17 15:07                 ` Eli Zaretskii
2011-10-20 12:58                   ` Phil Muldoon

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=m3liswcz63.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pmuldoon@redhat.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