Tomáš Pospíšek's Notizblock

when gdb won't find TypeNode

Today, while debugging a segmentation fault I encountered:

(gdb) print *(GtkRadioButton *)(tool_widgets[0])
$3 = {check_button = {toggle_button = {button = {bin = {container = {widget = {parent_instance = {g_type_instance = {Python Exception <class 'gdb.error'> No type named TypeNode.: 
g_class = }, ref_count = 1, 
                qdata = 0x555555a599f0}, priv = 0x5555559a0600}, priv = 0x5555559a05e0}, priv = 0x5555559a05d0}, priv = 0x5555559a0570}, 
      priv = 0x5555559a0560}}, priv = 0x5555559a0540}

gdb evidently doesn't know what the TypeNode type is.

The thing is, TypeNode is not an exported type defined in a .h file, but is an implementation internal type defined in gtype.c.

So in order to let gdb know about that type we need to get the debug symbols of GLib which uses TypeNode internally:

# apt-get install libglib2.0-0-dbgsym

In order to have access to debug symbols, you need to include the "debug" part of the Debian/Ubuntu repositories in the package sources:

$ cat /etc/apt/sources.list
deb buster-debug main

Tomáš Pospíšek, 2019-01-27