After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 636387 - gdb autoload files for glib and gobject both shadow the "dir" builtin
gdb autoload files for glib and gobject both shadow the "dir" builtin
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-12-03 16:36 UTC by Dave Malcolm
Modified: 2010-12-03 19:41 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Dave Malcolm 2010-12-03 16:36:16 UTC
http://git.gnome.org/browse/glib/tree/glib/libglib-gdb.py.in
has:

  dir = '@datadir@/glib-2.0/gdb'
  if not dir in sys.path:
      sys.path.insert(0, dir)

This assignment to "dir" shadows the "dir" builtin, making it more difficult to
use python interactively within gdb.

Easy fix: use "dir_" instead of "dir"

c.f: attempting to debug my gdbheap module [1] when the inferior process is linked against glib:
(gdb) python import gdbheap

(gdb) python dir(gdbheap)
Traceback (most recent call last):
  • File "<string>", line 1 in <module>
TypeError: 'str' object is not callable
Error while executing Python code.

(gdb) python print repr(dir)
'/usr/share/glib-2.0/gdb'

(see downstream report https://bugzilla.redhat.com/show_bug.cgi?id=621719 )

[1] https://fedorahosted.org/gdb-heap/
Comment 1 Dave Malcolm 2010-12-03 16:38:40 UTC
There's a similar problem here:
  http://git.gnome.org/browse/glib/tree/gobject/libgobject-gdb.py.in
Comment 2 Matthias Clasen 2010-12-03 18:58:20 UTC
Feel free to commit a fix
Comment 3 Dave Malcolm 2010-12-03 19:06:21 UTC
I don't think I have push rights; I haven't touched upstream gnome sources since CVS iirc.
Comment 4 Matthias Clasen 2010-12-03 19:09:19 UTC
Ok, pushed
Comment 5 Dave Malcolm 2010-12-03 19:23:24 UTC
Thanks - though it looks like you only fixed one of the two sites with the problem.

http://git.gnome.org/browse/glib/commit/? id=807101272893f27469bb5c507c7967334a5a0b8e
shows the fix for comment #1 (glib:gobject/libgobject-gdb.py.in)

Please can you also do the analogous fix for comment #0 (glib:glib/libglib-gdb.py.in)?