mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-28 18:16:34 +02:00
* glib/gdebug.h: New header containing GTK_DEBUG-style debugging support for GLib. Currently only the fatal_warnings debug option exists. * glib/gmessages.c (g_log_msg_prefix_init): New one-shot function for parsing G_MESSAGES_PREFIXED. (_g_debug_init): New one-shot function for parsing G_DEBUG. (g_log_write_prefix): Use g_log_msg_prefix_init(). (g_messages_init): Use g_log_msg_prefix_init() and _g_debug_init(). * glib/Makefile.am (libglib_1_3_la_SOURCES): Add gdebug.h. * glib/Makefile.am (IGNORE_HFILES): Add gdebug.h. * glib/running.sgml: Document the G_DEBUG environment variable. * glib/tmpl/threads.sgml: Replace g_thread_wait() by g_thread_join() in two places.
96 lines
2.8 KiB
Plaintext
96 lines
2.8 KiB
Plaintext
<refentry id="glib-running" revision="17 Jan 2002">
|
|
<refmeta>
|
|
<refentrytitle>Running GLib Applications</refentrytitle>
|
|
<manvolnum>3</manvolnum>
|
|
<refmiscinfo>GLib Library</refmiscinfo>
|
|
</refmeta>
|
|
|
|
<refnamediv>
|
|
<refname>Running GLib Applications</refname>
|
|
<refpurpose>
|
|
How to run and debug your GLib application
|
|
</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
<title>Running and debugging GLib Applications</title>
|
|
|
|
<refsect2>
|
|
<title>Environment variables</title>
|
|
|
|
<para>
|
|
GLib inspects a few of environment variables in addition to standard
|
|
variables like <envar>LANG</envar>, <envar>PATH</envar> or <envar>HOME</envar>.
|
|
</para>
|
|
|
|
<formalpara>
|
|
<title><envar>G_BROKEN_FILENAMES</envar></title>
|
|
|
|
<para>
|
|
If this environment variable is set, GLib assumes that filenames are in
|
|
the locale encoding rather than in UTF-8.
|
|
</para>
|
|
</formalpara>
|
|
|
|
<formalpara>
|
|
<title><envar>G_MESSAGES_PREFIXED</envar></title>
|
|
|
|
<para>
|
|
A list of log levels for which messages should be prefixed by the
|
|
program name and PID of the application. The default is to prefix
|
|
everything except <literal>G_LOG_LEVEL_MESSAGE</literal> and <literal>G_LOG_LEVEL_INFO</literal>.
|
|
</para>
|
|
</formalpara>
|
|
|
|
<formalpara>
|
|
<title><envar>G_DEBUG</envar></title>
|
|
|
|
<para>
|
|
If GLib has been configured with <option>--enable-debug=yes</option>,
|
|
this variable can be set to a list of debug options, which cause GLib
|
|
to print out different types of debugging information.
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term>fatal_warnings</term>
|
|
<listitem><para>Causes GLib to abort the program at the first call
|
|
to <link linkend="g-warning">g_warning</link>(). This option is
|
|
special in that it doesn't require GLib to be configured with
|
|
debugging support.</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</formalpara>
|
|
|
|
</refsect2>
|
|
|
|
<refsect2>
|
|
<title>Traps and traces</title>
|
|
|
|
<para>
|
|
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>
|
|
</refsect2>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|