1 <refentry id="glib-running" revision="17 Jan 2002">
3 <refentrytitle>Running GLib Applications</refentrytitle>
4 <manvolnum>3</manvolnum>
5 <refmiscinfo>GLib Library</refmiscinfo>
9 <refname>Running GLib Applications</refname>
11 How to run and debug your GLib application
16 <title>Running and debugging GLib Applications</title>
19 <title>Environment variables</title>
22 GLib inspects a few of environment variables in addition to standard
23 variables like <envar>LANG</envar>, <envar>PATH</envar> or <envar>HOME</envar>.
27 <title><envar>G_FILENAME_ENCODING</envar></title>
30 This environment variable can be set to a comma-separated list of character
31 set names. GLib assumes that filenames are encoded in the first character
32 set from that list rather than in UTF-8. The special token "@locale" can be
33 used to specify the character set for the current locale.
38 <title><envar>G_BROKEN_FILENAMES</envar></title>
41 If this environment variable is set, GLib assumes that filenames are in
42 the locale encoding rather than in UTF-8. G_FILENAME_ENCODING takes
43 priority over G_BROKEN_FILENAMES.
48 <title><envar>G_MESSAGES_PREFIXED</envar></title>
51 A list of log levels for which messages should be prefixed by the
52 program name and PID of the application. The default is to prefix
53 everything except <literal>G_LOG_LEVEL_MESSAGE</literal> and <literal>G_LOG_LEVEL_INFO</literal>.
58 <title><envar>G_DEBUG</envar></title>
61 If GLib has been configured with <option>--enable-debug=yes</option>,
62 this variable can be set to a list of debug options, which cause GLib
63 to print out different types of debugging information.
66 <term>fatal_warnings</term>
67 <listitem><para>Causes GLib to abort the program at the first call
68 to <link linkend="g-warning">g_warning</link>(). This option is
69 special in that it doesn't require GLib to be configured with
70 debugging support.</para>
78 <title><envar>G_RANDOM_VERSION</envar></title>
81 If this environment variable is set to '2.0', the outdated
82 pseudo-random number seeding and generation algorithms from
83 GLib-2.0 are used instead of the new better ones. Use the GLib-2.0
84 algorithms only if you have sequences of numbers generated with
85 Glib-2.0 that you need to reproduce exactly.
90 <title><envar>LIBCHARSET_ALIAS_DIR</envar></title>
93 Allows to specify a nonstandard location for the
94 <filename>charset.aliases</filename> file that is used by the
95 character set conversion routines. The default location is the
96 <replaceable>libdir</replaceable> specified at compilation time.
103 <title>Traps and traces</title>
106 Some code portions contain trap variables that can be set during debugging
107 time if GLib has been configured with <option>--enable-debug=yes</option>.
108 Such traps lead to immediate code halts to examine the current program state
113 Currently, the following trap variables exist:
115 static volatile gulong g_trap_free_size;
116 static volatile gulong g_trap_realloc_size;
117 static volatile gulong g_trap_malloc_size;
119 If set to a size > 0, <link linkend="g-free">g_free</link>(),
120 <link linkend="g-realloc">g_realloc</link>() and
121 <link linkend="g-malloc">g_malloc</link>() will be intercepted if the size
122 matches the size of the corresponding memory block. This will only work with
123 <literal>g_mem_set_vtable (glib_mem_profiler_table)</literal> upon startup
124 though, because memory profiling is required to match on the memory block sizes.