[glib] Drop memory-related trap variables
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Drop memory-related trap variables
- Date: Wed, 1 Jan 2014 23:04:03 +0000 (UTC)
commit 58cdf0b474ddcc94ba0bedc39c778cfa93c518ce
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Dec 30 10:53:32 2013 -0500
Drop memory-related trap variables
These are just more lo-tech conditional breakpoint wannabes.
Debuggers can be trusted to support conditional breakpoints
nowadays.
docs/reference/glib/running.xml | 42 ---------------------------------------
glib/gmem.c | 25 -----------------------
2 files changed, 0 insertions(+), 67 deletions(-)
---
diff --git a/docs/reference/glib/running.xml b/docs/reference/glib/running.xml
index 67699d9..40b0a37 100644
--- a/docs/reference/glib/running.xml
+++ b/docs/reference/glib/running.xml
@@ -274,48 +274,6 @@ returned by functions like <function>strftime()</function>.
</refsect2>
-<refsect2>
-<title>Traps and traces</title>
-
-<para>
-<indexterm><primary>g_trap_free_size</primary></indexterm>
-<indexterm><primary>g_trap_realloc_size</primary></indexterm>
-<indexterm><primary>g_trap_malloc_size</primary></indexterm>
-Some code portions contain trap variables that can be set during debugging
-time if GLib has been configured with <option>--enable-debug=yes</option>.
-Such traps lead to immediate code halts to examine the current program state
-and backtrace.
-</para>
-
-<para>
-Currently, the following trap variables exist:
-<programlisting>
-static volatile gulong g_trap_free_size;
-static volatile gulong g_trap_realloc_size;
-static volatile gulong g_trap_malloc_size;
-</programlisting>
-If set to a size > 0, <link linkend="g-free">g_free</link>(),
-<link linkend="g-realloc">g_realloc</link>() and
-<link linkend="g-malloc">g_malloc</link>() will be intercepted if the size
-matches the size of the corresponding memory block. This will only work with
-<literal>g_mem_set_vtable (glib_mem_profiler_table)</literal> upon startup
-though, because memory profiling is required to match on the memory block sizes.
-</para>
-<para>
-Note that many modern debuggers support conditional breakpoints, which achieve
-pretty much the same. E.g. in gdb, you can do
-<programlisting>
-break g_malloc
-condition 1 n_bytes == 20
-</programlisting>
-to break only on g_malloc() calls where the size of the allocated memory block
-is 20.
-</para>
-</refsect2>
-
-<refsect2>
-<title>Gdb debugging macros</title>
-
<para>
glib ships with a set of python macros for the gdb debugger. These includes pretty
printers for lists, hashtables and gobject types. It also has a backtrace filter
diff --git a/glib/gmem.c b/glib/gmem.c
index 990f637..d707619 100644
--- a/glib/gmem.c
+++ b/glib/gmem.c
@@ -556,11 +556,6 @@ static gsize profile_allocs = 0;
static gsize profile_zinit = 0;
static gsize profile_frees = 0;
static GMutex gmem_profile_mutex;
-#ifdef G_ENABLE_DEBUG
-static volatile gsize g_trap_free_size = 0;
-static volatile gsize g_trap_realloc_size = 0;
-static volatile gsize g_trap_malloc_size = 0;
-#endif /* G_ENABLE_DEBUG */
#define PROFILE_TABLE(f1,f2,f3) ( ( ((f3) << 2) | ((f2) << 1) | (f1) ) * (MEM_PROFILE_TABLE_SIZE +
1))
@@ -700,11 +695,6 @@ profiler_try_malloc (gsize n_bytes)
{
gsize *p;
-#ifdef G_ENABLE_DEBUG
- if (g_trap_malloc_size == n_bytes)
- G_BREAKPOINT ();
-#endif /* G_ENABLE_DEBUG */
-
p = malloc (sizeof (gsize) * 2 + n_bytes);
if (p)
@@ -738,11 +728,6 @@ profiler_calloc (gsize n_blocks,
gsize l = n_blocks * n_block_bytes;
gsize *p;
-#ifdef G_ENABLE_DEBUG
- if (g_trap_malloc_size == l)
- G_BREAKPOINT ();
-#endif /* G_ENABLE_DEBUG */
-
p = calloc (1, sizeof (gsize) * 2 + l);
if (p)
@@ -777,11 +762,6 @@ profiler_free (gpointer mem)
}
else
{
-#ifdef G_ENABLE_DEBUG
- if (g_trap_free_size == p[1])
- G_BREAKPOINT ();
-#endif /* G_ENABLE_DEBUG */
-
profiler_log (PROFILER_FREE,
p[1], /* length */
TRUE);
@@ -802,11 +782,6 @@ profiler_try_realloc (gpointer mem,
gsize *p = mem;
p -= 2;
-
-#ifdef G_ENABLE_DEBUG
- if (g_trap_realloc_size == n_bytes)
- G_BREAKPOINT ();
-#endif /* G_ENABLE_DEBUG */
if (mem && p[0]) /* free count */
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]