Glib2 User-Space Markers

To aid in debugging issues with glib2 user-space markers and tapsets have been created for this library used by GTK+ and GNOME. The SystemTap user-space markers are enabled in Fedora 28 and RHEL 7 and allow SystemTap to probe various aspects of glib2 operation such as memory allocation, creation of objects and spawning of threads. Tapsets for the glib2 library have been created to access these probe points. Below is the SystemTap command and the resulting output listing the glibc2 user-space tapset probes points:

$ stap -L "gio.**,glib.**,gobject.**"
gio.task_after_run_in_thread task:unknown thread_cancelled:unknown probestr:unknown $arg1:long $arg2:long
gio.task_before_return task:unknown source_object:unknown callback:unknown callback_data:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long
gio.task_before_run_in_thread task:unknown task_func:unknown probestr:unknown $arg1:long $arg2:long
gio.task_new task:unknown source_object:unknown cancellable:unknown callback:unknown callback_data:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long
gio.task_propagate task:unknown error_set:unknown probestr:unknown $arg1:long $arg2:long
gio.task_set_priority task:unknown priority:unknown probestr:unknown $arg1:long $arg2:long
gio.task_set_source_tag task:unknown source_tag:unknown probestr:unknown $arg1:long $arg2:long
gio.task_set_task_data task:unknown task_data:unknown task_data_destroy:unknown probestr:unknown $arg1:long $arg2:long $arg3:long
glib.idle_add source:unknown context:unknown id:unknown priority:unknown func:unknown data:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long $arg6:long
glib.idle_dispatch source:unknown context:unknown func:unknown data:unknown again:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long
glib.main_after_check source:unknown check:unknown result:unknown probestr:unknown $arg1:long $arg2:long $arg3:long
glib.main_after_dispatch source:unknown source_ptr:unknown dispatch:unknown need_destroy:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long
glib.main_after_prepare source:unknown prepare:unknown source_timeout:unknown probestr:unknown $arg1:long $arg2:long $arg3:long
glib.main_before_dispatch source:unknown source_ptr:unknown dispatch:unknown callback:unknown user_data:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long
glib.main_context_acquire context:unknown success:unknown probestr:unknown $arg1:long $arg2:long
glib.main_context_after_check context:unknown n_ready:unknown probestr:unknown $arg1:long $arg2:long
glib.main_context_after_dispatch context:unknown probestr:unknown $arg1:long
glib.main_context_after_prepare context:unknown priority:unknown n_ready:unknown probestr:unknown $arg1:long $arg2:long $arg3:long
glib.main_context_after_query context:unknown timeout:unknown fds:unknown n_fds:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long
glib.main_context_before_check context:unknown max_priority:unknown fds:unknown n_fds:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long
glib.main_context_before_dispatch context:unknown probestr:unknown $arg1:long
glib.main_context_before_prepare context:unknown probestr:unknown $arg1:long
glib.main_context_before_query context:unknown max_priority:unknown probestr:unknown $arg1:long $arg2:long
glib.main_context_default context:unknown probestr:unknown $arg1:long
glib.main_context_free context:unknown probestr:unknown $arg1:long
glib.main_context_new context:unknown probestr:unknown $arg1:long
glib.main_context_pop_thread_default context:unknown probestr:unknown $arg1:long
glib.main_context_push_thread_default context:unknown probestr:unknown $arg1:long
glib.main_context_release context:unknown probestr:unknown $arg1:long
glib.main_context_wakeup context:unknown probestr:unknown $arg1:long
glib.main_context_wakeup_acknowledge context:unknown probestr:unknown $arg1:long
glib.main_loop_new loop:unknown context:unknown probestr:unknown $arg1:long $arg2:long
glib.main_loop_quit loop:unknown probestr:unknown $arg1:long
glib.main_source_attach source:unknown source_ptr:unknown context:unknown id:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long
glib.main_source_destroy source:unknown source_ptr:unknown context:unknown probestr:unknown $arg1:long $arg2:long $arg3:long
glib.mem_alloc mem:unknown n_bytes:unknown zeroed:unknown failable:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long
glib.mem_free mem:unknown probestr:unknown $arg1:long
glib.mem_realloc mem:unknown old_mem:unknown n_bytes:unknown failable:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long
glib.quark_new str:unknown quark:unknown probestr:unknown $arg1:long $arg2:long
glib.slice_alloc mem:unknown n_bytes:unknown probestr:unknown $arg1:long $arg2:long
glib.slice_free mem:unknown n_bytes:unknown probestr:unknown $arg1:long $arg2:long
glib.source_add_child_source source:unknown child_source:unknown probestr:unknown $arg1:long $arg2:long
glib.source_before_free source:unknown context:unknown finalize:unknown probestr:unknown $arg1:long $arg2:long $arg3:long
glib.source_new source:unknown prepare:unknown check:unknown dispatch:unknown finalize:unknown struct_size:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long $arg6:long
glib.source_set_callback source:unknown func:unknown data:unknown notify:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long
glib.source_set_callback_indirect source:unknown callback_data:unknown ref:unknown unref:unknown get:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long
glib.source_set_name source:unknown name:unknown probestr:unknown $arg1:long $arg2:long
glib.source_set_priority source:unknown context:unknown priority:unknown probestr:unknown $arg1:long $arg2:long $arg3:long
glib.source_set_ready_time source:unknown ready_time:unknown probestr:unknown $arg1:long $arg2:long
glib.thread_spawned func:unknown data:unknown name:unknown probestr:unknown $arg1:long $arg2:long $arg3:long
glib.timeout_add source:unknown context:unknown id:unknown priority:unknown interval:unknown func:unknown data:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long $arg6:long $arg7:long
glib.timeout_dispatch source:unknown context:unknown func:unknown data:unknown again:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long
gobject.object_dispose object:unknown gtype:unknown type:unknown last_unref:unknown probestr:unknown $arg1:long $arg2:long $arg3:long
gobject.object_dispose_end object:unknown gtype:unknown type:unknown last_unref:unknown probestr:unknown $arg1:long $arg2:long $arg3:long
gobject.object_finalize object:unknown gtype:unknown type:unknown probestr:unknown $arg1:long $arg2:long
gobject.object_finalize_end object:unknown gtype:unknown type:unknown probestr:unknown $arg1:long $arg2:long
gobject.object_new object:unknown gtype:unknown type:unknown probestr:unknown $arg1:long $arg2:long
gobject.object_ref object:unknown gtype:unknown type:unknown old_refcount:unknown refcount:unknown probestr:unknown $arg1:long $arg2:long $arg3:long
gobject.object_unref object:unknown gtype:unknown type:unknown old_refcount:unknown refcount:unknown probestr:unknown $arg1:long $arg2:long $arg3:long
gobject.signal_emit gsignal:unknown detail:unknown signal:unknown object:unknown gtype:unknown type:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long
gobject.signal_emit_end gsignal:unknown detail:unknown signal:unknown object:unknown gtype:unknown type:unknown probestr:unknown $arg1:long $arg2:long $arg3:long $arg4:long
gobject.signal_new gsignal:unknown name:unknown gtype:unknown type:unknown probestr:unknown $arg1:long $arg2:long $arg3:long
gobject.type_new name:unknown parent_gtype:unknown gtype:unknown probestr:unknown $arg1:long $arg2:long $arg3:long

Using glib2 User-Space Markers

To use the SystemTap user-space markers on a Fedora you will need:

Examples Use of glib2 Probing

One can watch the memory allocation using the gmalloc_watch.stp example from Colin Walter's blog article.

The Dunfell tool visualizes data collected from the glib2 probe points. This can provide some help in diagnosing issues with GNOME.

References