From 5cb432b56cd88e2d184ffa64757bd3809d42c399 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 26 Jan 2006 19:28:33 +0000 Subject: [PATCH] Mention g_trap_object_ref 2006-01-26 Matthias Clasen * gobject/tut_tools.xml: Mention g_trap_object_ref * glib/running.sgml: Add g_trap variables to the index. Mention conditional breakpoints as an alternative. --- docs/reference/ChangeLog | 7 +++++++ docs/reference/glib/running.sgml | 13 +++++++++++++ docs/reference/gobject/tut_tools.xml | 11 +++++++++++ 3 files changed, 31 insertions(+) diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 599aef041..4e837d89d 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,10 @@ +2006-01-26 Matthias Clasen + + * gobject/tut_tools.xml: Mention g_trap_object_ref + + * glib/running.sgml: Add g_trap variables to the index. + Mention conditional breakpoints as an alternative. + Wed Jan 25 17:32:22 2006 Tim Janik * glib/tmpl/memory_slices.sgml: link to G_DEBUG/G_SLICE where appropriate. diff --git a/docs/reference/glib/running.sgml b/docs/reference/glib/running.sgml index d05cabe94..5600700ef 100644 --- a/docs/reference/glib/running.sgml +++ b/docs/reference/glib/running.sgml @@ -160,6 +160,9 @@ variables like LANG, PATH or HOME. Traps and traces +g_trap_free_size +g_trap_realloc_size +g_trap_malloc_size Some code portions contain trap variables that can be set during debugging time if GLib has been configured with . Such traps lead to immediate code halts to examine the current program state @@ -180,6 +183,16 @@ matches the size of the corresponding memory block. This will only work with g_mem_set_vtable (glib_mem_profiler_table) upon startup though, because memory profiling is required to match on the memory block sizes. + +Note that many modern debuggers support conditional breakpoints, which achieve +pretty much the same. E.g. in gdb, you can do + +break g_malloc +condition 1 n_bytes == 20 + +to break only on g_malloc() calls where the size of the allocated memory block +is 20. + diff --git a/docs/reference/gobject/tut_tools.xml b/docs/reference/gobject/tut_tools.xml index 0fd0fe656..46510352a 100644 --- a/docs/reference/gobject/tut_tools.xml +++ b/docs/reference/gobject/tut_tools.xml @@ -49,6 +49,17 @@ It suports a filter-rule mechanism to let you trace only the objects you are interested in and it can be used together with gdb. + + g_trap_object_ref + Note that if GObject has been compiled with , + it exports a trap variable + +static volatile GObject *g_trap_object_ref; + + If set to a non-NULL value, g_object_ref() + and g_object_unref() will be intercepted + when called with that value. +