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: Python pretty-printing [2/6]


>>>>> "Thiago" == Thiago Jung Bauermann <bauerman@br.ibm.com> writes:

Tom> This patch adds a minimal Python wrapper for struct objfile,
Tom> and arranges to auto-load Python code when an objfile is created.

Thiago> Hooray. Just a few comments...

Thanks for looking at this.  I've found that seeing the Python patches
again, out of context, helps me look at them anew.  Apparently this
works for you too :-)

Thiago> IMHO these should go in the "Objfiles In Python" section, like e.g.
Thiago> gdb.selected_frame goes in the "Frames In Python" section.

Thanks, will do.

Thiago> So perhaps you should:

>   tmp = self->printers;
>   Py_INCREF (value);
>   self->printers = value;
>   Py_XDECREF (tmp);

Thiago> You certainly have more experience in this area than me though. WDYT?

Good catch.  I will make this change.  I think one failing case is
just:

    objfile.pretty_printers = objfile.pretty_printers

Tom> +/* Return the Python object of type Objfile representing OBJFILE.  If
Tom> +   the object has already been created, return it.  Otherwise, create
Tom> +   it.  Return NULL and set the Python error on failure.  */
Tom> +PyObject *
Tom> +objfile_to_objfile_object (struct objfile *objfile)

Thiago> Perhaps it would be useful to mention that this function returns a
Thiago> borrowed reference to the object?

Will do.

Thiago> Also, just to check: the lack of testcases is because you believe this
Thiago> code is tested enough with python-prettyprint.exp in a later patch?

You know, I am not sure.  This class doesn't provide much behavior
yet.  And, the most important bits are tested by the pretty-printer.
I'm inclined not to bother, but if you (or anybody) thinks it is
important, I suppose I can whip something up.

Tom


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