[PATCH] Add an objfile getter to gdb.Type

Christian Biesinger via gdb-patches gdb-patches@sourceware.org
Thu May 23 20:36:00 GMT 2019


On Thu, May 23, 2019 at 2:34 PM Simon Marchi <simark@simark.ca> wrote:
> > +/* Return the type's tag, or None.  */
>
> copy-pasto: "type's objfile"

Done

> > +static PyObject *
> > +typy_get_objfile (PyObject *self, void *closure)
> > +{
> > +  struct type *type = ((type_object *) self)->type;
> > +  struct objfile *objfile = nullptr;
> > +
> > +  objfile = TYPE_OBJFILE(type);
>
> You can write it as
>
>   struct objfile *objfile = objfile = TYPE_OBJFILE (type);
>
> directly.
>
> We would need a corresponding test though.  It should be a relatively easy addition
> to testsuite/gdb.python/py-type.exp.  See here for info about how to run just one
> test:

Done. I sent the updated patch as a separate email, I hope I did it right.

Thanks,
Christian



More information about the Gdb-patches mailing list