regrtest reports
======================================================================
FAIL: test_basic_command (test.test_gdb.PyListTests)
Verify that the "py-list" command works
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/martin/work/27/Lib/test/test_gdb.py", line 518, in test_basic_command
cmds_after_breakpoint=['py-list'])
File "/home/martin/work/27/Lib/test/test_gdb.py", line 111, in get_stack_trace
self.assertEquals(err, '')
AssertionError: "/home/martin/work/27/python: can't open file 'Lib/test/test_gdb_sample.py': [Errno 2] No such file or directory\nError occurred in Python command: No frame is currently selected.\n" != ''
======================================================================
FAIL: test_one_abs_arg (test.test_gdb.PyListTests)
Verify the "py-list" command with one absolute argument
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/martin/work/27/Lib/test/test_gdb.py", line 535, in test_one_abs_arg
cmds_after_breakpoint=['py-list 9'])
File "/home/martin/work/27/Lib/test/test_gdb.py", line 111, in get_stack_trace
self.assertEquals(err, '')
AssertionError: "/home/martin/work/27/python: can't open file 'Lib/test/test_gdb_sample.py': [Errno 2] No such file or directory\nError occurred in Python command: No frame is currently selected.\n" != ''
======================================================================
FAIL: test_two_abs_args (test.test_gdb.PyListTests)
Verify the "py-list" command with two absolute arguments
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/martin/work/27/Lib/test/test_gdb.py", line 548, in test_two_abs_args
cmds_after_breakpoint=['py-list 1,3'])
File "/home/martin/work/27/Lib/test/test_gdb.py", line 111, in get_stack_trace
self.assertEquals(err, '')
AssertionError: "/home/martin/work/27/python: can't open file 'Lib/test/test_gdb_sample.py': [Errno 2] No such file or directory\nError occurred in Python command: No frame is currently selected.\n" != ''
----------------------------------------------------------------------
|
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.
|
> What is the output of "gdb --version" on this machine?
GNU gdb (GDB) 7.0.1-debian
This GDB was configured as "x86_64-linux-gnu".
The debian package is 7.0.1-2
> $ gdb --batch --eval-command "python print gdb.Frame.function"
> --eval-command "python print dir(gdb.Frame)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: type object 'gdb.Frame' has no attribute 'function'
Error while executing Python code.
['__class__', '__delattr__', '__doc__', '__eq__', '__ge__',
'__getattribute__', '__gt__', '__hash__', '__init__', '__le__',
'__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__',
'__repr__', '__setattr__', '__str__', 'is_valid', 'name', 'newer',
'older', 'pc', 'read_var', 'type', 'unwind_stop_reason']
> 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.
That would be fine, I think. Please add a comment saying that gdb 7.0.1
didn't have this feature yet.
|