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: [PATCH 5/7] [python] API for macros: gdb.Objfile symtabs method.


>>>>> "matt" == matt rice <ratmice@gmail.com> writes:

matt> 2011-08-23  Matt Rice  <ratmice@gmail.com>
matt> 	* python/py-symtab.h: New file.  Make symtab_to_symtab_object public.
matt> 	* python/py-objfile.c (objfpy_symtabs): New method.
matt> 	(objfile_object_methods): Ditto.

A couple notes on this.

matt> +static PyObject *
matt> +objfpy_symtabs (PyObject *self, PyObject *ignore)
matt> +{
matt> +  objfile_object *obj = (objfile_object *) self;
matt> +  struct symtab *symtabs;
matt> +  PyObject *list;
matt> +  PyObject *py_symtab;
matt> +
matt> +  if (! obj->objfile)
matt> +    return Py_None;

You need Py_RETURN_NONE.

I think most of our objects will throw an exception if you try to
operate on them when they are in the 'invalid' state; if that is true
then I think this should conform.

matt> +  while(symtabs)

Missing space.

matt> +  { "symtabs", objfpy_symtabs, METH_NOARGS,
matt> +    "symtabs () -> List.\n\
matt> +A List containing the object file's valid symtabs." },

I don't mind this method per se, but I think people will find it
confusing, as it only returns full symtabs -- but there is no direct way
for the Python programmer to cause symtab expansion.

matt> +PyObject *
matt> +symtab_to_symtab_object (struct symtab *symtab);

In addition to what Phil said, the norm is not to split declarations
after the type -- only definitions.

Tom


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