GNOME Bugzilla – Bug 719687
fix or remove g_trap_object_ref
Last modified: 2013-12-03 11:01:04 UTC
g_trap_object_ref was introduced in 2000: https://git.gnome.org/browse/glib/commit/?h=782a8e2e7c69c3d98bd69bcfdbb65ded520576f4 Since then (or possibly before), gdb supports conditional breakpoints, so you can just do: "break g_object_ref if _object == 0xcafebabe" or whatever. Anyways it turns out at least some versions of gcc omit the code entirely, deducing it's used but never set, and is static. So we should either fix this, or remove it. I'd suggest removing it, in line with the general trend of delegating this type of stuff to external tools where possible.
We would also need to update the "Debugging reference count problems" section of the documentation.
Definitely in favour of dropping this.
+1 for dropping
fwiw, I don't care much, since it's only in debug build. But +1 in general for the idea to document proper gdb instead. What about the rest of the g_trap functions ? I guess even g_trap_instance_signals could be done with gdb macro/scripts.
Created attachment 263360 [details] [review] Drop g_trap_object_ref debugging mechanism This is really just a very crude and limited conditional breakpoint. Update the documentation to explain conditional breakpoints in gdb instead. Also, remove the link to refdbg, which appears dead.
Review of attachment 263360 [details] [review]: Looks good to me.
Attachment 263360 [details] pushed as 28c2706 - Drop g_trap_object_ref debugging mechanism
Created attachment 263363 [details] [review] Remove g_trap_instance_signals as well This is another crude conditional breakpoint mechanism and can be done better with actual conditional breakpoints or with systemtap tracepoints.
Review of attachment 263363 [details] [review]: Hooray for killing old ugly obsolete code!
Attachment 263363 [details] pushed as 2baa50e - Remove g_trap_instance_signals as well