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 760186 - namespace clash with gdb pretty-printing code
namespace clash with gdb pretty-printing code
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.46.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2016-01-05 22:03 UTC by Tom Tromey
Modified: 2016-05-23 15:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
the stack trace I couldn't enter in the bug-reporting form (746 bytes, text/plain)
2016-01-05 22:03 UTC, Tom Tromey
  Details
proposed patch (34.42 KB, patch)
2016-05-22 02:40 UTC, Tom Tromey
committed Details | Review

Description Tom Tromey 2016-01-05 22:03:04 UTC
glib installs a gdb helper file named "glib.py".
Then the "hook" file updates sys.path and does "import glib".

This will fail if glib has already been imported into gdb, say
using "from gi.repository import GLib".  This is due to a namespace clash.

One fix would be to rename the gdb helper files to not clash with
other Python modules.  This should be done for all such helper files.

This is not just theoretical; I have a gdb GUI written in Python
that runs inside gdb.  I encounter this bug whenever I try to debug
a glib-using program.  You can find my gui here:

https://github.com/tromey/gdb-gui


First, here is a demonstration of help helper working correctly:

pokyo. gdb -nx -quiet
(gdb) file /lib64/libglib-2.0.so.0.4600.2 
Reading symbols from /lib64/libglib-2.0.so.0.4600.2...Reading symbols from /lib64/libglib-2.0.so.0.4600.2...(no debugging symbols found)...done.
(no debugging symbols found)...done.
(gdb) info pretty-printer 
global pretty-printers:
  builtin
    mpx_bound128
  objfile /usr/lib64/libglib-2.0.so.0.4600.2 pretty-printers:
  pretty_printer_lookup
  objfile /usr/lib64/libglib-2.0.so.0.4600.2 pretty-printers:
  pretty_printer_lookup


Now here is how to reproduce the bug.  Note that I couldn't enter
the python stack trace here, as it caused problems for GNOME bugzilla.
I'll try to attach it separately.

pokyo. gdb -nx -quiet
(gdb) python from gi.repository import GLib
(gdb) file /lib64/libglib-2.0.so.0.4600.2 
Reading symbols from /lib64/libglib-2.0.so.0.4600.2...Reading symbols from /lib64/libglib-2.0.so.0.4600.2...(no debugging symbols found)...done.
Traceback (most recent call last):
[... error here ...]
Comment 1 Tom Tromey 2016-01-05 22:03:57 UTC
Created attachment 318295 [details]
the stack trace I couldn't enter in the bug-reporting form
Comment 2 Tom Tromey 2016-05-22 02:40:54 UTC
Created attachment 328333 [details] [review]
proposed patch

This patch fixes the problem by renaming the debugging helper packages
to "glib_gdb" and "gobject_gdb".  This way they will not clash with
names from pygtk or what have you.
Comment 3 Colin Walters 2016-05-23 14:48:18 UTC
Review of attachment 328333 [details] [review]:

LGTM.  For future patches can you please use `git format-patch` style?  See https://wiki.gnome.org/Newcomers/SubmittingPatches
Comment 4 Colin Walters 2016-05-23 14:53:29 UTC
I also had to fix up the `Makefile.am` for the rename BTW.
Comment 5 Tom Tromey 2016-05-23 15:56:00 UTC
Thanks, and sorry about that.

As to the formatting, I think I had read this instead:

https://developer.gnome.org/glib/stable/glib-resources.html

This mentions diff -u, not git.