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 719687 - fix or remove g_trap_object_ref
fix or remove g_trap_object_ref
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gobject
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-12-02 14:27 UTC by Colin Walters
Modified: 2013-12-03 11:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Drop g_trap_object_ref debugging mechanism (3.84 KB, patch)
2013-12-03 02:51 UTC, Matthias Clasen
committed Details | Review
Remove g_trap_instance_signals as well (2.96 KB, patch)
2013-12-03 03:29 UTC, Matthias Clasen
committed Details | Review

Description Colin Walters 2013-12-02 14:27:19 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.
Comment 1 Bastien Nocera 2013-12-02 14:35:59 UTC
We would also need to update the "Debugging reference count problems" section of the documentation.
Comment 2 Allison Karlitskaya (desrt) 2013-12-02 15:11:00 UTC
Definitely in favour of dropping this.
Comment 3 Matthias Clasen 2013-12-02 15:22:20 UTC
+1 for dropping
Comment 4 Marc-Andre Lureau 2013-12-02 16:19:54 UTC
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.
Comment 5 Matthias Clasen 2013-12-03 02:51:39 UTC
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.
Comment 6 Colin Walters 2013-12-03 02:53:31 UTC
Review of attachment 263360 [details] [review]:

Looks good to me.
Comment 7 Matthias Clasen 2013-12-03 03:11:56 UTC
Attachment 263360 [details] pushed as 28c2706 - Drop g_trap_object_ref debugging mechanism
Comment 8 Matthias Clasen 2013-12-03 03:29:19 UTC
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.
Comment 9 Colin Walters 2013-12-03 03:56:51 UTC
Review of attachment 263363 [details] [review]:

Hooray for killing old ugly obsolete code!
Comment 10 Matthias Clasen 2013-12-03 11:01:01 UTC
Attachment 263363 [details] pushed as 2baa50e - Remove g_trap_instance_signals as well