Rename gdb macros with _gdb suffix to avoid ns clashes

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.

https://bugzilla.gnome.org/show_bug.cgi?id=760186
This commit is contained in:
Tom Tromey 2016-05-23 10:45:55 -04:00 committed by Colin Walters
parent 0ffb21d355
commit b7145a1d72
6 changed files with 7 additions and 7 deletions

View File

@ -477,7 +477,7 @@ dist-hook: $(BUILT_EXTRA_DIST) $(top_builddir)/build/win32/vs9/glib.vcproj $(top
# install gdb scripts
gdbdir = $(datadir)/glib-2.0/gdb
dist_gdb_SCRIPTS = glib.py
dist_gdb_SCRIPTS = glib_gdb.py
libglib-gdb.py: libglib-gdb.py.in
$(AM_V_GEN) $(SED) -e "s|\@datadir\@|$(datadir)|" $(srcdir)/libglib-gdb.py.in > $(builddir)/libglib-gdb.py

View File

@ -6,5 +6,5 @@ dir_ = '@datadir@/glib-2.0/gdb'
if not dir_ in sys.path:
sys.path.insert(0, dir_)
from glib import register
from glib_gdb import register
register (gdb.current_objfile ())

View File

@ -261,7 +261,7 @@ distclean-local:
# install gdb scripts
gdbdir = $(datadir)/glib-2.0/gdb
dist_gdb_SCRIPTS = gobject.py
dist_gdb_SCRIPTS = gobject_gdb.py
libgobject-gdb.py: libgobject-gdb.py.in
$(AM_V_GEN) $(SED) -e "s|\@datadir\@|$(datadir)|" $(srcdir)/libgobject-gdb.py.in > $(builddir)/libgobject-gdb.py

View File

@ -1,6 +1,6 @@
import os.path
import gdb
import glib
import glib_gdb
import sys
if sys.version_info[0] >= 3:
@ -37,7 +37,7 @@ def g_type_to_name (gtype):
else:
typenode = lookup_fundamental_type (typenode)
if typenode != None:
return glib.g_quark_to_string (typenode["qname"])
return glib_gdb.g_quark_to_string (typenode["qname"])
return None
def is_g_type_instance (val):
@ -161,7 +161,7 @@ class SignalFrame(FrameDecorator):
def get_detailed_signal_from_frame(self, frame, signal):
detail = self.read_var (frame, "detail")
detail = glib.g_quark_to_string (detail)
detail = glib_gdb.g_quark_to_string (detail)
if detail is not None:
return signal + ":" + detail
else:

View File

@ -6,5 +6,5 @@ dir_ = '@datadir@/glib-2.0/gdb'
if not dir_ in sys.path:
sys.path.insert(0, dir_)
from gobject import register
from gobject_gdb import register
register (gdb.current_objfile ())