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 [5/6]


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

Thiago> I found one potential problem, which could cause the function to return
Thiago> NULL without an exception being set (it's not the case I thought of
Thiago> before, I think): suppose there's no objfile Python object when this
Thiago> function is called, to the ALL_OBJFILES loop will skip all objs, then
Thiago> the gdb module has no pretty_printers attribute, or the pretty_printers
Thiago> value is not a list object. In that case, the function will return NULL
Thiago> without a Python exception being set. Can it happen?

Yes, I see it now:

  /* Fetch the global pretty printer dictionary.  */
  if (! PyObject_HasAttrString (gdb_module, "pretty_printers"))
    goto done;

That is the bad branch.  Thanks.

Also, I think here:

    PyObject *objf = objfile_to_objfile_object (obj);
    if (!objf)
      continue;

... we need to clear the python error.

I will make the needed changes.

Thiago> Also, I noticed that the function may return Py_None if no
Thiago> pretty-printer is found, and the callers even expect that. The function
Thiago> comment needs to be fixed then:

Thanks.

Tom


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