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@sourceware.org
Subject: Re: [RFC - GDB Python API] New gdb.Architecture class
Date: Tue, 22 Jan 2013 21:17:00 -0000	[thread overview]
Message-ID: <87wqv4x6ib.fsf@fleche.redhat.com> (raw)
In-Reply-To: <CAGyQ6gyWn4+W3ty56K6RASoKpRgmFQEt9crmYsUVYoVSkUK6tQ@mail.gmail.com>	(Siva Chandra's message of "Tue, 22 Jan 2013 12:40:46 -0800")

>>>>> "Siva" == Siva Chandra <sivachandra@google.com> writes:

Siva> In the attached patch, I have made it such a way that if a Python
Siva> architecture object exists, then a new reference is returned instead
Siva> of a new object. To be frank, the class is so simple that I am not
Siva> really sure which is the right approach. But I modified because I
Siva> think (as gdbarch pointers do not change) references instead of whole
Siva> objects might be more efficient memory wise(?).

I don't think I understand the last point.

Anyway, yeah, I'm not sure whether this is worth the effort or not.

Siva> +typedef struct arch_object_type_object {
Siva> +  PyObject_HEAD
Siva> +  struct gdbarch *gdbarch;
Siva> +  struct arch_object_type_object *next;
Siva> +} arch_object;
Siva> +
Siva> +static arch_object *arch_object_list = NULL;

Instead of this I think you can associated the Python object with the
gdbarch using gdbarch_data_register_post_init and gdbarch_data.  This
will let you attach the Python representation directly to the gdbarch.

It seems I missed a spot when adding registry.h.  Oops.

Tom


  reply	other threads:[~2013-01-22 21:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-21 14:08 Siva Chandra
2013-01-21 17:09 ` Tom Tromey
2013-01-22 20:40   ` Siva Chandra
2013-01-22 21:17     ` Tom Tromey [this message]
2013-01-23 13:53       ` Siva Chandra
2013-01-23 15:35         ` Tom Tromey
2013-01-23 15:59         ` Eli Zaretskii
2013-01-23 21:01           ` Siva Chandra

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=87wqv4x6ib.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