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 794895 - gobject_gdb.py: add pretty printer for GType and GtypeClass*
gobject_gdb.py: add pretty printer for GType and GtypeClass*
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gobject
2.56.x
Other Linux
: Normal enhancement
: 2.58
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2018-04-02 12:47 UTC by Michael Olbrich
Modified: 2018-04-11 13:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gobject_gdb.py: add pretty printer for GType and GtypeClass* (2.67 KB, patch)
2018-04-02 12:47 UTC, Michael Olbrich
committed Details | Review

Description Michael Olbrich 2018-04-02 12:47:25 UTC
Created attachment 370436 [details] [review]
gobject_gdb.py: add pretty printer for GType and GtypeClass*

This is useful for printing GValues and the content of GObjects (not the
pointer).
Comment 1 Philip Withnall 2018-04-10 10:11:57 UTC
Review of attachment 370436 [details] [review]:

Nitpick: s/GtypeClass/GTypeClass/ in the commit message. I’ll fix that when pushing it though.

Do you have an example of the output this produces?
Comment 2 Michael Olbrich 2018-04-10 18:11:38 UTC
Without this patch:

(gdb) print *pad
$1 = {
  object = {
    object = {
      g_type_instance = {
        g_class = 0x55555577a540
      },
      ref_count = 3,
      qdata = 0x0
    },
[...]

(gdb) print field.value
$2 = {
  g_type = 64,
  data = {{
      v_int = -402635184,
[...]

With this patch:

(gdb) print *pad
$1 = {
  object = {
    object = {
      g_type_instance = {
        g_class = 0x55555577a400 [g_type: GstPad/GstObject/GInitiallyUnowned]
      },
      ref_count = 3,
      qdata = 0x0
    },
[...]

(gdb) print field.value
$2 = {
  g_type = 0x40 [gchararray],
  data = {{
      v_int = -402635264,
[...]
Comment 3 Philip Withnall 2018-04-11 13:36:44 UTC
Pushed to master as d2c49106a459fe5887ba3e3907ed7fa5f57035d3, thanks!