This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC - GDB Python API] New gdb.Architecture class


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]