Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Siva Chandra <sivachandra@google.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [RFC/Patch v3] PR 16113: Allow gdb.Field objects as subscripts on gdb.Value objects
Date: Thu, 12 Dec 2013 02:36:00 -0000	[thread overview]
Message-ID: <87eh5i23tp.fsf@fleche.redhat.com> (raw)
In-Reply-To: <CAGyQ6gyj2rJqpZmNwSpfNiCovAEf6_P_gZvhs8iyf1-DOEOGbQ@mail.gmail.com>	(Siva Chandra's message of "Wed, 11 Dec 2013 15:23:36 -0800")

Tom> What about TYPE_CODE_UNION and TYPE_CODE_RANGE?
Tom> Offhand I don't recall if other types present "fields".
Tom> Maybe TYPE_CODE_FUNC?  TYPE_CODE_COMPLEX?

Siva> I missed TYPE_CODE_UNION so I have added it in the attached patch. The
Siva> other types do not support the "fields" method. [But, is it a mistake
Siva> that we do not support fields for other methods? The documentation
Siva> does talk about ranges, functions and methods. At this point, I am
Siva> tempted to ask as to why we should "overload" the method "fields" to
Siva> return function/method args? Can we bring in a class hierarchy of
Siva> types where in gdb.Type exists as a base class, and gdb.TypeStruct,
Siva> gdb.TypeFunction etc. are derived from it. That way, we can add
Siva> relevant methods to the respective classes. For example,
Siva> gdb.TypeFunction will have "args" as a method and not "fields". I
Siva> understand the notion of fields is overloaded internally, but we could
Siva> make the Python API clearer.]

Yeah, I agree, that would be cleaner.
Occasionally it's easy to become blind to the issue after working on gdb
for a while.

Siva> +  arg = type_to_type_object (type);
Siva> +  if (arg == NULL)
Siva> +    goto fail;

Tom> I think if TYPE is not a gdb.Type then this will return -1 without
Tom> setting the Python exception.

Siva> The above comment is for the change in py-type.c. The variable TYPE in
Siva> question here is "struct type" and not gdb.Type. I think
Siva> type_to_type_object would return NULL only if PyObject_New called in
Siva> it fails. Is an exception not set by PyObject_New on failure?

This one is my mistake.  I misread that as type_object_to_type.

Siva> 2013-12-11  Siva Chandra Reddy  <sivachandra@google.com>

Siva>         PR 16113: Allow gdb.Field objects with the subscript operator on

I don't remember if the regexp catches this form, best to write
"PR python/16113" instead.

The patch ok with this change, thanks!

Tom


  reply	other threads:[~2013-12-12  2:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11 23:23 Siva Chandra
2013-12-12  2:36 ` Tom Tromey [this message]
2013-12-12 19:36 ` Siva Chandra
2013-12-12 20:11   ` Eli Zaretskii
2013-12-12 20:12 ` Eli Zaretskii

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=87eh5i23tp.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sivachandra@google.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