This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dmalcolm
Recipients dmalcolm, loewis
Date 2010-04-03.15:37:45
SpamBayes Score 1.3689787e-06
Marked as misclassified No
Message-id <1270309068.18.0.720455881047.issue8279@psf.upfronthosting.co.za>
In-reply-to
Content
It looks like all of the failures were due to gdb.Frame not having a "function" method.

I did some digging, and it appears that this attribute may not yet be in the upstream version of gdb.

The gdb/python integration was largely implemented by colleagues of mine at Red Hat, and Fedora's build of gdb is closely tracking their work.

It looks to me like only a subset of their work has been merged into upstream gdb so far. Specifically http://cvs.fedoraproject.org/viewvc/rpms/gdb/F-12/gdb-archer.patch?revision=1.40&view=markup (warning: large) contains a hunk that applies to gdb/python/py-frame.c which adds "frapy_function".

So it appears that I've unwittingly coded this to a very recent pre-merge version of gdb.

Sorry about this.

What is the output of "gdb --version" on this machine?

What happens if you run:
$ gdb --batch --eval-command "python print gdb.Frame.function" --eval-command "python print dir(gdb.Frame)"

For reference, on Fedora 12 I see:
[david@surprise ~]$ gdb --version
GNU gdb (GDB) Fedora (7.0.1-33.fc12)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.

[david@surprise ~]$ gdb --batch --eval-command "python print gdb.Frame.function" --eval-command "python print dir(gdb.Frame)"
<method 'function' of 'gdb.Frame' objects>
['__class__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'block', 'find_sal', 'function', 'is_valid', 'name', 'newer', 'older', 'pc', 'read_var', 'select', 'type', 'unwind_stop_reason']



On Fedora 13:
[david@f13 ~]$ gdb --version
GNU gdb (GDB) Fedora (7.0.50.20100203-15.fc13)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.

[david@f13 ~]$ gdb --batch --eval-command "python print gdb.Frame.function" --eval-command "python print dir(gdb.Frame)"
<method 'function' of 'gdb.Frame' objects>
['__class__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'block', 'find_sal', 'function', 'is_valid', 'name', 'newer', 'older', 'pc', 'read_var', 'select', 'type', 'unwind_stop_reason']


The code works for me on both of these machines; all tests pass.


Assuming that my analysis above is correct, then I'd expect other builds of gdb not to have the gdb.Frame.function method.

This method is critical for the libpython.py:Frame class, and so without it the various extension commands aren't going to be usable.   The pretty-printers ought to still work.

The fix would be to detect the presence of gdb.Frame.function, and enable/disable the commands and their selftests accordingly, assuming that it's OK to add a conditional dependency on code that isn't merged into gdb's trunk yet.

I'll do a patch for this.
History
Date User Action Args
2010-04-03 15:37:48dmalcolmsetrecipients: + dmalcolm, loewis
2010-04-03 15:37:48dmalcolmsetmessageid: <1270309068.18.0.720455881047.issue8279@psf.upfronthosting.co.za>
2010-04-03 15:37:46dmalcolmlinkissue8279 messages
2010-04-03 15:37:45dmalcolmcreate