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


On Tue, Jan 22, 2013 at 1:17 PM, Tom Tromey <tromey@redhat.com> wrote:
>
> 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.

Done in the attached patch.

2013-01-22  Siva Chandra Reddy  <sivachandra@google.com>

        Add a new class gdb.Architecture which exposes GDB's
        internal representation of architecture via GDB Python API.

        * Makefile.in: Add entries corresponding to the new file
        python/py-arch.c.
        * python/py-arch.c: Implement gdb.Architecture class.
        * python/py-frame.c (frapy_arch): Implement the method
        gdb.Frame.architecture().
        (frame_object_methods): Add 'architecture' to the method table.
        * python/python-internal.h: Add declarations of new utility
        functions.
        * python/python.c (_initialize_python): Initialize
        gdb.Architecture class.

doc/

        * gdb.texinfo (Architectures In Python): New sub-sub-section
        describing the gdb.Architecture class.
        (Frames In Python): Add description about the new method
        Frame.architecture().

testsuite/

        * gdb.python/frame.exp: Add a test for Frame.architecture()
        method.

Attachment: gdb_arch_patch_v3.txt
Description: Text document


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