mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-02 22:29:38 +02:00
Initial support for gdb python macros
This includes support for gobject pointer pretty printing and signal frame compression in backtraces. https://bugzilla.gnome.org/show_bug.cgi?id=595619
This commit is contained in:
@@ -70,6 +70,7 @@ EXTRA_DIST += \
|
||||
gregex.c \
|
||||
gregex.h \
|
||||
win_iconv.c \
|
||||
libglib-gdb.py.in \
|
||||
$(MIRRORING_TAB_SOURCE)
|
||||
|
||||
# These may be in the builddir too
|
||||
@@ -365,8 +366,18 @@ dist-hook: $(BUILT_EXTRA_DIST)
|
||||
if test -f $$f; then d=.; else d=$(srcdir); fi; \
|
||||
cp $$d/$$f $(distdir) || exit 1; done
|
||||
|
||||
# install gdb scripts
|
||||
gdbdir = $(datadir)/glib-2.0/gdb
|
||||
gdb_SCRIPTS = glib.py
|
||||
|
||||
libglib-gdb.py: libglib-gdb.py.in
|
||||
sed -e "s|\@datadir\@|$(datadir)|" libglib-gdb.py.in > libglib-gdb.py
|
||||
|
||||
|
||||
install-data-hook: libglib-gdb.py
|
||||
mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load${libdir}
|
||||
$(INSTALL) libglib-gdb.py $(DESTDIR)$(datadir)/gdb/auto-load${libdir}/libglib-2.0.so.0.$(LT_CURRENT).0-gdb.py
|
||||
if HAVE_GLIB_RUNTIME_LIBDIR
|
||||
install-data-hook:
|
||||
mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
|
||||
mv $(DESTDIR)$(libdir)/libglib-2.0.so.0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
|
||||
mv $(DESTDIR)$(libdir)/libglib-2.0.so.0.$(LT_CURRENT).0 $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR)
|
||||
|
27
glib/glib.py
Normal file
27
glib/glib.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import gdb
|
||||
|
||||
# This is not quite right, as local vars may override symname
|
||||
def read_global_var (symname):
|
||||
return gdb.selected_frame().read_var(symname)
|
||||
|
||||
def g_quark_to_string (quark):
|
||||
if quark == None:
|
||||
return None
|
||||
quark = long(quark)
|
||||
if quark == 0:
|
||||
return None
|
||||
val = read_global_var ("g_quarks")
|
||||
max_q = long(read_global_var ("g_quark_seq_id"))
|
||||
if quark < max_q:
|
||||
return val[quark].string()
|
||||
return None
|
||||
|
||||
def pretty_printer_lookup (val):
|
||||
# None yet, want things like hash table and list
|
||||
return None
|
||||
|
||||
def register (obj):
|
||||
if obj == None:
|
||||
obj = gdb
|
||||
|
||||
obj.pretty_printers.append(pretty_printer_lookup)
|
10
glib/libglib-gdb.py.in
Normal file
10
glib/libglib-gdb.py.in
Normal file
@@ -0,0 +1,10 @@
|
||||
import sys
|
||||
import gdb
|
||||
|
||||
# Update module path.
|
||||
dir = '@datadir@/glib-2.0/gdb'
|
||||
if not dir in sys.path:
|
||||
sys.path.insert(0, dir)
|
||||
|
||||
from glib import register
|
||||
register (gdb.current_objfile ())
|
Reference in New Issue
Block a user